mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Revert "Allow specifying the default table options for mysql adapters"
This reverts commit 8246b593bf
.
There was concern about this modifying the behavior of past migrations.
We're going to add an way to modify the migration generator instead.
This commit is contained in:
parent
8246b593bf
commit
6b7861e834
3 changed files with 1 additions and 26 deletions
|
@ -1,8 +1,3 @@
|
|||
* Allow specifying the default options for new tables on mysql and mysql2 in
|
||||
database.yml, via the key `default_table_options`.
|
||||
|
||||
*Sean Griffin*
|
||||
|
||||
* Except keys of `build_record`'s argument from `create_scope` in `initialize_attributes`.
|
||||
|
||||
Fixes #21893.
|
||||
|
|
|
@ -597,8 +597,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def create_table(table_name, options = {}) #:nodoc:
|
||||
default_table_options = @config.fetch(:default_table_options, "ENGINE=InnoDB")
|
||||
super(table_name, options.reverse_merge(options: default_table_options))
|
||||
super(table_name, options.reverse_merge(:options => "ENGINE=InnoDB"))
|
||||
end
|
||||
|
||||
def bulk_change_table(table_name, operations) #:nodoc:
|
||||
|
|
|
@ -1020,23 +1020,4 @@ class CopyMigrationsTest < ActiveRecord::TestCase
|
|||
ActiveRecord::Base.logger = old
|
||||
end
|
||||
|
||||
if current_adapter?(:Mysql2Adapter)
|
||||
def test_default_table_options
|
||||
config = ActiveRecord::Base.configurations['arunit'].merge(
|
||||
encoding: 'utf8mb4',
|
||||
default_table_options: "ENGINE=InnoDB CHARACTER SET utf8mb4",
|
||||
)
|
||||
ActiveRecord::Base.establish_connection(config)
|
||||
|
||||
ActiveRecord::Base.connection.create_table(:foos) do |t|
|
||||
t.string :emoji
|
||||
end
|
||||
ActiveRecord::Base.connection.execute("INSERT INTO foos (emoji) VALUES ('💩')")
|
||||
emoji = ActiveRecord::Base.connection.execute("SELECT emoji FROM foos").first.first
|
||||
assert_equal "💩", emoji
|
||||
ensure
|
||||
ActiveRecord::Base.connection.drop_table(:foos, if_exists: true)
|
||||
ActiveRecord::Base.establish_connection(:arunit)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue