kemono2/db/migrations/20221113_01_24prS-add-fancards-table.py
2024-07-04 21:57:05 +02:00

25 lines
556 B
Python

"""
Add fancards table
"""
from yoyo import step
__depends__ = {"20221111_01_jQjnV-add-processed-json-column-to-fanbox-embeds"}
steps = [
step(
"""
CREATE TABLE fanbox_fancards (
id serial primary key,
user_id varchar not null,
file_id int not null references files(id),
UNIQUE (user_id, file_id)
);
"""
),
step(
"CREATE INDEX fanbox_fancards_user_id_idx ON fanbox_fancards USING btree (user_id)",
"DROP INDEX fanbox_fancards_user_id_idx",
),
]