aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/sqlite3
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #29732 from kirs/frozen-activerecordRafael França2017-07-217-0/+14
|\ | | | | Use frozen-string-literal in ActiveRecord
| * Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-197-0/+14
| |
* | Revert "Extract `bind_param` and `bind_attribute` into `ActiveRecord::TestCase`"Sean Griffin2017-07-211-5/+5
|/ | | | | | | | This reverts commit b6ad4052d18e4b29b8a092526c2beef013e2bf4f. This is not something that the majority of Active Record should be testing or care about. We should look at having fewer places rely on these details, not make it easier to rely on them.
* Merge pull request #29033 from kamipo/make_preload_query_to_prepared_statementsSean Griffin2017-07-181-1/+1
|\ | | | | Make preload query to preparable
| * Make preload query to preparableRyuta Kamizono2017-07-071-1/+1
| | | | | | | | | | | | | | Currently preload query cannot be prepared statements even if `prepared_statements: true` due to array handler in predicate builder doesn't support making bind params. This makes preload query to preparable by don't passing array value if possible.
* | Change sqlite3 boolean serialization to use 1 and 0Lisa Ugray2017-07-111-0/+13
|/ | | | | | | | | | | | | | | | | | | | Abstract boolean serialization has been using 't' and 'f', with MySQL overriding that to use 1 and 0. This has the advantage that SQLite natively recognizes 1 and 0 as true and false, but does not natively recognize 't' and 'f'. This change in serialization requires a migration of stored boolean data for SQLite databases, so it's implemented behind a configuration flag whose default false value is deprecated. The flag itself can be deprecated in a future version of Rails. While loaded models will give the correct result for boolean columns without migrating old data, where() clauses will interact incorrectly with old data. While working in this area, also change the abstract adapter to use `"TRUE"` and `"FALSE"` as quoted values and `true` and `false` for unquoted. These are supported by PostreSQL, and MySQL remains overriden.
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-027-7/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-027-0/+7
|\ | | | | | | Enforce frozen string in Rubocop
| * Enforce frozen string in RubocopKir Shatrov2017-07-017-0/+7
| |
* | Make ActiveRecord frozen string literal friendly.Pat Allan2017-06-201-2/+2
|/
* Should escape meta characters in regexpRyuta Kamizono2017-05-072-4/+4
|
* Extract `bind_param` and `bind_attribute` into `ActiveRecord::TestCase`Ryuta Kamizono2017-05-041-5/+5
| | | | These are used in tests from anywhere.
* Merge pull request #28068 from kamipo/refactor_data_sourcesRafael França2017-03-131-4/+2
|\ | | | | Extract `data_source_sql` to refactor data source statements
| * Extract `data_source_sql` to refactor data source statementsRyuta Kamizono2017-02-201-4/+2
| |
* | `valid_type?` should accept only supported typesRyuta Kamizono2017-02-281-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `valid_type?` is used in schema dumper to determine if a type is supported. So if `valid_type?(:foobar)` is true, it means that schema dumper is allowed to create `t.foobar`. But it doesn't work. I think that `valid_type?` should accept only supported types. https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/schema_dumper.rb#L135-L142 ```ruby columns.each do |column| raise StandardError, "Unknown type '#{column.sql_type}' for column '#{column.name}'" unless @connection.valid_type?(column.type) next if column.name == pk type, colspec = @connection.column_spec(column) tbl.print " t.#{type} #{column.name.inspect}" tbl.print ", #{format_colspec(colspec)}" if colspec.present? tbl.puts end ```
* | Extract `TypeCastingTest` into `test/cases/quoting_test.rb`Ryuta Kamizono2017-02-241-51/+0
|/
* Add `Style/EmptyLinesAroundMethodBody` in `.rubocop.yml` and remove extra ↵Ryuta Kamizono2017-02-121-1/+0
| | | | empty lines
* Restore the behaviour of the compatibility layer for integer-like PKsRyuta Kamizono2017-02-041-59/+0
| | | | | | | | | | | | | | | | | | | | | The PR #27384 changed migration compatibility behaviour. ```ruby class CreateMasterData < ActiveRecord::Migration[5.0] def change create_table :master_data, id: :integer do |t| t.string :name end end end ``` Previously this migration created non-autoincremental primary key expected. But after the PR, the primary key changed to autoincremental, it is unexpected. This change restores the behaviour of the compatibility layer.
* :warning: "Use assert_nil if expecting nil. This will fail in MT6."Akira Matsuda2017-01-181-3/+4
| | | | | | These are followups for 307065f959f2b34bdad16487bae906eb3bfeaf28, but TBH I'm personally not very much confortable with this style. Maybe we could override assert_equal in our test_helper not to warn?
* Deprecate passing `name` to `indexes` like `tables`Ryuta Kamizono2017-01-041-1/+1
| | | | | Passing `name` to `tables` is already deprecated at #21601. Passing `name` to `indexes` is also unused.
* `#tables` and `#table_exists?` and returns only tables and not viewsRafael Mendonça França2016-12-291-7/+5
|
* Remove deprecated `name` argument from `#tables`Rafael Mendonça França2016-12-291-3/+1
|
* "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-251-1/+1
|
* Privatize unneededly protected methods in Active Record testsAkira Matsuda2016-12-241-1/+1
|
* Make pg adapter use bigserial for pk by defaultPavel Pravosud2016-12-051-0/+59
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
|
* Fix broken heredoc indentation caused by rubocop auto-correctRyuta Kamizono2016-09-031-3/+3
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But heredocs was still kept absolute position. This commit aligns heredocs indentation for consistency.
* Add three new rubocop rulesRafael Mendonça França2016-08-162-8/+8
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+1
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-12/+12
|
* modernizes hash syntax in activerecordXavier Noria2016-08-062-5/+5
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-067-133/+133
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fix explain logging with bindsRyuta Kamizono2016-07-201-2/+2
| | | | `binds` is an array of a query attribute since Active Record 5.0.
* 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
* 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> ```
* Deprecate `{insert|update|delete}_sql` in `DatabaseStatements`Ryuta Kamizono2016-03-021-15/+3
| | | | | Originally, `{insert|update|delete}_sql` is protected methods. We can use the `{insert|update|delete}` public methods instead.
* Remove unnecessary namespaces in `explain_test.rb`Ryuta Kamizono2016-02-291-19/+13
|
* Fix tests failure with `prepared_statements: false`Ryuta Kamizono2016-02-291-2/+2
| | | | | | 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`.
* Remove duplicated composite primary key testsRyuta Kamizono2016-02-011-8/+0
|
* :speak_no_evil: :warning:Akira Matsuda2016-02-011-1/+3
|
* `substitute_at` is no longer usedRyuta Kamizono2016-01-141-5/+0
| | | | Arel handles substitution for bind parameters by now.
* Fix test failure on WindowsSean Griffin2015-12-161-6/+10
| | | | | | | When this test was run on Windows, the database file would still be in use, and `File.unlink` would fail. This would cause the temp directory to be unable to be removed, and error out. By disconnecting the connection when finished, we can avoid this error.
* Deprecate `#table_exists?`, `#tables` and passing arguments to `#talbes`yui-knk2015-11-091-4/+8
| | | | | | | | | | Reported on #21509, how views is treated by `#tables` are differ by each adapters. To fix this different behavior, after Rails 5.0 is released, deprecate `#tables`. And `#table_exists?` would check both tables and views. To make their behavior consistent with `#tables`, after Rails 5.0 is released, deprecate `#table_exists?`.
* Remove `#tables` extra args againRyuta Kamizono2015-10-221-3/+2
| | | | | | This issue was resolved by #21687 already. But re-add args by #18856. `#tables` extra args was only using by `#table_exists?`. This is for internal API. This commit will remove these extra args again.
* Remove `@connection` in `StatementPool`Ryuta Kamizono2015-09-201-1/+1
| | | | | `@connection` in `StatementPool` is only used for PG adapter. No need for abstract `StatementPool` class.
* Removed mocha from Active Record Part 1Ronak Jangir2015-08-251-7/+10
|
* make it possible to run AR tests with bin/testYves Senn2015-06-117-8/+7
|
* Add collation support for string and text columns in SQLite3Akshay Vishnoi2015-05-282-4/+57
|
* Closes rails/rails#18864: Renaming transactional fixtures to transactional testsBrandon Weiss2015-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I’m renaming all instances of `use_transcational_fixtures` to `use_transactional_tests` and “transactional fixtures” to “transactional tests”. I’m deprecating `use_transactional_fixtures=`. So anyone who is explicitly setting this will get a warning telling them to use `use_transactional_tests=` instead. I’m maintaining backwards compatibility—both forms will work. `use_transactional_tests` will check to see if `use_transactional_fixtures` is set and use that, otherwise it will use itself. But because `use_transactional_tests` is a class attribute (created with `class_attribute`) this requires a little bit of hoop jumping. The writer method that `class_attribute` generates defines a new reader method that return the value being set. Which means we can’t set the default of `true` using `use_transactional_tests=` as was done previously because that won’t take into account anyone using `use_transactional_fixtures`. Instead I defined the reader method manually and it checks `use_transactional_fixtures`. If it was set then it should be used, otherwise it should return the default, which is `true`. If someone uses `use_transactional_tests=` then it will overwrite the backwards-compatible method with whatever they set.