Add scheduled statuses (#9706)

Fix #340
This commit is contained in:
Eugen Rochko
2019-01-05 12:43:28 +01:00
committed by GitHub
parent b17b2f25ac
commit a49d43d112
29 changed files with 437 additions and 103 deletions

View File

@ -0,0 +1,9 @@
class CreateScheduledStatuses < ActiveRecord::Migration[5.2]
def change
create_table :scheduled_statuses do |t|
t.belongs_to :account, foreign_key: { on_delete: :cascade }
t.datetime :scheduled_at, index: true
t.jsonb :params
end
end
end

View File

@ -0,0 +1,8 @@
class AddScheduledStatusIdToMediaAttachments < ActiveRecord::Migration[5.2]
disable_ddl_transaction!
def change
add_reference :media_attachments, :scheduled_status, foreign_key: { on_delete: :nullify }, index: false
add_index :media_attachments, :scheduled_status_id, algorithm: :concurrently
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_12_26_021420) do
ActiveRecord::Schema.define(version: 2019_01_03_124754) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -336,7 +336,9 @@ ActiveRecord::Schema.define(version: 2018_12_26_021420) do
t.json "file_meta"
t.bigint "account_id"
t.text "description"
t.bigint "scheduled_status_id"
t.index ["account_id"], name: "index_media_attachments_on_account_id"
t.index ["scheduled_status_id"], name: "index_media_attachments_on_scheduled_status_id"
t.index ["shortcode"], name: "index_media_attachments_on_shortcode", unique: true
t.index ["status_id"], name: "index_media_attachments_on_status_id"
end
@ -487,6 +489,14 @@ ActiveRecord::Schema.define(version: 2018_12_26_021420) do
t.index ["target_account_id"], name: "index_reports_on_target_account_id"
end
create_table "scheduled_statuses", force: :cascade do |t|
t.bigint "account_id"
t.datetime "scheduled_at"
t.jsonb "params"
t.index ["account_id"], name: "index_scheduled_statuses_on_account_id"
t.index ["scheduled_at"], name: "index_scheduled_statuses_on_scheduled_at"
end
create_table "session_activations", force: :cascade do |t|
t.string "session_id", null: false
t.datetime "created_at", null: false
@ -700,6 +710,7 @@ ActiveRecord::Schema.define(version: 2018_12_26_021420) do
add_foreign_key "list_accounts", "lists", on_delete: :cascade
add_foreign_key "lists", "accounts", on_delete: :cascade
add_foreign_key "media_attachments", "accounts", name: "fk_96dd81e81b", on_delete: :nullify
add_foreign_key "media_attachments", "scheduled_statuses", on_delete: :nullify
add_foreign_key "media_attachments", "statuses", on_delete: :nullify
add_foreign_key "mentions", "accounts", name: "fk_970d43f9d1", on_delete: :cascade
add_foreign_key "mentions", "statuses", on_delete: :cascade
@ -718,6 +729,7 @@ ActiveRecord::Schema.define(version: 2018_12_26_021420) do
add_foreign_key "reports", "accounts", column: "assigned_account_id", on_delete: :nullify
add_foreign_key "reports", "accounts", column: "target_account_id", name: "fk_eb37af34f0", on_delete: :cascade
add_foreign_key "reports", "accounts", name: "fk_4b81f7522c", on_delete: :cascade
add_foreign_key "scheduled_statuses", "accounts", on_delete: :cascade
add_foreign_key "session_activations", "oauth_access_tokens", column: "access_token_id", name: "fk_957e5bda89", on_delete: :cascade
add_foreign_key "session_activations", "users", name: "fk_e5fda67334", on_delete: :cascade
add_foreign_key "status_pins", "accounts", name: "fk_d4cb435b62", on_delete: :cascade