diff options
author | Yoshiyuki Kinjo <yskkin@gmail.com> | 2018-08-15 12:03:40 +0900 |
---|---|---|
committer | Yoshiyuki Kinjo <yskkin@gmail.com> | 2018-08-15 12:32:44 +0900 |
commit | 6577d41266366e4ef116e18ba884358b8190fce7 (patch) | |
tree | e18006dbfbf2b44e7ebfeb3cbf42359c6baeba4c /activerecord/lib/active_record | |
parent | e715a64732f7b2f82aa809e59cfee83f892795f1 (diff) | |
download | rails-6577d41266366e4ef116e18ba884358b8190fce7.tar.gz rails-6577d41266366e4ef116e18ba884358b8190fce7.tar.bz2 rails-6577d41266366e4ef116e18ba884358b8190fce7.zip |
Fix bulk change table ignores comment option on PostgreSQL.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb index 26b8113b0d..00da7690a2 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb @@ -700,6 +700,11 @@ module ActiveRecord sql end + def add_column_for_alter(table_name, column_name, type, options = {}) + return super unless options.key?(:comment) + [super, Proc.new { change_column_comment(table_name, column_name, options[:comment]) }] + end + def change_column_for_alter(table_name, column_name, type, options = {}) sqls = [change_column_sql(table_name, column_name, type, options)] sqls << change_column_default_for_alter(table_name, column_name, options[:default]) if options.key?(:default) @@ -708,7 +713,6 @@ module ActiveRecord sqls end - # Changes the default value of a table column. def change_column_default_for_alter(table_name, column_name, default_or_changes) # :nodoc: column = column_for(table_name, column_name) |