Method: Gitlab::Database::MigrationHelpers#remove_column_default
- Defined in:
- lib/gitlab/database/migration_helpers.rb
#remove_column_default(table_name, column_name) ⇒ Object
While it is safe to call change_column_default on a column without default it would still require access exclusive lock on the table and for tables with high autovacuum(wraparound prevention) it will fail if their executions overlap.
924 925 926 927 928 929 930 |
# File 'lib/gitlab/database/migration_helpers.rb', line 924 def remove_column_default(table_name, column_name) column = connection.columns(table_name).find { |col| col.name == column_name.to_s } if column.default || column.default_function change_column_default(table_name, column_name, to: nil) end end |