diff options
-rw-r--r-- | app/models/destructing_status.rb | 2 | ||||
-rw-r--r-- | db/migrate/20200801220000_add_accounts_to_destructing_statuses.rb | 9 | ||||
-rw-r--r-- | db/schema.rb | 5 |
3 files changed, 15 insertions, 1 deletions
diff --git a/app/models/destructing_status.rb b/app/models/destructing_status.rb index 70bfc28d2..79f17e67d 100644 --- a/app/models/destructing_status.rb +++ b/app/models/destructing_status.rb @@ -6,10 +6,12 @@ # status_id :bigint(8) not null # after :datetime not null # defederate_only :boolean default(FALSE), not null +# account_id :bigint(8) not null # class DestructingStatus < ApplicationRecord belongs_to :status, inverse_of: :destruct + belongs_to :account, inverse_of: :destructing_statuses validates :status_id, uniqueness: true end diff --git a/db/migrate/20200801220000_add_accounts_to_destructing_statuses.rb b/db/migrate/20200801220000_add_accounts_to_destructing_statuses.rb new file mode 100644 index 000000000..42298b274 --- /dev/null +++ b/db/migrate/20200801220000_add_accounts_to_destructing_statuses.rb @@ -0,0 +1,9 @@ +class AddAccountsToDestructingStatuses < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def change + safety_assured do + add_reference :destructing_statuses, :account, null: false, foreign_key: { on_delete: :cascade }, index: { algorithm: :concurrently } + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 6346c6804..4875e4e67 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_08_01_210543) do +ActiveRecord::Schema.define(version: 2020_08_01_220000) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -351,6 +351,8 @@ ActiveRecord::Schema.define(version: 2020_08_01_210543) do t.bigint "status_id", null: false t.datetime "after", null: false t.boolean "defederate_only", default: false, null: false + t.bigint "account_id", null: false + t.index ["account_id"], name: "index_destructing_statuses_on_account_id" t.index ["after"], name: "index_destructing_statuses_on_after" t.index ["status_id"], name: "index_destructing_statuses_on_status_id" end @@ -1036,6 +1038,7 @@ ActiveRecord::Schema.define(version: 2020_08_01_210543) do add_foreign_key "conversation_mutes", "conversations", on_delete: :cascade add_foreign_key "conversations", "accounts" add_foreign_key "custom_filters", "accounts", on_delete: :cascade + add_foreign_key "destructing_statuses", "accounts", on_delete: :cascade add_foreign_key "destructing_statuses", "statuses", on_delete: :cascade add_foreign_key "devices", "accounts", on_delete: :cascade add_foreign_key "devices", "oauth_access_tokens", column: "access_token_id", on_delete: :cascade |