diff options
author | Thibaut Girka <thib@sitedethib.com> | 2020-01-24 14:37:06 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2020-01-24 14:37:06 +0100 |
commit | 9adeaf2bfc1c16ca70e611b5288886b21414217b (patch) | |
tree | 53372bc9bd6f38d158aad50c768e18773b7d3f3b /db | |
parent | a8c109baca4d02cc8aed454e231518c1f8ec1844 (diff) | |
parent | 4bae4e972d43f71bffb888ac82c180b2fa3f1ada (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - `app/controllers/statuses_controller.rb`: Minor conflict due to theming system
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20191218153258_create_announcements.rb | 16 | ||||
-rw-r--r-- | db/migrate/20200113125135_create_announcement_mutes.rb | 12 | ||||
-rw-r--r-- | db/migrate/20200114113335_create_announcement_reactions.rb | 15 | ||||
-rw-r--r-- | db/migrate/20200119112504_add_public_index_to_statuses.rb | 11 | ||||
-rw-r--r-- | db/schema.rb | 44 |
5 files changed, 96 insertions, 2 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 diff --git a/db/schema.rb b/db/schema.rb index b7ab74033..2f41dee97 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_12_12_003415) do +ActiveRecord::Schema.define(version: 2020_01_19_112504) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -196,15 +196,49 @@ ActiveRecord::Schema.define(version: 2019_12_12_003415) do t.index ["target_type", "target_id"], name: "index_admin_action_logs_on_target_type_and_target_id" end + create_table "announcement_mutes", force: :cascade do |t| + t.bigint "account_id" + t.bigint "announcement_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["account_id", "announcement_id"], name: "index_announcement_mutes_on_account_id_and_announcement_id", unique: true + t.index ["account_id"], name: "index_announcement_mutes_on_account_id" + t.index ["announcement_id"], name: "index_announcement_mutes_on_announcement_id" + end + + create_table "announcement_reactions", force: :cascade do |t| + t.bigint "account_id" + t.bigint "announcement_id" + t.string "name", default: "", null: false + t.bigint "custom_emoji_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["account_id", "announcement_id", "name"], name: "index_announcement_reactions_on_account_id_and_announcement_id", unique: true + t.index ["account_id"], name: "index_announcement_reactions_on_account_id" + t.index ["announcement_id"], name: "index_announcement_reactions_on_announcement_id" + t.index ["custom_emoji_id"], name: "index_announcement_reactions_on_custom_emoji_id" + end + + create_table "announcements", force: :cascade do |t| + t.text "text", default: "", null: false + t.boolean "published", default: false, null: false + t.boolean "all_day", default: false, null: false + t.datetime "scheduled_at" + t.datetime "starts_at" + t.datetime "ends_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "backups", force: :cascade do |t| t.bigint "user_id" t.string "dump_file_name" t.string "dump_content_type" - t.bigint "dump_file_size" t.datetime "dump_updated_at" t.boolean "processed", default: false, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.bigint "dump_file_size" end create_table "blocks", force: :cascade do |t| @@ -693,6 +727,7 @@ ActiveRecord::Schema.define(version: 2019_12_12_003415) do t.datetime "deleted_at" t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20190820", order: { id: :desc }, where: "(deleted_at IS NULL)" t.index ["id", "account_id"], name: "index_statuses_local_20190824", order: { id: :desc }, where: "((local OR (uri IS NULL)) AND (deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))" + t.index ["id", "account_id"], name: "index_statuses_public_20200119", 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)))" t.index ["in_reply_to_account_id"], name: "index_statuses_on_in_reply_to_account_id" t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id" t.index ["reblog_of_id", "account_id"], name: "index_statuses_on_reblog_of_id_and_account_id" @@ -820,6 +855,11 @@ ActiveRecord::Schema.define(version: 2019_12_12_003415) do add_foreign_key "account_warnings", "accounts", on_delete: :nullify 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 "announcement_mutes", "accounts", on_delete: :cascade + add_foreign_key "announcement_mutes", "announcements", on_delete: :cascade + add_foreign_key "announcement_reactions", "accounts", on_delete: :cascade + add_foreign_key "announcement_reactions", "announcements", on_delete: :cascade + add_foreign_key "announcement_reactions", "custom_emojis", on_delete: :cascade add_foreign_key "backups", "users", on_delete: :nullify add_foreign_key "blocks", "accounts", column: "target_account_id", name: "fk_9571bfabc1", on_delete: :cascade add_foreign_key "blocks", "accounts", name: "fk_4269e03e65", on_delete: :cascade |