diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-08-06 13:55:54 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-08-06 13:55:54 -0500 |
commit | da389a664b87bb131435f2ccb904c0754d5d1655 (patch) | |
tree | 79f6fe6b29f2c361f1c33aa9a811991892b2f0db /db | |
parent | 647ac0f86abb49b97c55229b70e9c06e943adc98 (diff) |
added ability to link accounts with `account:link:token` + `account:link:add` & switch between them with `i:am`/`we:are` bangtags; remove links with `account:link:del:USERNAME` or `account:link:clear`; list links with `account:link:list`
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20190805203816_create_linked_users.rb | 12 | ||||
-rw-r--r-- | db/schema.rb | 14 |
2 files changed, 25 insertions, 1 deletions
diff --git a/db/migrate/20190805203816_create_linked_users.rb b/db/migrate/20190805203816_create_linked_users.rb new file mode 100644 index 000000000..36744fed6 --- /dev/null +++ b/db/migrate/20190805203816_create_linked_users.rb @@ -0,0 +1,12 @@ +class CreateLinkedUsers < ActiveRecord::Migration[5.2] + def change + create_table :linked_users do |t| + t.references :user, foreign_key: { on_delete: :cascade } + t.references :target_user, foreign_key: { to_table: 'users', on_delete: :cascade } + + t.timestamps + end + + add_index :linked_users , [:user_id, :target_user_id], :unique => true + end +end diff --git a/db/schema.rb b/db/schema.rb index 407e1038f..3c2664db5 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: 2019_08_05_064643) do +ActiveRecord::Schema.define(version: 2019_08_05_203816) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -361,6 +361,16 @@ ActiveRecord::Schema.define(version: 2019_08_05_064643) do t.index ["user_id"], name: "index_invites_on_user_id" end + create_table "linked_users", force: :cascade do |t| + t.bigint "user_id" + t.bigint "target_user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["target_user_id"], name: "index_linked_users_on_target_user_id" + t.index ["user_id", "target_user_id"], name: "index_linked_users_on_user_id_and_target_user_id", unique: true + t.index ["user_id"], name: "index_linked_users_on_user_id" + end + create_table "list_accounts", force: :cascade do |t| t.bigint "list_id", null: false t.bigint "account_id", null: false @@ -827,6 +837,8 @@ ActiveRecord::Schema.define(version: 2019_08_05_064643) do add_foreign_key "identities", "users", name: "fk_bea040f377", on_delete: :cascade add_foreign_key "imports", "accounts", name: "fk_6db1b6e408", on_delete: :cascade add_foreign_key "invites", "users", on_delete: :cascade + add_foreign_key "linked_users", "users", column: "target_user_id", on_delete: :cascade + add_foreign_key "linked_users", "users", on_delete: :cascade add_foreign_key "list_accounts", "accounts", on_delete: :cascade add_foreign_key "list_accounts", "follows", on_delete: :cascade add_foreign_key "list_accounts", "lists", on_delete: :cascade |