aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
Commit message (Collapse)AuthorAgeFilesLines
* Allow `:precision` option for time type columnsRyuta Kamizono2015-02-121-7/+4
|
* The datetime precision with zero should be dumpedRyuta Kamizono2015-02-111-0/+6
| | | | | `precision: 0` was not dumped by f1a0fa9e19b7e4ccaea191fc6cf0613880222ee7. However, `precision: 0` is valid value for PostgreSQL timestamps.
* Refactor microsecond precision to be database agnosticSean Griffin2015-02-101-14/+9
| | | | | | | | | | The various databases don't actually need significantly different handling for this behavior, and they can achieve it without knowing about the type of the object. The old implementation was returning a string, which will cause problems such as breaking TZ aware attributes, and making it impossible for the adapters to supply their logic for time objects.
* Fix rounding problem for PostgreSQL timestamp columnRyuta Kamizono2015-02-081-12/+4
| | | | | If timestamp column have the precision, it need to format according to the precision of timestamp column.
* Add `auto_increment?` instead of `extra == 'auto_increment'`Ryuta Kamizono2015-02-081-2/+6
|
* Allow a symbol to be passed to `attribute`, in place of a type objectSean Griffin2015-02-061-0/+4
| | | | | | | | | | | | | | | | | | The same is not true of `define_attribute`, which is meant to be the low level no-magic API that sits underneath. The differences between the two APIs are: - `attribute` - Lazy (the attribute will be defined after the schema has loaded) - Allows either a type object or a symbol - `define_attribute` - Runs immediately (might get trampled by schema loading) - Requires a type object This was the last blocker in terms of public interface requirements originally discussed for this feature back in May. All the implementation blockers have been cleared, so this feature is probably ready for release (pending one more look-over by me).
* rm `Column#cast_type`Sean Griffin2015-02-031-19/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The type from the column is never used, except when being passed to the attributes API. While leaving the type on the column wasn't necessarily a bad thing, I worry that it's existence there implies that it is something which should be used. During the design and implementation process of the attributes API, there have been plenty of cases where getting the "right" type object was hard, but I had easy access to the column objects. For any contributor who isn't intimately familiar with the intents behind the type casting system, grabbing the type from the column might easily seem like the "correct" thing to do. As such, the goal of this change is to express that the column is not something that should be used for type casting. The only places that are "valid" (at the time of this commit) uses of acquiring a type object from the column are fixtures (as the YAML file is going to mirror the database more closely than the AR object), and looking up the type during schema detection to pass to the attributes API Many of the failing tests were removed, as they've been made obsolete over the last year. All of the PG column tests were testing nothing beyond polymorphism. The Mysql2 tests were duplicating the mysql tests, since they now share a column class. The implementation is a little hairy, and slightly verbose, but it felt preferable to going back to 20 constructor options for the columns. If you are git blaming to figure out wtf I was thinking with them, and have a better idea, go for it. Just don't use a type object for this.
* Add an `:if_exists` option to `drop_table`Stefan Kanev2015-01-191-1/+1
| | | | | | | | | | | If set to `if_exists: true`, it generates a statement like: DROP TABLE IF EXISTS posts This syntax is supported in the popular SQL servers, that is (at least) SQLite, PostgreSQL, MySQL, Oracle and MS SQL Sever. Closes #16366.
* Refactor `visit_ChangeColumnDefinition`Ryuta Kamizono2015-01-031-10/+8
| | | | `visit_ChangeColumnDefinition` is the same "CHANGE column_name " + `visit_ColumnDefinition(o)`.
* Add default value for `create_table_definition`Ryuta Kamizono2015-01-031-2/+2
| | | | | In most cases, `create_table_definition` called by table_name (the first argument) only.
* Merge pull request #17820 from fw42/restore_query_cache_on_rollbackRafael Mendonça França2015-01-021-1/+1
|\ | | | | | | Clear query cache on rollback
| * Restore query cache on rollbackFlorian Weingarten2014-12-011-1/+1
| |
* | Merge pull request #18228 from kamipo/correctly_dump_primary_keyRafael Mendonça França2015-01-021-0/+12
|\ \ | | | | | | | | | | | | | | | | | | Improve a dump of the primary key support. Conflicts: activerecord/CHANGELOG.md
| * | Improve a dump of the primary key support.Ryuta Kamizono2014-12-291-0/+12
| | | | | | | | | | | | If it is not a default primary key, correctly dump the type and options.
* | | Merge pull request #18067 from ↵Rafael Mendonça França2015-01-021-0/+28
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kamipo/format_datetime_string_according_to_precision Format the datetime string according to the precision of the datetime field. Conflicts: activerecord/CHANGELOG.md
| * | | Format the datetime string according to the precision of the datetime field.Ryuta Kamizono2015-01-021-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Incompatible to rounding behavior between MySQL 5.6 and earlier. In 5.5, when you insert `2014-08-17 12:30:00.999999` the fractional part is ignored. In 5.6, it's rounded to `2014-08-17 12:30:01`: http://bugs.mysql.com/bug.php?id=68760
| * | | Allow precision option for MySQL datetimes.Ryuta Kamizono2015-01-021-0/+12
|/ / /
* | | Extract the index length validation to a auxiliar methodRafael Mendonça França2014-12-301-3/+2
| | |
* | | Raise a better exception for renaming long indexes for mysql adaptersYasuo Honda2014-12-301-0/+3
|/ /
* | Add bigint primary key support for MySQL.Ryuta Kamizono2014-12-281-0/+11
| | | | | | | | | | | | | | Example: create_table :foos, id: :bigint do |t| end
* | `force: :cascade` to recreate tables referenced by foreign-keys.Yves Senn2014-12-191-1/+1
| |
* | Fix undesirable RangeError by Type::Integer. Add Type::UnsignedInteger.Ryuta Kamizono2014-12-121-5/+16
| |
* | Failure to rollback t.timestamps when within a change_table migrationnoam2014-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | When running the following migration: change_table(:table_name) { |t| t/timestamps } The following error was produced: wrong number of arguments (2 for 1) .... /connection_adapters/abstract/schema_statements.rb:851:in `remove_timestamps' This is due to `arguments` containing an empty hash as its second argument.
* | Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-2/+2
|/
* Mark comments that should not be in the docsclaudiob2014-11-241-0/+2
| | | | | | | | | | | Some comments that are meant to separate blocks of code in a file show up on http://api.rubyonrails.org as though they were part of the documentation. This commit hides those comments from the documentation. Stems from the discussion with @zzak at https://github.com/voloko/sdoc/issues/79#issuecomment-64158738 [ci skip]
* remove never called method `limited_update_conditions`Andrey Deryabin2014-11-111-4/+0
|
* Revert the behavior of booleans in string columns to that of 4.1Sean Griffin2014-11-091-1/+23
| | | | | | | | | | | | | | | | | | | | | Why are people assigning booleans to string columns? >_> We unintentionally changed the behavior on Sqlite3 and PostgreSQL. Boolean values should cast to the database's representation of true and false. This is 't' and 'f' by default, and "1" and "0" on Mysql. The implementation to make the connection adapter specific behavior is hacky at best, and should be re-visted once we decide how we actually want to separate the concerns related to things that should change based on the database adapter. That said, this isn't something I'd expect to change based on my database adapter. We're storing a string, so the way the database represents a boolean should be irrelevant. It also seems strange for us to give booleans special behavior at all in string columns. Why is `to_s` not sufficient? It's inconsistent and confusing. Perhaps we should consider deprecating in the future. Fixes #17571
* - Remove unused duplicated method `add_column_position` from ↵Vipul A M2014-11-011-8/+0
| | | | AbstractMysqlAdapter
* Remove redundant `to_s` in interpolationclaudiob2014-10-291-2/+2
|
* Merge pull request #17411 from ↵Rafael Mendonça França2014-10-291-1/+1
|\ | | | | | | | | mcfiredrill/doc-change-column-default-abstract-mysql-adapter document change_column and change_column_default for abstract_mysql_adapter [ci skip]
| * :nodoc: for abstract_mysql_adapterTony Miller2014-10-291-1/+1
| |
* | fix MySQL enum type lookup with values matching another type. Closes #17402.Yves Senn2014-10-291-6/+6
| | | | | | | | | | | | | | | | | | | | The MySQLAdapter type map used the lowest priority for enum types. This was the result of a recent refactoring and lead to some broken lookups for enums with values that match other types. Like `8bit`. This patch restores the priority to what we had before the refactoring. /cc @sgrif
* | Add mysql and pg specific attributes to Column#== and hashSean Griffin2014-10-281-0/+11
|/
* add a truncate method to the connectionAaron Patterson2014-09-221-0/+4
| | | | | | it doesn't work on SQLite3 since it doesn't support truncate, but that's OK. If you call truncate on the connection, you're now bound to that database (same as if you use hstore or any other db specific feature).
* MySQL: schema.rb now includes TEXT and BLOB column limits.Jeremy Kemper2014-09-101-4/+7
|
* MySQL: correct LONGTEXT and LONGBLOB limits from 2GB to their true 4GBJeremy Kemper2014-09-101-2/+2
|
* introduce `connection.supports_views?` and basic view tests.Yves Senn2014-09-091-4/+4
| | | | | | | `AbstractAdapter#supports_views?` defaults to `false` so we have to turn it on in adapter subclasses. Currently the flag only controls test execution. /cc @yahonda
* Freeze ADAPTER_NAME in adaptersAbdelkader Boudih2014-09-051-4/+0
|
* Add and Remove string/strip requireArthur Neves2014-09-021-0/+1
| | | | | | | Method .strip_heredoc is defined in active_support/core_ext/string/strip.rb so we need to require it. [fixes #16677]
* MySQL: set connection collation along with the charsetJeremy Kemper2014-08-301-1/+5
| | | | | | | | | | Sets the connection collation to the database collation configured in database.yml. Otherwise, `SET NAMES utf8mb4` will use the default collation for that charset (utf8mb4_general_ci) when you may have chosen a different collation, like utf8mb4_unicode_ci. This only applies to literal string comparisons, not column values, so it is unlikely to affect you.
* Change the default `null` value for timestampsSean Griffin2014-08-121-2/+2
| | | | | | | As per discussion, this changes the model generators to specify `null: false` for timestamp columns. A warning is now emitted if `timestamps` is called without a `null` option specified, so we can safely change the behavior when no option is specified in Rails 5.
* Predicate methods don't need to return `true` / `false`Rafael Mendonça França2014-07-151-1/+1
|
* Fix version detection for RENAME INDEX support. Fixes #15931.Jeff Browning2014-07-151-1/+13
|
* If our connection is explicitly non-strict, tell MySQLMatthew Draper2014-07-061-2/+2
| | | | | | | | | | We default to making the connection strict, but have historically relied on the MySQL default when we want it to be non-strict. On some (recent?) versions of MySQL, new connections default to being strict, so if we've been told 'strict:false', we're obliged to pass that on. This fixes a test failure that we've seen turn up on relatively-new development machines, so we do already have a test covering it.
* Change method visibilityRafael Mendonça França2014-06-261-2/+2
|
* fk: review corrections: indent, visibility, syntax, wording.Yves Senn2014-06-261-11/+11
|
* fk: support for on_updateYves Senn2014-06-261-6/+11
|
* fk: rename `dependent` to `on_delete`Yves Senn2014-06-261-2/+2
|
* fk: support dependent option (:delete, :nullify and :restrict).Yves Senn2014-06-261-1/+13
|
* fk: generalize using `AlterTable` and `SchemaCreation`.Yves Senn2014-06-261-20/+4
|