Create emoji reactions table

This commit is contained in:
KMY 2023-02-23 09:14:38 +09:00
parent 87f2d18462
commit 0ebf8b302d
4 changed files with 78 additions and 1 deletions

View file

@ -0,0 +1,13 @@
class CreateEmojiReactions < ActiveRecord::Migration[6.1]
def change
create_table :emoji_reactions do |t|
t.belongs_to :account, null: false, foreign_key: { on_delete: :cascade }, index: false
t.belongs_to :status, null: false, foreign_key: { on_delete: :cascade }
t.string :name, null: false, default: ''
t.belongs_to :custom_emoji, foreign_key: { on_delete: :cascade }, index: false
t.string :uri
end
end
end

View file

@ -0,0 +1,6 @@
class AddCreateAtToEmojiReactions < ActiveRecord::Migration[6.1]
def change
add_column :emoji_reactions, :created_at, :timestamp
add_column :emoji_reactions, :updated_at, :timestamp
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: 2022_12_06_114142) do
ActiveRecord::Schema.define(version: 2023_02_22_235218) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -411,6 +411,17 @@ ActiveRecord::Schema.define(version: 2022_12_06_114142) do
t.index ["domain"], name: "index_email_domain_blocks_on_domain", unique: true
end
create_table "emoji_reactions", force: :cascade do |t|
t.bigint "account_id", null: false
t.bigint "status_id", null: false
t.string "name", default: "", null: false
t.bigint "custom_emoji_id"
t.string "uri"
t.datetime "created_at"
t.datetime "updated_at"
t.index ["status_id"], name: "index_emoji_reactions_on_status_id"
end
create_table "encrypted_messages", id: :bigint, default: -> { "timestamp_id('encrypted_messages'::text)" }, force: :cascade do |t|
t.bigint "device_id"
t.bigint "from_account_id"
@ -1155,6 +1166,9 @@ ActiveRecord::Schema.define(version: 2022_12_06_114142) do
add_foreign_key "devices", "accounts", on_delete: :cascade
add_foreign_key "devices", "oauth_access_tokens", column: "access_token_id", on_delete: :cascade
add_foreign_key "email_domain_blocks", "email_domain_blocks", column: "parent_id", on_delete: :cascade
add_foreign_key "emoji_reactions", "accounts", on_delete: :cascade
add_foreign_key "emoji_reactions", "custom_emojis", on_delete: :cascade
add_foreign_key "emoji_reactions", "statuses", on_delete: :cascade
add_foreign_key "encrypted_messages", "accounts", column: "from_account_id", on_delete: :cascade
add_foreign_key "encrypted_messages", "devices", on_delete: :cascade
add_foreign_key "favourites", "accounts", name: "fk_5eb6c2b873", on_delete: :cascade