Merge branch 'main' into glitch-soc/merge-upstream
This commit is contained in:
@ -2,7 +2,7 @@ class CreateCanonicalEmailBlocks < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :canonical_email_blocks do |t|
|
||||
t.string :canonical_email_hash, null: false, default: '', index: { unique: true }
|
||||
t.belongs_to :reference_account, null: false, foreign_key: { on_cascade: :delete, to_table: 'accounts' }
|
||||
t.belongs_to :reference_account, null: false, foreign_key: { to_table: 'accounts' }
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
@ -0,0 +1,13 @@
|
||||
class FixCanonicalEmailBlocksForeignKey < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
safety_assured do
|
||||
execute 'ALTER TABLE canonical_email_blocks DROP CONSTRAINT fk_rails_1ecb262096, ADD CONSTRAINT fk_rails_1ecb262096 FOREIGN KEY (reference_account_id) REFERENCES accounts(id) ON DELETE CASCADE;'
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured do
|
||||
execute 'ALTER TABLE canonical_email_blocks DROP CONSTRAINT fk_rails_1ecb262096, ADD CONSTRAINT fk_rails_1ecb262096 FOREIGN KEY (reference_account_id) REFERENCES accounts(id);'
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user