Merge commit 'eaa1f9e450' into kb_migration

This commit is contained in:
KMY 2023-07-07 07:20:37 +09:00
commit 2a813d517d
73 changed files with 987 additions and 72 deletions

View 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

View file

@ -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