diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-07-15 13:34:05 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-07-15 14:12:24 -0500 |
commit | cf3ec71aa564c7fe47ec79f8dd5f14e3bce0b85c (patch) | |
tree | 49a3356c4177157b377aeca223a7d1c1e2e3dc17 /db/migrate | |
parent | 0a5eba734e6aa6a6e7e8f64b022af8ea129c9f5d (diff) |
local visibility scope, chat scope+tags, unlisted tags
Diffstat (limited to 'db/migrate')
5 files changed, 40 insertions, 0 deletions
diff --git a/db/migrate/20190522043937_add_chat_and_local_indexes_to_statuses.rb b/db/migrate/20190522043937_add_chat_and_local_indexes_to_statuses.rb new file mode 100644 index 000000000..ad4bb11b1 --- /dev/null +++ b/db/migrate/20190522043937_add_chat_and_local_indexes_to_statuses.rb @@ -0,0 +1,6 @@ +class AddChatAndLocalIndexesToStatuses < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + def change + add_index :statuses, [:account_id, :id, :visibility], where: 'visibility IN (0, 1, 2, 4, 5)', algorithm: :concurrently + end +end diff --git a/db/migrate/20190522060455_add_unlisted_to_tags.rb b/db/migrate/20190522060455_add_unlisted_to_tags.rb new file mode 100644 index 000000000..3c47af673 --- /dev/null +++ b/db/migrate/20190522060455_add_unlisted_to_tags.rb @@ -0,0 +1,9 @@ +class AddUnlistedToTags < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + def change + safety_assured { + add_column :tags, :unlisted, :boolean, default: false, null: false + add_index :tags, :unlisted, where: :unlisted, algorithm: :concurrently + } + end +end diff --git a/db/migrate/20190522060919_make_private_tags_unlisted.rb b/db/migrate/20190522060919_make_private_tags_unlisted.rb new file mode 100644 index 000000000..92f610d57 --- /dev/null +++ b/db/migrate/20190522060919_make_private_tags_unlisted.rb @@ -0,0 +1,5 @@ +class MakePrivateTagsUnlisted < ActiveRecord::Migration[5.2] + def up + Tag.where(private: true).in_batches.update_all(unlisted: true) + end +end diff --git a/db/migrate/20190523010615_add_chat_to_tags.rb b/db/migrate/20190523010615_add_chat_to_tags.rb new file mode 100644 index 000000000..1fc3cadfa --- /dev/null +++ b/db/migrate/20190523010615_add_chat_to_tags.rb @@ -0,0 +1,9 @@ +class AddChatToTags < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + def change + safety_assured { + add_column :tags, :chat, :boolean, default: false, null: false + add_index :tags, :chat, where: :chat, algorithm: :concurrently + } + end +end diff --git a/db/migrate/20190526052454_create_chat_accounts.rb b/db/migrate/20190526052454_create_chat_accounts.rb new file mode 100644 index 000000000..b950e36c1 --- /dev/null +++ b/db/migrate/20190526052454_create_chat_accounts.rb @@ -0,0 +1,11 @@ +class CreateChatAccounts < ActiveRecord::Migration[5.2] + def change + create_table :chat_accounts do |t| + t.references :account, foreign_key: { on_delete: :cascade }, null: false + t.references :tag, foreign_key: { on_delete: :cascade }, null: false + t.index [:account_id, :tag_id], unique: true + t.index [:tag_id, :account_id] + t.timestamps + end + end +end |