aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Merge pull request #23497 from kamipo/extract_schema_qualified_nameJeremy Daer2016-04-191-8/+15
|\ \ \ | | | | | | | | | | | | Extract `extract_schema_qualified_name` method
| * | | Extract `extract_schema_qualified_name` methodRyuta Kamizono2016-02-051-8/+15
| | | |
* | | | Merge pull request #23515 from kamipo/extract_arel_visitorJeremy Daer2016-04-194-28/+12
|\ \ \ \ | | | | | | | | | | | | | | | Extract `arel_visitor` and move up to the abstract adapter
| * | | | Extract `arel_visitor` and move up to the abstract adapterRyuta Kamizono2016-04-044-28/+12
| | | | |
* | | | | Merge pull request #23522 from kamipo/add_value_too_long_exception_classJeremy Daer2016-04-182-0/+5
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Add `ActiveRecord::ValueTooLong` exception class
| * | | | | Add `ActiveRecord::ValueTooLong` exception classRyuta Kamizono2016-02-062-0/+5
| | |/ / / | |/| | |
* | | | | `foreign_key` respects `table_name_prefix` and `table_name_suffix`Ryuta Kamizono2016-04-191-0/+3
| | | | |
* | | | | Merge pull request #23622 from kamipo/primary_key_should_be_not_nullJeremy Daer2016-04-184-3/+10
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Primary key should be `NOT NULL`
| * | | | | Primary key should be `NOT NULL`Ryuta Kamizono2016-03-124-3/+10
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow up to #18228. In MySQL and PostgreSQL, primary key is to be `NOT NULL` implicitly. But in SQLite it must be specified `NOT NULL` explicitly.
* | | | | Database comments: switch to keyword args for new table optionsJeremy Daer2016-04-189-64/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Switch to keyword args where we can without breaking compat. * Use add_table_options! for :options, too. * Some code polish.
* | | | | Merge pull request #22911 from Envek/database_commentsJeremy Daer2016-04-1611-37/+166
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Add support for specifying comments for tables, columns, and indexes in database itself
| * | | | | Add support for specifying comments for tables, columns, and indexes.Andrey Novikov2016-04-1611-37/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Comments are specified in migrations, stored in database itself (in its schema), and dumped into db/schema.rb file. This allows to generate good documentation and explain columns and tables' purpose to everyone from new developers to database administrators. For PostgreSQL and MySQL only. SQLite does not support comments at the moment. See docs for PostgreSQL: http://www.postgresql.org/docs/current/static/sql-comment.html See docs for MySQL: http://dev.mysql.com/doc/refman/5.7/en/create-table.html
* | | | | | documentation for add_references index option [ci skip]Vipul A M2016-04-171-1/+10
|\ \ \ \ \ \ | |/ / / / / |/| | | | | documentation for add_references index option [ci skip]
| * | | | | [ci skip] docs for add_references index optionAlex Handley2016-04-161-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add link for finding the addional options for index. - Add example for unique index as this is a common requirement. - Add link in guide for index options.
* | | | | | Should keep quoting behaivor of a time column value in sqlite3 adapterRyuta Kamizono2016-04-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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> ```
* | | | | | Add `quoted_time` for truncating the date part of a time column valueRyuta Kamizono2016-04-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Context #24522. TIME column on MariaDB doesn't ignore the date part of the string when it coerces to time. ``` root@localhost [test] > CREATE TABLE `foos` (`id` int AUTO_INCREMENT PRIMARY KEY, `start` time(0), `finish` time(4)) ENGINE=InnoDB; Query OK, 0 rows affected (0.02 sec) root@localhost [test] > INSERT INTO `foos` (`start`, `finish`) VALUES ('2000-01-01 12:30:00', '2000-01-01 12:30:00.999900'); Query OK, 1 row affected, 2 warnings (0.00 sec) Note (Code 1265): Data truncated for column 'start' at row 1 Note (Code 1265): Data truncated for column 'finish' at row 1 root@localhost [test] > SELECT `foos`.* FROM `foos`; +----+----------+---------------+ | id | start | finish | +----+----------+---------------+ | 1 | 12:30:00 | 12:30:00.9999 | +----+----------+---------------+ 1 row in set (0.00 sec) root@localhost [test] > SELECT `foos`.* FROM `foos` WHERE `foos`.`start` = '2000-01-01 12:30:00' LIMIT 1; Empty set (0.00 sec) root@localhost [test] > SELECT `foos`.* FROM `foos` WHERE `foos`.`start` = '12:30:00' LIMIT 1; +----+----------+---------------+ | id | start | finish | +----+----------+---------------+ | 1 | 12:30:00 | 12:30:00.9999 | +----+----------+---------------+ 1 row in set (0.00 sec) ```
* | | | | | Merge pull request #24522 from vipulnsward/run-mariadb-on-travisJeremy Daer2016-04-131-4/+4
|\ \ \ \ \ \ | | | | | | | | | | | | | | Test against MariaDB 10.0
| * | | | | | Include running mariadb on travisVipul A M2016-04-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Specify we want to run on latest stable ruby for mariadb - change in runs of builds Make mariadb? method publicly available
* | | | | | | :nodoc: version method.Vipul A M2016-04-131-1/+1
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reason: - Its not publicly used method. - Exposing it makes an assumption that other adapters support it based on its usage - ActiveRecord::Base.connection.version [ci skip]
* / / / / / Pass over all Rails 5 warnings, to make sure:Vipul A M2016-04-121-2/+2
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - we are ending sentences properly - fixing of space issues - fixed continuity issues in some sentences. Reverts https://github.com/rails/rails/commit/8fc97d198ef31c1d7a4b9b849b96fc08a667fb02 . This change reverts making sure we add '.' at end of deprecation sentences. This is to keep sentences within Rails itself consistent and with a '.' at the end.
* | | | | Support microsecond datetime precision on MariaDB 5.3+.Jeremy Daer2016-04-081-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Merge pull request #24078 from kamipo/show_variablesRafael França2016-04-061-2/+1
|\ \ \ \ \ | | | | | | | | | | | | Simply use `select_value` in `show_variable`
| * | | | | Simply use `select_value` in `show_variable`Ryuta Kamizono2016-03-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `SELECT @@name` statement returns only single row or `StatementInvalid`. ``` root@localhost [activerecord_unittest] > SELECT @@version; +-----------+ | @@version | +-----------+ | 5.7.9-log | +-----------+ 1 row in set (0.00 sec) root@localhost [activerecord_unittest] > SELECT @@unknown_variable; ERROR 1193 (HY000): Unknown system variable 'missing_variable' ```
* | | | | | Merge pull request #24374 from kamipo/move_quoting_methods_to_quoting_moduleRafael França2016-04-064-44/+38
|\ \ \ \ \ \ | | | | | | | | | | | | | | Move quoting methods to `Quoting` module
| * | | | | | Make `QUOTED_TRUE` and `QUOTED_FALSE` to public because these are used in ↵Ryuta Kamizono2016-04-062-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `MysqlString`
| * | | | | | Move `quoted_date`, `quote_string` and `quote_table_name_for_assignment` ↵Ryuta Kamizono2016-04-054-22/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | methods to `Quoting` module
| * | | | | | Make to private `QUOTED_TRUE` and `QUOTED_FALSE` constantsRyuta Kamizono2016-04-052-18/+18
| | | | | | |
* | | | | | | Remove hard-coded backticks in SQL statementsHarsimran Singh Maan2016-04-051-3/+3
|/ / / / / / | | | | | | | | | | | | The hard-coded back-ticks made it hard to use a different char for quoting db fields. This checkin replaces it with quote_table_name.
* | | | / / Use `QUOTED_TRUE` and `QUOTED_FALSE` instead of magic stringsyui-knk2016-04-051-4/+4
| |_|_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Move `@quoted_{column|table}_names` cache up to the abstract adapterRyuta Kamizono2016-03-317-19/+20
| |_|_|/ |/| | |
* | | | Merge pull request #24368 from kamipo/make_to_private_the_visibilitySean Griffin2016-03-304-32/+54
|\ \ \ \ | | | | | | | | | | Make to private the visibility of `_quote` and `_type_cast`
| * | | | Make to private the visibility of `_quote` and `_type_cast`Ryuta Kamizono2016-03-304-32/+54
| | | | |
* | | | | Add a test case for create a record with primary key as zeroRyuta Kamizono2016-03-301-0/+1
|/ / / /
* | | | Fix description for method ↵Bogdan2016-03-271-2/+2
| | | | | | | | | | | | | | | | ActiveRecord::ConnectionAdapters::SchemaStatements#add_timestamps [ci skip]
* | | | Append sql_mode instead of overwriting in strict modeRyuta Kamizono2016-03-131-3/+12
| |/ / |/| | | | | | | | For keep the default SQL mode.
* | | Merge pull request #23797 from ↵Rafael França2016-03-111-3/+3
|\ \ \ | | | | | | | | | | | | | | | | 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-3/+3
| | | | | | | | | | | | | | | | Follow up to #13040.
* | | | Merge pull request #24054 from kamipo/extract_default_primary_keyRafael França2016-03-113-19/+19
|\ \ \ \ | | | | | | | | | | Extract `default_primary_key?` to refactor `column_spec_for_primary_key`
| * | | | Extract `default_primary_key?` to refactor `column_spec_for_primary_key`Ryuta Kamizono2016-03-113-19/+19
| | | | |
* | | | | Merge pull request #24087 from kamipo/dump_bigint_instead_of_integer_limit_8Rafael França2016-03-112-6/+6
|\ \ \ \ \ | | | | | | | | | | | | Dump `bigint` instead of `integer` with `limit: 8` for schema dumper
| * | | | | Dump `bigint` instead of `integer` with `limit: 8` for schema dumperRyuta Kamizono2016-03-112-6/+6
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-117-25/+31
|\ \ \ \ \ | |/ / / / |/| | | | Passing `table_name` to `Column#initialize` to avoid `instance_variable_set`
| * | | | Passing `table_name` to `Column#initialize` to avoid `instance_variable_set`Ryuta Kamizono2016-03-085-17/+11
| | | | |
| * | | | Initialize `column.table_name` immediately for `column.serial?` correctly ↵Ryuta Kamizono2016-03-086-17/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+4
|\ \ \ \ \ | | | | | | | | | | | | Fix bigserial appears with limit 8 for schema dumper
| * | | | | Fix bigserial appears with limit 8 for schema dumperRyuta Kamizono2016-03-041-0/+4
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* | | | | Fixed comments of add_foreign_key methodSalman Afzal Siddiqui2016-03-101-2/+2
| | | | | | | | | | | | | | | The comments of add_foreign_key method was displaying incorrect constraint name.
* | | | | use same name to type objectyuuji.yaginuma2016-03-091-1/+1
| |/ / / |/| | | | | | | | | | | Follow up to #24079
* | | | Merge pull request #24034 from kamipo/remove_outdated_commentArthur Nogueira Neves2016-03-071-1/+0
|\ \ \ \ | | | | | | | | | | Remove outdated comment [ci skip]
| * | | | Remove outdated comment [ci skip]Ryuta Kamizono2016-03-041-1/+0
| |/ / / | | | | | | | | | | | | Currently column options handled by the type map in Rails 4.2.