about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20191218153258_create_announcements.rb16
-rw-r--r--db/migrate/20200113125135_create_announcement_mutes.rb12
-rw-r--r--db/migrate/20200114113335_create_announcement_reactions.rb15
-rw-r--r--db/schema.rb41
4 files changed, 83 insertions, 1 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/schema.rb b/db/schema.rb
index fc2d3a511..d3a2c05b3 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -196,15 +196,49 @@ ActiveRecord::Schema.define(version: 2020_01_19_112504) 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|
@@ -818,6 +852,11 @@ ActiveRecord::Schema.define(version: 2020_01_19_112504) 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