Merge commit 'eaa1f9e450
' into kb_migration
This commit is contained in:
commit
2a813d517d
73 changed files with 987 additions and 72 deletions
12
db/migrate/20230705232953_create_status_references.rb
Normal file
12
db/migrate/20230705232953_create_status_references.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateStatusReferences < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :status_references do |t|
|
||||
t.belongs_to :status, null: false, foreign_key: { on_delete: :cascade }
|
||||
t.belongs_to :target_status, null: false, foreign_key: { on_delete: :cascade, to_table: :statuses }
|
||||
t.datetime :created_at, null: false
|
||||
t.datetime :updated_at, null: false
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddStatusReferredByCountToStatusStats < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
safety_assured do
|
||||
add_column :status_stats, :status_referred_by_count, :integer, null: false, default: 0
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :status_stats, :status_referred_by_count
|
||||
end
|
||||
end
|
14
db/schema.rb
14
db/schema.rb
|
@ -12,7 +12,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2023_07_02_131023) do
|
||||
ActiveRecord::Schema.define(version: 2023_07_06_031715) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -1043,6 +1043,15 @@ ActiveRecord::Schema.define(version: 2023_07_02_131023) do
|
|||
t.index ["status_id"], name: "index_status_pins_on_status_id"
|
||||
end
|
||||
|
||||
create_table "status_references", force: :cascade do |t|
|
||||
t.bigint "status_id", null: false
|
||||
t.bigint "target_status_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["status_id"], name: "index_status_references_on_status_id"
|
||||
t.index ["target_status_id"], name: "index_status_references_on_target_status_id"
|
||||
end
|
||||
|
||||
create_table "status_stats", force: :cascade do |t|
|
||||
t.bigint "status_id", null: false
|
||||
t.bigint "replies_count", default: 0, null: false
|
||||
|
@ -1054,6 +1063,7 @@ ActiveRecord::Schema.define(version: 2023_07_02_131023) do
|
|||
t.integer "emoji_reactions_count", default: 0, null: false
|
||||
t.integer "test", default: 0, null: false
|
||||
t.integer "emoji_reaction_accounts_count", default: 0, null: false
|
||||
t.integer "status_referred_by_count", default: 0, null: false
|
||||
t.index ["status_id"], name: "index_status_stats_on_status_id", unique: true
|
||||
end
|
||||
|
||||
|
@ -1377,6 +1387,8 @@ ActiveRecord::Schema.define(version: 2023_07_02_131023) do
|
|||
add_foreign_key "status_edits", "statuses", on_delete: :cascade
|
||||
add_foreign_key "status_pins", "accounts", name: "fk_d4cb435b62", on_delete: :cascade
|
||||
add_foreign_key "status_pins", "statuses", on_delete: :cascade
|
||||
add_foreign_key "status_references", "statuses", column: "target_status_id", on_delete: :cascade
|
||||
add_foreign_key "status_references", "statuses", on_delete: :cascade
|
||||
add_foreign_key "status_stats", "statuses", on_delete: :cascade
|
||||
add_foreign_key "status_trends", "accounts", on_delete: :cascade
|
||||
add_foreign_key "status_trends", "statuses", on_delete: :cascade
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue