Commit Graph

23 Commits

Author SHA1 Message Date
Kir Shatrov 831be98f9a Use frozen-string-literal in ActiveRecord 2017-07-19 22:27:07 +03:00
Matthew Draper 87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590, reversing
changes made to afb66a5a59.
2017-07-02 02:15:17 +09:30
Kir Shatrov cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Ryuta Kamizono 505526335b Correctly dump native timestamp types for MySQL
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)
```
2017-02-23 12:51:49 +09:00
Xavier Noria 9617db2078 applies new string literal convention in activerecord/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:26:53 +02:00
Ryuta Kamizono b8f86ae29f The BINARY Operator is only needed for string columns
Follow up to #13040.
2016-02-22 10:03:03 +09:00
Ryuta Kamizono 8e083e1502 Use `t.index` in `create_table` instead of `add_index` in test schema
For reduce bootstrap queries in tests.
2016-01-31 17:36:04 +09:00
Ryuta Kamizono d0054b4908 Fix `bigint?` for Enum columns in MySQL
Follow up to #22896.
2016-01-31 01:07:02 +09:00
Ryuta Kamizono 744552f72d Fix extract default with CURRENT_TIMESTUMP 2016-01-13 22:03:56 +09:00
Ryuta Kamizono 4d4239f980 Add short-hand methods for text and blob types in MySQL
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
2016-01-05 10:36:37 +09:00
Ryuta Kamizono 2f373dd916 Fix `unsigned?` and `blob_or_text_column?` for Enum columns in MySQL 2016-01-04 14:46:59 +09:00
Sean Griffin 72fba7db41 Merge pull request #21932 from kamipo/add_stored_procedure_test_in_mysql2
Add stored procedure test in mysql2
2015-10-20 14:02:23 -06:00
Ryuta Kamizono d39b6f77fc Add stored procedure test in mysql2 2015-10-15 13:18:21 +09:00
Ryuta Kamizono f8438ae336 Fix to correctly schema dump the `tinyblob`
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.
2015-10-15 05:38:43 +09:00
Ryuta Kamizono 0aa83f3b88 Add `:charset` and `:collation` options support for MySQL string and text columns
Example:

    create_table :foos do |t|
      t.string :string_utf8_bin, charset: 'utf8', collation: 'utf8_bin'
      t.text   :text_ascii,      charset: 'ascii'
    end
2015-03-06 18:56:19 +09:00
Yves Senn 3f4964299a tests, favor `drop_table` and `:if_exists` over raw SQL.
We've replaced most querues using DROP TABLE in our tests already.
This patch replaces the last couple calls.
2015-03-02 17:43:01 +01:00
masarakki eab657b267 fix detect column type of enum
enum includes text or blob or ... hooked by wrong regex
2013-04-01 17:09:20 +09:00
Ken Mazaika 9600e0b029 Add support for FULLTEXT and SPATIAL indexes using the :type flag for MySQL. 2013-03-27 23:35:54 -04:00
Victor Costan 5d30e44390 Use the MySQL varbinary type when appropriate in migrations. 2012-10-27 13:41:27 -04:00
Yamada Masaki f49800071f fix: limit of enum columns of mysql 2012-06-28 03:15:43 +09:00
kennyj fe7cacb510 Fix type_to_sql with text and limit on mysql/mysql2. Fix GH #3931. 2012-02-26 00:35:58 +09:00
Joseph Palermo c90e5ce779 Only use LOWER for mysql case insensitive uniqueness check when column has a case sensitive collation. 2011-10-09 13:14:07 -07:00
Brian Lopez 21e81da335 update tests for mysql2 support 2010-08-02 01:37:57 -07:00