mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
687 B
15 lines
687 B
class AddPartnershipIdToWebhookUrls < ActiveRecord::Migration[8.0]
|
|
def change
|
|
# Make account_id nullable since webhooks can now belong to either account or partnership
|
|
change_column_null :webhook_urls, :account_id, true
|
|
|
|
# Add partnership_id as optional reference
|
|
add_reference :webhook_urls, :partnership, null: true, foreign_key: true
|
|
|
|
# Add check constraint to ensure exactly one of account_id or partnership_id is set
|
|
add_check_constraint :webhook_urls,
|
|
'(account_id IS NOT NULL AND partnership_id IS NULL) OR (account_id IS NULL AND partnership_id IS NOT NULL)',
|
|
name: 'webhook_urls_owner_check'
|
|
end
|
|
end
|