about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20170920032311_fix_reblogs_in_feeds.rb2
-rw-r--r--db/migrate/20220124141035_create_appeals.rb14
-rw-r--r--db/migrate/20220210153119_add_overruled_at_to_account_warnings.rb5
-rw-r--r--db/schema.rb23
4 files changed, 42 insertions, 2 deletions
diff --git a/db/migrate/20170920032311_fix_reblogs_in_feeds.rb b/db/migrate/20170920032311_fix_reblogs_in_feeds.rb
index 5654bf6f8..bcd4b9137 100644
--- a/db/migrate/20170920032311_fix_reblogs_in_feeds.rb
+++ b/db/migrate/20170920032311_fix_reblogs_in_feeds.rb
@@ -15,7 +15,7 @@ class FixReblogsInFeeds < ActiveRecord::Migration[5.1]
     # feed, with an entry in a reblog tracking zset (where the score
     # is once again set to the reblogging status' ID, and the value
     # is set to the reblogged status' ID). This is safe for Redis'
-    # float coersion because in this reblog tracking zset, we only
+    # float conversion because in this reblog tracking zset, we only
     # need the rebloggging status' ID to be able to stop tracking
     # entries after they have gotten too far down the feed, which
     # does not require an exact value.
diff --git a/db/migrate/20220124141035_create_appeals.rb b/db/migrate/20220124141035_create_appeals.rb
new file mode 100644
index 000000000..afb3efbd5
--- /dev/null
+++ b/db/migrate/20220124141035_create_appeals.rb
@@ -0,0 +1,14 @@
+class CreateAppeals < ActiveRecord::Migration[6.1]
+  def change
+    create_table :appeals do |t|
+      t.belongs_to :account, null: false, foreign_key: { on_delete: :cascade }
+      t.belongs_to :account_warning, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true }
+      t.text :text, null: false, default: ''
+      t.datetime :approved_at
+      t.belongs_to :approved_by_account, foreign_key: { to_table: :accounts, on_delete: :nullify }
+      t.datetime :rejected_at
+      t.belongs_to :rejected_by_account, foreign_key: { to_table: :accounts, on_delete: :nullify }
+      t.timestamps
+    end
+  end
+end
diff --git a/db/migrate/20220210153119_add_overruled_at_to_account_warnings.rb b/db/migrate/20220210153119_add_overruled_at_to_account_warnings.rb
new file mode 100644
index 000000000..a082da774
--- /dev/null
+++ b/db/migrate/20220210153119_add_overruled_at_to_account_warnings.rb
@@ -0,0 +1,5 @@
+class AddOverruledAtToAccountWarnings < ActiveRecord::Migration[6.1]
+  def change
+    add_column :account_warnings, :overruled_at, :datetime
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 252373a7c..e27e04b71 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: 2022_02_09_175231) do
+ActiveRecord::Schema.define(version: 2022_02_10_153119) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -135,6 +135,7 @@ ActiveRecord::Schema.define(version: 2022_02_09_175231) do
     t.datetime "updated_at", null: false
     t.bigint "report_id"
     t.string "status_ids", array: true
+    t.datetime "overruled_at"
     t.index ["account_id"], name: "index_account_warnings_on_account_id"
     t.index ["target_account_id"], name: "index_account_warnings_on_target_account_id"
   end
@@ -243,6 +244,22 @@ ActiveRecord::Schema.define(version: 2022_02_09_175231) do
     t.bigint "status_ids", array: true
   end
 
+  create_table "appeals", force: :cascade do |t|
+    t.bigint "account_id", null: false
+    t.bigint "account_warning_id", null: false
+    t.text "text", default: "", null: false
+    t.datetime "approved_at"
+    t.bigint "approved_by_account_id"
+    t.datetime "rejected_at"
+    t.bigint "rejected_by_account_id"
+    t.datetime "created_at", precision: 6, null: false
+    t.datetime "updated_at", precision: 6, null: false
+    t.index ["account_id"], name: "index_appeals_on_account_id"
+    t.index ["account_warning_id"], name: "index_appeals_on_account_warning_id", unique: true
+    t.index ["approved_by_account_id"], name: "index_appeals_on_approved_by_account_id"
+    t.index ["rejected_by_account_id"], name: "index_appeals_on_rejected_by_account_id"
+  end
+
   create_table "backups", force: :cascade do |t|
     t.bigint "user_id"
     t.string "dump_file_name"
@@ -1034,6 +1051,10 @@ ActiveRecord::Schema.define(version: 2022_02_09_175231) do
   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 "appeals", "account_warnings", on_delete: :cascade
+  add_foreign_key "appeals", "accounts", column: "approved_by_account_id", on_delete: :nullify
+  add_foreign_key "appeals", "accounts", column: "rejected_by_account_id", on_delete: :nullify
+  add_foreign_key "appeals", "accounts", 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