Change emoji reactions ids to snowflake ids
This commit is contained in:
parent
b12778caeb
commit
d80efbad2b
2 changed files with 19 additions and 2 deletions
|
@ -0,0 +1,17 @@
|
|||
class EmojiReactionIdsToTimestampIds < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
# Set up the accounts.id column to use our timestamp-based IDs.
|
||||
safety_assured do
|
||||
execute("ALTER TABLE emoji_reactions ALTER COLUMN id SET DEFAULT timestamp_id('emoji_reactions')")
|
||||
end
|
||||
|
||||
# Make sure we have a sequence to use.
|
||||
Mastodon::Snowflake.ensure_id_sequences_exist
|
||||
end
|
||||
|
||||
def down
|
||||
execute("LOCK emoji_reactions")
|
||||
execute("SELECT setval('emoji_reactions_id_seq', (SELECT MAX(id) FROM emoji_reactions))")
|
||||
execute("ALTER TABLE emoji_reactions ALTER COLUMN id SET DEFAULT nextval('emoji_reactions_id_seq')")
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2022_04_05_140844) do
|
||||
ActiveRecord::Schema.define(version: 2022_04_13_004654) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -435,7 +435,7 @@ ActiveRecord::Schema.define(version: 2022_04_05_140844) do
|
|||
t.index ["domain"], name: "index_email_domain_blocks_on_domain", unique: true
|
||||
end
|
||||
|
||||
create_table "emoji_reactions", force: :cascade do |t|
|
||||
create_table "emoji_reactions", id: :bigint, default: -> { "timestamp_id('emoji_reactions'::text)" }, force: :cascade do |t|
|
||||
t.bigint "account_id", null: false
|
||||
t.bigint "status_id", null: false
|
||||
t.string "name", default: "", null: false
|
||||
|
|
Loading…
Reference in a new issue