about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-07-19 18:50:24 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:43:59 -0500
commit21438b54bdaf3c557ec9ebbc482a2c418d8c64f8 (patch)
treee577d047af196823227e675dea52b2fc2fa842c6 /db
parent8c8ad0ac0ed0d3e67f3e521068b59edd4054f1e9 (diff)
[Feature] Add manual publishing option
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200719181947_add_published_to_statuses.rb7
-rw-r--r--db/migrate/20200719184152_add_unpublished_index_to_statuses.rb7
-rw-r--r--db/schema.rb4
3 files changed, 17 insertions, 1 deletions
diff --git a/db/migrate/20200719181947_add_published_to_statuses.rb b/db/migrate/20200719181947_add_published_to_statuses.rb
new file mode 100644
index 000000000..129840a0c
--- /dev/null
+++ b/db/migrate/20200719181947_add_published_to_statuses.rb
@@ -0,0 +1,7 @@
+class AddPublishedToStatuses < ActiveRecord::Migration[5.2]
+  def change
+    safety_assured do
+      add_column :statuses, :published, :boolean, default: true, null: false
+    end
+  end
+end
diff --git a/db/migrate/20200719184152_add_unpublished_index_to_statuses.rb b/db/migrate/20200719184152_add_unpublished_index_to_statuses.rb
new file mode 100644
index 000000000..ee6d3e942
--- /dev/null
+++ b/db/migrate/20200719184152_add_unpublished_index_to_statuses.rb
@@ -0,0 +1,7 @@
+class AddUnpublishedIndexToStatuses < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+
+  def change
+    add_index :statuses, [:account_id, :id], where: '(deleted_at IS NULL) AND (published = FALSE)', order: { id: :desc }, algorithm: :concurrently, name: :index_unpublished_statuses
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index ff878d47e..57783dc3a 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: 2020_07_19_114344) do
+ActiveRecord::Schema.define(version: 2020_07_19_184152) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -791,7 +791,9 @@ ActiveRecord::Schema.define(version: 2020_07_19_114344) do
     t.datetime "deleted_at"
     t.integer "edited", default: 0, null: false
     t.integer "nest_level", limit: 2, default: 0, null: false
+    t.boolean "published", default: true, null: false
     t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20190820", order: { id: :desc }, where: "(deleted_at IS NULL)"
+    t.index ["account_id", "id"], name: "index_unpublished_statuses", order: { id: :desc }, where: "((deleted_at IS NULL) AND (published = false))"
     t.index ["conversation_id"], name: "index_statuses_on_conversation_id", 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_on_id_and_account_id"