You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raisePgHaMigrations::InvalidMigrationError,"Renaming an enum value is not supported on Postgres databases before version 10"
35
-
end
36
-
37
-
raw_execute("ALTER TYPE #{PG::Connection.quote_ident(name.to_s)} RENAME VALUE '#{PG::Connection.escape_string(old_value)}' TO '#{PG::Connection.escape_string(new_value)}'")
38
-
end
39
-
40
-
defsafe_add_column(table,column,type,options={})
32
+
defsafe_add_column(table,column,type, **options)
41
33
# Note: we don't believe we need to consider the odd case where
42
34
# `:default => nil` or `:default => -> { null }` (or similar) is
# Raises error if disable_default_migration_methods is true
75
-
# Otherwise, direct dispatch to underlying Rails method without dependent object check
92
+
# Otherwise, direct dispatch to underlying Rails method without dependent object check / locking
76
93
disable_or_delegate_default_method:add_check_constraint,":add_check_constraint is NOT SAFE! Use :safe_add_unvalidated_check_constraint and then :safe_validate_check_constraint instead"
77
94
disable_or_delegate_default_method:add_column,":add_column is NOT SAFE! Use safe_add_column instead"
78
95
disable_or_delegate_default_method:add_foreign_key,":add_foreign_key is NOT SAFE! Explicitly call :unsafe_add_foreign_key"
disable_or_delegate_default_method:rename_column,":rename_column is NOT SAFE! Explicitly call :unsafe_rename_column to proceed"
92
109
disable_or_delegate_default_method:rename_table,":rename_table is NOT SAFE! Explicitly call :unsafe_rename_table to proceed"
93
110
94
-
defunsafe_create_table(table,options={}, &block)
111
+
# Note that unsafe_* methods defined below do not run dependent object checks
112
+
113
+
defunsafe_change_table(*args, &block)
114
+
raisePgHaMigrations::UnsafeMigrationError.new(":change_table is too generic to even allow an unsafe variant. Instead use explicit methods for adding / removing / modifying columns.")
raisePgHaMigrations::InvalidMigrationError,"ActiveRecord drops the :opclass option when supplying a string containing an expression or list of columns; instead either supply an array of columns or include the opclass in the string for each column"
raisePgHaMigrations::InvalidMigrationError,"Renaming an enum value is not supported on Postgres databases before version 10"
163
+
end
164
+
165
+
raw_execute("ALTER TYPE #{PG::Connection.quote_ident(name.to_s)} RENAME VALUE '#{PG::Connection.escape_string(old_value)}' TO '#{PG::Connection.escape_string(new_value)}'")
166
+
end
167
+
168
+
defunsafe_make_column_not_nullable(table,column, **options)# options arg is only present for backwards compatiblity
169
+
safely_acquire_lock_for_table(table)do
170
+
raw_execute("ALTER TABLE #{table} ALTER COLUMN #{column} SET NOT NULL")# TODO: quoting
171
+
end
172
+
end
173
+
174
+
defunsafe_remove_constraint(table,name:)
175
+
raiseArgumentError,"Expected <name> to be present"unlessname.present?
0 commit comments