Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Use squiggly heredoc to strip odd indentation in the executed SQL | Ryuta Kamizono | 2018-11-22 | 1 | -25/+17 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ``` LOG: execute <unnamed>: SELECT t.oid, t.typname FROM pg_type as t WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'bool') LOG: execute <unnamed>: SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype FROM pg_type as t LEFT JOIN pg_range as r ON oid = rngtypid WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'text', 'varchar', 'char', 'name', 'bpchar', 'bool', 'bit', 'varbit', 'timestamptz', 'date', 'money', 'bytea', 'point', 'hstore', 'json', 'jsonb', 'cidr', 'inet', 'uuid', 'xml', 'tsvector', 'macaddr', 'citext', 'ltree', 'interval', 'path', 'line', 'polygon', 'circle', 'lseg', 'box', 'time', 'timestamp', 'numeric') OR t.typtype IN ('r', 'e', 'd') OR t.typinput::varchar = 'array_in' OR t.typelem != 0 LOG: statement: SHOW TIME ZONE LOG: statement: SELECT 1 LOG: execute <unnamed>: SELECT COUNT(*) FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('r','v','m') -- (r)elation/table, (v)iew, (m)aterialized view AND c.relname = 'accounts' AND n.nspname = ANY (current_schemas(false)) ``` After: ``` LOG: execute <unnamed>: SELECT t.oid, t.typname FROM pg_type as t WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'bool') LOG: execute <unnamed>: SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype FROM pg_type as t LEFT JOIN pg_range as r ON oid = rngtypid WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'text', 'varchar', 'char', 'name', 'bpchar', 'bool', 'bit', 'varbit', 'timestamptz', 'date', 'money', 'bytea', 'point', 'hstore', 'json', 'jsonb', 'cidr', 'inet', 'uuid', 'xml', 'tsvector', 'macaddr', 'citext', 'ltree', 'interval', 'path', 'line', 'polygon', 'circle', 'lseg', 'box', 'time', 'timestamp', 'numeric') OR t.typtype IN ('r', 'e', 'd') OR t.typinput::varchar = 'array_in' OR t.typelem != 0 LOG: statement: SHOW TIME ZONE LOG: statement: SELECT 1 LOG: execute <unnamed>: SELECT COUNT(*) FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('r','v','m') -- (r)elation/table, (v)iew, (m)aterialized view AND c.relname = 'accounts' AND n.nspname = ANY (current_schemas(false)) ``` | ||||
* | Support default expression for MySQL | Ryuta Kamizono | 2018-10-25 | 1 | -0/+3 |
| | | | | | | | MySQL 8.0.13 and higher supports default value to be a function or expression. https://dev.mysql.com/doc/refman/8.0/en/create-table.html | ||||
* | Use utf8mb4 in all tests and examples | Ryuta Kamizono | 2018-09-21 | 1 | -2/+2 |
| | | | | | Since #33875, Rails dropped supporting MySQL 5.1 which does not support utf8mb4. We no longer need to use legacy utf8 (utf8mb3) conservatively. | ||||
* | Use utf8mb4 character set by default for MySQL database (#33608) | Yasuo Honda | 2018-09-11 | 1 | -1/+1 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use utf8mb4 character set by default `utf8mb4` character set supports supplementary characters including emoji. `utf8` character set with 3-Byte encoding is not enough to support them. There was a downside of 4-Byte length character set with MySQL 5.5 and 5.6: "ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes" for Rails string data type which is mapped to varchar(255) type. MySQL 5.7 supports 3072 byte key prefix length by default. * Remove `DEFAULT COLLATE` from Active Record unit test databases There should be no "one size fits all" collation in MySQL 5.7. Let MySQL server choose the default collation for Active Record unit test databases. Users can choose their best collation for their databases by setting `options[:collation]` based on their requirements. * InnoDB FULLTEXT indexes support since MySQL 5.6 it does not have to use MyISAM storage engine whose maximum key length is 1000 bytes. Using MyISAM storag engine with utf8mb4 character set would cause "Specified key was too long; max key length is 1000 bytes" https://dev.mysql.com/doc/refman/5.6/en/innodb-fulltext-index.html * References "10.9.1 The utf8mb4 Character Set (4-Byte UTF-8 Unicode Encoding)" https://dev.mysql.com/doc/refman/5.7/en/charset-unicode-utf8mb4.html "10.9.2 The utf8mb3 Character Set (3-Byte UTF-8 Unicode Encoding)" https://dev.mysql.com/doc/refman/5.7/en/charset-unicode-utf8.html "14.8.1.7 Limits on InnoDB Tables" https://dev.mysql.com/doc/refman/5.7/en/innodb-restrictions.html > If innodb_large_prefix is enabled (the default), the index key prefix limit is 3072 bytes > for InnoDB tables that use DYNAMIC or COMPRESSED row format. * CI against MySQL 5.7 Followed this instruction and changed root password to empty string. https://docs.travis-ci.com/user/database-setup/#MySQL-57 * The recommended minimum version of MySQL is 5.7.9 to support utf8mb4 character set and `innodb_default_row_format` MySQL 5.7.9 introduces `innodb_default_row_format` to support 3072 byte length index by default. Users do not have to change MySQL database configuration to support Rails string type. https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_default_row_format https://dev.mysql.com/doc/refman/5.7/en/innodb-restrictions.html > If innodb_large_prefix is enabled (the default), > the index key prefix limit is 3072 bytes for InnoDB tables that use DYNAMIC or COMPRESSED row format. * The recommended minimum version of MariaDB is 10.2.2 MariaDB 10.2.2 is the first version of MariaDB supporting `innodb_default_row_format` Also MariaDB says "MySQL 5.7 is compatible with MariaDB 10.2". - innodb_default_row_format https://mariadb.com/kb/en/library/xtradbinnodb-server-system-variables/#innodb_default_row_format - "MariaDB versus MySQL - Compatibility" https://mariadb.com/kb/en/library/mariadb-vs-mysql-compatibility/ > MySQL 5.7 is compatible with MariaDB 10.2 - "Supported Character Sets and Collations" https://mariadb.com/kb/en/library/supported-character-sets-and-collations/ | ||||
* | add mysql and sqlite3 default test | kenjiszk | 2018-09-01 | 1 | -0/+7 |
| | | | | [Gannon McGibbon + Kenji Suzuki] | ||||
* | Enable `Layout/EmptyLinesAroundBlockBody` to reduce review cost in the future | Ryuta Kamizono | 2018-07-12 | 1 | -1/+0 |
| | | | | | | | We sometimes ask "✂️ extra blank lines" to a contributor in reviews like https://github.com/rails/rails/pull/33337#discussion_r201509738. It is preferable to deal automatically without depending on manpower. | ||||
* | Subsecond precision is not supported until MySQL 5.6.4 | Ryuta Kamizono | 2018-07-09 | 1 | -6/+6 |
| | |||||
* | Fix default value for mysql time types with specified precision | Nikolay Kondratyev | 2018-07-04 | 1 | -0/+2 |
| | | | | | | | | | | | | | | | | The TIME, DATETIME, and TIMESTAMP types [have supported](https://mariadb.com/kb/en/library/microseconds-in-mariadb/) a fractional seconds precision from 0 to 6. Default values from time columns with specified precision is read as `current_timestamp(n)` from information schema. rake `db:schema:dump` produces `schema.rb` **without** default values for time columns with the specified precision: t.datetime "last_message_at", precision: 6, null: false rake `db:schema:dump` produces `schema.rb` **with** default values for time columns with the specified precision: t.datetime "last_message_at", precision: 6, default: -> { "current_timestamp(6)" }, null: false | ||||
* | Use frozen-string-literal in ActiveRecord | Kir Shatrov | 2017-07-19 | 1 | -0/+2 |
| | |||||
* | Revert "Merge pull request #29540 from kirs/rubocop-frozen-string" | Matthew Draper | 2017-07-02 | 1 | -1/+0 |
| | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa. | ||||
* | Enforce frozen string in Rubocop | Kir Shatrov | 2017-07-01 | 1 | -0/+1 |
| | |||||
* | Correctly dump native timestamp types for MySQL | Ryuta Kamizono | 2017-02-23 | 1 | -0/+5 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The native timestamp type in MySQL is different from datetime type. Internal representation of the timestamp type is UNIX time, This means that timestamp columns are affected by time zone. ``` > SET time_zone = '+00:00'; Query OK, 0 rows affected (0.00 sec) > INSERT INTO time_with_zone(ts,dt) VALUES (NOW(),NOW()); Query OK, 1 row affected (0.02 sec) > SELECT * FROM time_with_zone; +---------------------+---------------------+ | ts | dt | +---------------------+---------------------+ | 2016-02-07 22:11:44 | 2016-02-07 22:11:44 | +---------------------+---------------------+ 1 row in set (0.00 sec) > SET time_zone = '-08:00'; Query OK, 0 rows affected (0.00 sec) > SELECT * FROM time_with_zone; +---------------------+---------------------+ | ts | dt | +---------------------+---------------------+ | 2016-02-07 14:11:44 | 2016-02-07 22:11:44 | +---------------------+---------------------+ 1 row in set (0.00 sec) ``` | ||||
* | applies new string literal convention in activerecord/test | Xavier Noria | 2016-08-06 | 1 | -8/+8 |
| | | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default. | ||||
* | The BINARY Operator is only needed for string columns | Ryuta Kamizono | 2016-02-22 | 1 | -0/+1 |
| | | | | Follow up to #13040. | ||||
* | Use `t.index` in `create_table` instead of `add_index` in test schema | Ryuta Kamizono | 2016-01-31 | 1 | -5/+4 |
| | | | | For reduce bootstrap queries in tests. | ||||
* | Fix `bigint?` for Enum columns in MySQL | Ryuta Kamizono | 2016-01-31 | 1 | -1/+1 |
| | | | | Follow up to #22896. | ||||
* | Fix extract default with CURRENT_TIMESTUMP | Ryuta Kamizono | 2016-01-13 | 1 | -0/+7 |
| | |||||
* | Add short-hand methods for text and blob types in MySQL | Ryuta Kamizono | 2016-01-05 | 1 | -10/+10 |
| | | | | | | | | | | | | | | | | | In Pg and Sqlite3, `:text` and `:binary` have variable unlimited length. But in MySQL, these have limited length for each types (ref #21591, #21619). This change adds short-hand methods for each text and blob types. Example: create_table :foos do |t| t.tinyblob :tiny_blob t.mediumblob :medium_blob t.longblob :long_blob t.tinytext :tiny_text t.mediumtext :medium_text t.longtext :long_text end | ||||
* | Fix `unsigned?` and `blob_or_text_column?` for Enum columns in MySQL | Ryuta Kamizono | 2016-01-04 | 1 | -1/+1 |
| | |||||
* | Merge pull request #21932 from kamipo/add_stored_procedure_test_in_mysql2 | Sean Griffin | 2015-10-20 | 1 | -0/+11 |
|\ | | | | | Add stored procedure test in mysql2 | ||||
| * | Add stored procedure test in mysql2 | Ryuta Kamizono | 2015-10-15 | 1 | -0/+11 |
| | | |||||
* | | Fix to correctly schema dump the `tinyblob` | Ryuta Kamizono | 2015-10-15 | 1 | -1/+1 |
|/ | | | | | | Currently `tinyblob` is dumped to `t.binary "tiny_blob", limit: 255`. But `t.binary ... limit: 255` is generating SQL to `varchar(255)`. It is incorrect. This commit fixes this problem. | ||||
* | Add `:charset` and `:collation` options support for MySQL string and text ↵ | Ryuta Kamizono | 2015-03-06 | 1 | -9/+5 |
| | | | | | | | | | | | columns Example: create_table :foos do |t| t.string :string_utf8_bin, charset: 'utf8', collation: 'utf8_bin' t.text :text_ascii, charset: 'ascii' end | ||||
* | tests, favor `drop_table` and `:if_exists` over raw SQL. | Yves Senn | 2015-03-02 | 1 | -6/+2 |
| | | | | | We've replaced most querues using DROP TABLE in our tests already. This patch replaces the last couple calls. | ||||
* | fix detect column type of enum | masarakki | 2013-04-01 | 1 | -1/+1 |
| | | | | enum includes text or blob or ... hooked by wrong regex | ||||
* | Add support for FULLTEXT and SPATIAL indexes using the :type flag for MySQL. | Ken Mazaika | 2013-03-27 | 1 | -0/+10 |
| | |||||
* | Use the MySQL varbinary type when appropriate in migrations. | Victor Costan | 2012-10-27 | 1 | -9/+13 |
| | |||||
* | fix: limit of enum columns of mysql | Yamada Masaki | 2012-06-28 | 1 | -0/+9 |
| | |||||
* | Fix type_to_sql with text and limit on mysql/mysql2. Fix GH #3931. | kennyj | 2012-02-26 | 1 | -2/+2 |
| | |||||
* | Only use LOWER for mysql case insensitive uniqueness check when column has a ↵ | Joseph Palermo | 2011-10-09 | 1 | -1/+12 |
| | | | | case sensitive collation. | ||||
* | update tests for mysql2 support | Brian Lopez | 2010-08-02 | 1 | -0/+24 |