90 lines
2.7 KiB
Python
90 lines
2.7 KiB
Python
|
"""
|
||
|
Change completely the structure of DMs
|
||
|
"""
|
||
|
|
||
|
from yoyo import step
|
||
|
|
||
|
__depends__ = {'20231119_00_ASHrR6-fix-revisions-table-to-match-tags-type'}
|
||
|
|
||
|
steps = [
|
||
|
step("""
|
||
|
|
||
|
CREATE TABLE public.creators (
|
||
|
creator_id text NOT NULL,
|
||
|
service text NOT NULL,
|
||
|
creator_name text NOT NULL,
|
||
|
creator_slug text,
|
||
|
creator_internal_id text,
|
||
|
short_description text NOT NULL,
|
||
|
description text NOT NULL,
|
||
|
icon text,
|
||
|
banner text,
|
||
|
is_nsfw boolean,
|
||
|
deleted_at timestamp without time zone,
|
||
|
stopped_at timestamp without time zone,
|
||
|
paused_at timestamp without time zone,
|
||
|
post_count integer,
|
||
|
media_count integer,
|
||
|
tiers jsonb[],
|
||
|
access_groups jsonb[],
|
||
|
published_at timestamp without time zone,
|
||
|
added_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||
|
updated_at timestamp without time zone,
|
||
|
public_posts_refreshed_at timestamp without time zone,
|
||
|
public_posts_full_refreshed_at timestamp without time zone
|
||
|
);
|
||
|
ALTER TABLE ONLY public.creators ADD CONSTRAINT creators_pkey PRIMARY KEY (creator_id, service);
|
||
|
|
||
|
|
||
|
CREATE TABLE public.creators_revisions (
|
||
|
revision_id serial NOT NULL PRIMARY KEY,
|
||
|
creator_id text NOT NULL,
|
||
|
service text NOT NULL,
|
||
|
creator_name text NOT NULL,
|
||
|
creator_slug text,
|
||
|
creator_internal_id text,
|
||
|
short_description text NOT NULL,
|
||
|
description text NOT NULL,
|
||
|
icon text,
|
||
|
banner text,
|
||
|
is_nsfw boolean,
|
||
|
deleted_at timestamp without time zone,
|
||
|
stopped_at timestamp without time zone,
|
||
|
paused_at timestamp without time zone,
|
||
|
post_count integer,
|
||
|
media_count integer,
|
||
|
tiers jsonb[],
|
||
|
access_groups jsonb[],
|
||
|
published_at timestamp without time zone,
|
||
|
added_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||
|
updated_at timestamp without time zone,
|
||
|
public_posts_refreshed_at timestamp without time zone,
|
||
|
public_posts_full_refreshed_at timestamp without time zone
|
||
|
);
|
||
|
CREATE INDEX creators_revisions_creator_id_service_idx ON public.creators_revisions USING btree (creator_id, service);
|
||
|
|
||
|
|
||
|
CREATE TABLE public.public_posts (
|
||
|
post_id text NOT NULL,
|
||
|
creator_id text NOT NULL,
|
||
|
service text NOT NULL,
|
||
|
title text NOT NULL,
|
||
|
body text NOT NULL,
|
||
|
tier_price_required text,
|
||
|
tier_required text[],
|
||
|
published_at timestamp without time zone,
|
||
|
edited_at timestamp without time zone,
|
||
|
deleted_at timestamp without time zone,
|
||
|
tags text[],
|
||
|
like_count integer,
|
||
|
comment_count integer,
|
||
|
is_public boolean,
|
||
|
is_nsfw boolean,
|
||
|
refreshed_at timestamp without time zone
|
||
|
);
|
||
|
|
||
|
ALTER TABLE ONLY public.public_posts ADD CONSTRAINT public_posts_pkey PRIMARY KEY (post_id, service);
|
||
|
CREATE INDEX public_posts_creator_id_service_idx ON public.public_posts USING btree (service, creator_id);
|
||
|
"""),
|
||
|
]
|