aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters
Commit message (Collapse)AuthorAgeFilesLines
* Fix a NoMethodError schema_statements.rbGenadi Samokovarov2016-08-101-0/+6
| | | | | | | | | | | | | | | | | | If you call `remove_index` with wrong options, say a type, like I did, you get: ``` == 20160810072541 RemoveUniqueIndexOnGoals: migrating ========================= -- remove_index(:goal, {:coulmn=>:kid_id, :unique=>true}) rails aborted! StandardError: An error has occurred, this and all later migrations canceled: undefined method `ArgumentError' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0x007fb7dec91b28> ``` What happened is that I mistyped column (coulmn) and got a `NoMethodError`, because of a missing comma during the raise. This made Ruby think we're calling the method `ArgumentError`.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* applies remaining conventions across the projectXavier Noria2016-08-0611-14/+11
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-0617-258/+258
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-064-19/+19
|
* modernizes hash syntax in activerecordXavier Noria2016-08-0616-73/+73
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-0661-843/+843
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* The problem isn't the detection but the deadlock itselfDavid Heinemeier Hansson2016-08-042-4/+4
|
* Merge pull request #25107 from Erol/introduce-new-ar-transaction-error-classesRafael Mendonça França2016-08-032-22/+40
|\ | | | | | | | | | | Introduce new ActiveRecord transaction error classes Closes #26018
| * Introduce new ActiveRecord transaction error classesErol Fornoles2016-05-242-22/+40
| |
* | Fix explain logging with bindsRyuta Kamizono2016-07-202-4/+4
| | | | | | | | `binds` is an array of a query attribute since Active Record 5.0.
* | Merge pull request #25307 from ↵Eileen M. Uchitelle2016-07-011-0/+21
|\ \ | | | | | | | | | | | | kamipo/extract_foreign_key_action_from_information_schema Extract foreign key action from `information_schema`
| * | Extract foreign key action from `information_schema`Ryuta Kamizono2016-06-071-0/+21
| | | | | | | | | | | | Fixes #25300.
* | | Do not specal case inspecting associated arrays of over 10 elements, ↵Kevin McPhillips2016-06-291-1/+6
|/ / | | | | | | preventing infinite looping in some cases.
* | Fix sqlite3 test failureRyuta Kamizono2016-06-042-3/+3
| | | | | | | | Sqlite3 test failure is due to 66ebbc4952f6cfb37d719f63036441ef98149418.
* | Dont re-define class SQLite3Adapter on testArthur Neves2016-06-032-108/+98
| | | | | | | | | | | | | | We were declaring in a few tests, which depending of the order load will cause an error, as the super class could change. see https://github.com/rails/rails/commit/ac1c4e141b20c1067af2c2703db6e1b463b985da#commitcomment-17731383
* | Do not include default column limit in schema.rbRyuta Kamizono2016-05-311-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow up of #20815. ```ruby class CreatePeople < ActiveRecord::Migration[5.0] def change create_table :people do |t| t.integer :int t.bigint :bint t.text :txt t.binary :bin end end end ``` Result. In postgresql and sqlite3 adapters: ```ruby ActiveRecord::Schema.define(version: 20160531141018) do create_table "people", force: :cascade do |t| t.integer "int" t.bigint "bint" t.text "txt" t.binary "bin" end end ``` In mysql2 adapter: ```ruby ActiveRecord::Schema.define(version: 20160531141018) do create_table "people", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| t.integer "int" t.bigint "bint" t.text "txt", limit: 65535 t.binary "bin", limit: 65535 end end ``` After this patch: ```ruby ActiveRecord::Schema.define(version: 20160531141018) do create_table "people", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| t.integer "int" t.bigint "bint" t.text "txt" t.binary "bin" end end ```
* Add AR::TransactionSerializationError for transaction serialization failures ↵Erol Fornoles2016-05-212-0/+134
| | | | or deadlocks
* Rails 5.1 point type should not raise exception if empty string is provided ↵bUg2016-05-151-0/+7
| | | | as value
* Should quote `lock_name` to pass to `get_advisory_lock`Ryuta Kamizono2016-05-101-3/+3
|
* Followup of #24835Vipul A M2016-05-032-4/+4
| | | | Fix failing tests
* Extract `add_sql_comment!` methodRyuta Kamizono2016-04-291-3/+3
| | | | | | Refactor of #22911. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* Dont simply assume a type is a valid database type. This is only always true ↵Vipul A M2016-04-251-0/+11
| | | | | | | in the case of sqlite. Others adapters need to perform a check for validity. Add coverage for mysql2 db type validation
* Add Expression Indexes and Operator Classes support for PostgreSQLRyuta Kamizono2016-04-243-19/+46
| | | | | | | | | | | | | | | | Example: create_table :users do |t| t.string :name t.index 'lower(name) varchar_pattern_ops' end Fixes #19090. Fixes #21765. Fixes #21819. Fixes #24359. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* remove_index do not fetch indexes if name is specifiedSeva Orlov2016-04-241-0/+5
| | | | | | There is no need to fetch all table indexes in remove_index if name is specified. If name is wrong, then StatementInvalid will be raised. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* Should keep quoting behaivor of a time column value in sqlite3 adapterRyuta Kamizono2016-04-151-3/+8
| | | | | | | | | | | | | | | | | | | | Follow up to #24542. In MySQL and PostgreSQL, a time column value is saved as ignored the date part of it. But in SQLite3, a time column value is saved as a string. We should keep previous quoting behavior in sqlite3 adapter. ``` sqlite> CREATE TABLE "foos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "start" time(0), "finish" time(4)); sqlite> INSERT INTO "foos" ("start", "finish") VALUES ('2000-01-01 12:30:00', '2000-01-01 12:30:00.999900'); sqlite> SELECT "foos".* FROM "foos"; 1|2000-01-01 12:30:00|2000-01-01 12:30:00.999900 sqlite> SELECT "foos".* FROM "foos" WHERE "foos"."start" = '2000-01-01 12:30:00' LIMIT 1; 1|2000-01-01 12:30:00|2000-01-01 12:30:00.999900 sqlite> SELECT "foos".* FROM "foos" WHERE "foos"."start" = '12:30:00' LIMIT 1; sqlite> ```
* Properly serialize all JSON primitives in the AR JSON typeSean Griffin2016-04-132-9/+23
| | | | | | | | | | | | | | Previously we were assuming that the only valid types for encoding were arrays and hashes. However, any JSON primitive is an accepted value by both PG and MySQL. This does involve a minor breaking change in the handling of `default` in the schema dumper. This is easily worked around, as passing a hash/array literal would have worked fine in previous versions of Rails. However, because of this, I will not be backporting this to 4.2 or earlier. Fixes #24234
* Support microsecond datetime precision on MariaDB 5.3+.Jeremy Daer2016-04-082-21/+45
| | | | | | | | | We support microsecond datetime precision for MySQL 5.6.4+. MariaDB has supported it since 5.3.0, but even 10.x versions return a compatible version string like `5.5.5-10.1.8-MariaDB-log` which we parse as 5.5.5, before MySQL supported microsecond precision. Specialize our version check to account for MariaDB to fix.
* Use `QUOTED_TRUE` and `QUOTED_FALSE` instead of magic stringsyui-knk2016-04-051-2/+12
| | | | | | Because we define `QUOTED_TRUE` as `"1"` and `QUOTED_FALSE` as `"0"`. And add test cases to ensure this commit does not break current behavior even if the value of `attributes_before_type_cast` is false.
* Append sql_mode instead of overwriting in strict modeRyuta Kamizono2016-03-131-25/+25
| | | | For keep the default SQL mode.
* Merge pull request #23797 from ↵Rafael França2016-03-111-0/+9
|\ | | | | | | | | kamipo/case_sensitive_comparison_for_non_string_column The BINARY Operator is only needed for string columns
| * The BINARY Operator is only needed for string columnsRyuta Kamizono2016-02-221-0/+9
| | | | | | | | Follow up to #13040.
* | Fix test failures caused by #23958Sean Griffin2016-03-111-1/+1
| | | | | | | | I'm unsure how this passed CI in the pull request.
* | Merge pull request #24087 from kamipo/dump_bigint_instead_of_integer_limit_8Rafael França2016-03-111-1/+1
|\ \ | | | | | | Dump `bigint` instead of `integer` with `limit: 8` for schema dumper
| * | Dump `bigint` instead of `integer` with `limit: 8` for schema dumperRyuta Kamizono2016-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ```ruby create_table "big_numbers", force: :cascade do |t| t.integer "bigint_column", limit: 8 end ``` After: ```ruby create_table "big_numbers", force: :cascade do |t| t.bigint "bigint_column" end ```
* | | Merge pull request #23677 from kamipo/passing_table_name_to_column_initializeRafael França2016-03-111-0/+26
|\ \ \ | |/ / |/| | Passing `table_name` to `Column#initialize` to avoid `instance_variable_set`
| * | Initialize `column.table_name` immediately for `column.serial?` correctly ↵Ryuta Kamizono2016-03-081-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | working Currently the results of `column.serial?` is not correct. For `column.serial?` correctly working, initialize `column.table_name` immediately.
* | | Merge pull request #23958 from kamipo/fix_bigserial_appears_with_limit_8Rafael França2016-03-111-2/+2
|\ \ \ | | | | | | | | Fix bigserial appears with limit 8 for schema dumper
| * | | Fix bigserial appears with limit 8 for schema dumperRyuta Kamizono2016-03-041-2/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ```ruby create_table "postgresql_big_serials", force: :cascade do |t| t.bigserial "seq", limit: 8, null: false end ``` After: ```ruby create_table "postgresql_big_serials", force: :cascade do |t| t.bigserial "seq", null: false end ```
* / / add test case for schema dumping of PG bytea columns.Yves Senn2016-03-081-0/+9
|/ /
* | Deprecate `{insert|update|delete}_sql` in `DatabaseStatements`Ryuta Kamizono2016-03-022-59/+3
| | | | | | | | | | Originally, `{insert|update|delete}_sql` is protected methods. We can use the `{insert|update|delete}` public methods instead.
* | Merge pull request #23953 from ↵Rafael França2016-03-018-132/+90
|\ \ | | | | | | | | | | | | kamipo/fix_tests_failure_with_prepared_statements_false Fix tests failure with `prepared_statements: false`
| * | Remove unnecessary namespaces in `explain_test.rb`Ryuta Kamizono2016-02-293-40/+28
| | |
| * | Fix tests failure with `prepared_statements: false`Ryuta Kamizono2016-02-297-94/+64
| | | | | | | | | | | | | | | | | | Some tests does not work for unprepared statements. Add `if ActiveRecord::Base.connection.prepared_statements` and fix a regex for fix tests failure with `prepared_statements: false`.
* | | Fix `NoMethodError: undefined method `fields' for nil:NilClass`Ryuta Kamizono2016-02-291-0/+18
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently `exec_query` raises `NoMethodError` when executing no result queries (`INSERT`, `UPDATE`, `DELETE`, and all DDL) in mysql2 adapter. ``` irb(main):002:0> conn.execute("create table t(a int)") (43.3ms) create table t(a int) => nil irb(main):003:0> conn.execute("insert into t values (1)") (19.3ms) insert into t values (1) => nil irb(main):004:0> conn.exec_query("insert into t values (1)") SQL (28.6ms) insert into t values (1) NoMethodError: undefined method `fields' for nil:NilClass ```
* / Fix NoMethodError preparable for Arel::Visitors in case prepared statements ↵Azzurrio2016-02-221-0/+22
|/ | | | is falsy
* Typos in AR testsAkira Matsuda2016-02-031-1/+1
|
* tabenai (typo)Akira Matsuda2016-02-011-6/+6
|
* Avoid extra `show variables` in migrationRyuta Kamizono2016-02-011-5/+0
| | | | | | | | | | | | | `initialize_schema_migrations_table` is called in every migrations. https://github.com/rails/rails/blob/v5.0.0.beta1/activerecord/lib/active_record/migration.rb#L1080 https://github.com/rails/rails/blob/v5.0.0.beta1/activerecord/lib/active_record/schema.rb#L51 This means that extra `show variables` is called regardless of the existence of `schema_migrations` table. This change is to avoid extra `show variables` if `schema_migrations` table exists.
* Remove duplicated composite primary key testsRyuta Kamizono2016-02-012-16/+0
|