diff options
author | ThibG <thib@sitedethib.com> | 2020-01-24 17:28:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-24 17:28:22 +0100 |
commit | 0be67df4f0a64367d9e376b06bd3fd2fb9ca8195 (patch) | |
tree | 2eaa85c899033aab9bd1b2f9da2d727ce5788e16 /db/migrate | |
parent | a8c109baca4d02cc8aed454e231518c1f8ec1844 (diff) | |
parent | bdc1581556b86ba25a385c9309db714eeaba1ca1 (diff) |
Merge pull request #1265 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'db/migrate')
4 files changed, 54 insertions, 0 deletions
diff --git a/db/migrate/20191218153258_create_announcements.rb b/db/migrate/20191218153258_create_announcements.rb new file mode 100644 index 000000000..58e143c92 --- /dev/null +++ b/db/migrate/20191218153258_create_announcements.rb @@ -0,0 +1,16 @@ +class CreateAnnouncements < ActiveRecord::Migration[5.2] + def change + create_table :announcements do |t| + t.text :text, null: false, default: '' + + t.boolean :published, null: false, default: false + t.boolean :all_day, null: false, default: false + + t.datetime :scheduled_at + t.datetime :starts_at + t.datetime :ends_at + + t.timestamps + end + end +end diff --git a/db/migrate/20200113125135_create_announcement_mutes.rb b/db/migrate/20200113125135_create_announcement_mutes.rb new file mode 100644 index 000000000..c588e7fcd --- /dev/null +++ b/db/migrate/20200113125135_create_announcement_mutes.rb @@ -0,0 +1,12 @@ +class CreateAnnouncementMutes < ActiveRecord::Migration[5.2] + def change + create_table :announcement_mutes do |t| + t.belongs_to :account, foreign_key: { on_delete: :cascade, index: false } + t.belongs_to :announcement, foreign_key: { on_delete: :cascade } + + t.timestamps + end + + add_index :announcement_mutes, [:account_id, :announcement_id], unique: true + end +end diff --git a/db/migrate/20200114113335_create_announcement_reactions.rb b/db/migrate/20200114113335_create_announcement_reactions.rb new file mode 100644 index 000000000..226c81a18 --- /dev/null +++ b/db/migrate/20200114113335_create_announcement_reactions.rb @@ -0,0 +1,15 @@ +class CreateAnnouncementReactions < ActiveRecord::Migration[5.2] + def change + create_table :announcement_reactions do |t| + t.belongs_to :account, foreign_key: { on_delete: :cascade, index: false } + t.belongs_to :announcement, foreign_key: { on_delete: :cascade } + + t.string :name, null: false, default: '' + t.belongs_to :custom_emoji, foreign_key: { on_delete: :cascade } + + t.timestamps + end + + add_index :announcement_reactions, [:account_id, :announcement_id, :name], unique: true, name: :index_announcement_reactions_on_account_id_and_announcement_id + end +end diff --git a/db/migrate/20200119112504_add_public_index_to_statuses.rb b/db/migrate/20200119112504_add_public_index_to_statuses.rb new file mode 100644 index 000000000..db007848e --- /dev/null +++ b/db/migrate/20200119112504_add_public_index_to_statuses.rb @@ -0,0 +1,11 @@ +class AddPublicIndexToStatuses < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def up + add_index :statuses, [:id, :account_id], name: :index_statuses_public_20200119, algorithm: :concurrently, order: { id: :desc }, where: 'deleted_at IS NULL AND visibility = 0 AND reblog_of_id IS NULL AND ((NOT reply) OR (in_reply_to_account_id = account_id))' + end + + def down + remove_index :statuses, name: :index_statuses_public_20200119 + end +end |