diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20180808175627_create_account_pins.rb | 12 | ||||
-rw-r--r-- | db/schema.rb | 16 |
2 files changed, 26 insertions, 2 deletions
diff --git a/db/migrate/20180808175627_create_account_pins.rb b/db/migrate/20180808175627_create_account_pins.rb new file mode 100644 index 000000000..43d8185be --- /dev/null +++ b/db/migrate/20180808175627_create_account_pins.rb @@ -0,0 +1,12 @@ +class CreateAccountPins < ActiveRecord::Migration[5.2] + def change + create_table :account_pins do |t| + t.belongs_to :account, foreign_key: { on_delete: :cascade } + t.belongs_to :target_account, foreign_key: { on_delete: :cascade, to_table: :accounts } + + t.timestamps + end + + add_index :account_pins, [:account_id, :target_account_id], unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index e0da669c4..46ee42714 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: 2018_07_11_152640) do +ActiveRecord::Schema.define(version: 2018_08_08_175627) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -33,6 +33,16 @@ ActiveRecord::Schema.define(version: 2018_07_11_152640) do t.index ["target_account_id"], name: "index_account_moderation_notes_on_target_account_id" end + create_table "account_pins", force: :cascade do |t| + t.bigint "account_id" + t.bigint "target_account_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["account_id", "target_account_id"], name: "index_account_pins_on_account_id_and_target_account_id", unique: true + t.index ["account_id"], name: "index_account_pins_on_account_id" + t.index ["target_account_id"], name: "index_account_pins_on_target_account_id" + end + create_table "accounts", force: :cascade do |t| t.string "username", default: "", null: false t.string "domain" @@ -149,9 +159,9 @@ ActiveRecord::Schema.define(version: 2018_07_11_152640) do t.text "phrase", default: "", null: false t.string "context", default: [], null: false, array: true t.boolean "irreversible", default: false, null: false - t.boolean "whole_word", default: true, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.boolean "whole_word", default: true, null: false t.index ["account_id"], name: "index_custom_filters_on_account_id" end @@ -575,6 +585,8 @@ ActiveRecord::Schema.define(version: 2018_07_11_152640) do add_foreign_key "account_domain_blocks", "accounts", name: "fk_206c6029bd", on_delete: :cascade add_foreign_key "account_moderation_notes", "accounts" add_foreign_key "account_moderation_notes", "accounts", column: "target_account_id" + add_foreign_key "account_pins", "accounts", column: "target_account_id", on_delete: :cascade + add_foreign_key "account_pins", "accounts", on_delete: :cascade add_foreign_key "accounts", "accounts", column: "moved_to_account_id", on_delete: :nullify add_foreign_key "admin_action_logs", "accounts", on_delete: :cascade add_foreign_key "backups", "users", on_delete: :nullify |