Files
mastodon/db/migrate/20260311212130_create_email_subscriptions.rb
2026-03-25 16:25:45 +00:00

18 lines
544 B
Ruby

# frozen_string_literal: true
class CreateEmailSubscriptions < ActiveRecord::Migration[8.1]
def change
create_table :email_subscriptions do |t|
t.references :account, null: false, foreign_key: { on_delete: :cascade }
t.string :email, null: false
t.string :locale, null: false
t.string :confirmation_token, index: { unique: true, where: 'confirmation_token is not null' }
t.datetime :confirmed_at
t.timestamps
end
add_index :email_subscriptions, [:account_id, :email], unique: true
end
end