-- WARNING: This schema is for context only and is not meant to be run. -- Table order and constraints may not be valid for execution. CREATE TABLE public.badges ( id bigint GENERATED ALWAYS AS IDENTITY NOT NULL, created_at timestamp with time zone NOT NULL DEFAULT (now() AT TIME ZONE 'utc'::text), updated_at timestamp with time zone, image_url text NOT NULL, image_artist text, description text, event bigint NOT NULL, group bigint NOT NULL, CONSTRAINT badges_pkey PRIMARY KEY (id), CONSTRAINT badges_event_fkey FOREIGN KEY (event) REFERENCES public.events(id), CONSTRAINT badges_group_fkey FOREIGN KEY (group) REFERENCES public.groups(id) ); CREATE TABLE public.events ( id bigint GENERATED ALWAYS AS IDENTITY NOT NULL, created_at timestamp with time zone NOT NULL DEFAULT (now() AT TIME ZONE 'utc'::text), updated_at timestamp with time zone, title text NOT NULL UNIQUE, description text, group text NOT NULL, banner text NOT NULL, anilist_url text NOT NULL, alternative_banners ARRAY, CONSTRAINT events_pkey PRIMARY KEY (id), CONSTRAINT public_events_group_fkey FOREIGN KEY (group) REFERENCES public.groups(anilist_username) ); CREATE TABLE public.groups ( id bigint GENERATED ALWAYS AS IDENTITY NOT NULL, created_at timestamp with time zone NOT NULL DEFAULT (now() AT TIME ZONE 'utc'::text), updated_at timestamp with time zone, members ARRAY, avatar text NOT NULL, banner text NOT NULL, description text, name text NOT NULL UNIQUE, anilist_id bigint NOT NULL UNIQUE, anilist_username text NOT NULL DEFAULT ''::text UNIQUE, badge text, badge_description text, CONSTRAINT groups_pkey PRIMARY KEY (id) ); CREATE TABLE public.user_badges ( id bigint GENERATED ALWAYS AS IDENTITY NOT NULL, user_id bigint NOT NULL, post text NOT NULL, image text NOT NULL, description text, time timestamp without time zone DEFAULT CURRENT_TIMESTAMP, category text, hidden boolean NOT NULL DEFAULT false, source text, designer text, shadow_hidden boolean NOT NULL DEFAULT false, click_count bigint NOT NULL DEFAULT '0'::bigint, CONSTRAINT user_badges_pkey PRIMARY KEY (id) ); CREATE TABLE public.user_configuration ( id bigint GENERATED ALWAYS AS IDENTITY NOT NULL UNIQUE, user_id bigint NOT NULL UNIQUE, created_at timestamp without time zone NOT NULL DEFAULT now(), updated_at timestamp without time zone, configuration jsonb, CONSTRAINT user_configuration_pkey PRIMARY KEY (id) ); CREATE TABLE public.user_notifications ( id bigint GENERATED ALWAYS AS IDENTITY NOT NULL, created_at timestamp with time zone NOT NULL DEFAULT (now() AT TIME ZONE 'utc'::text), updated_at timestamp with time zone NOT NULL DEFAULT (now() AT TIME ZONE 'utc'::text), user_id bigint NOT NULL UNIQUE, subscription json NOT NULL, fingerprint text NOT NULL, CONSTRAINT user_notifications_pkey PRIMARY KEY (id) ); CREATE TABLE public.user_preferences ( id bigint GENERATED ALWAYS AS IDENTITY NOT NULL, created_at timestamp with time zone NOT NULL DEFAULT now(), updated_at timestamp with time zone, pinned_hololive_streams ARRAY NOT NULL DEFAULT '{}'::text[], hide_missing_badges boolean NOT NULL DEFAULT false, user_id bigint NOT NULL UNIQUE, biography text, badge_wall_css text NOT NULL DEFAULT ''::text, hide_awc_badges boolean NOT NULL DEFAULT false, pinned_badge_wall_categories ARRAY DEFAULT '{}'::text[], CONSTRAINT user_preferences_pkey PRIMARY KEY (id) ); CREATE TABLE public.user_tracker ( id bigint GENERATED ALWAYS AS IDENTITY NOT NULL, user_id bigint NOT NULL, created_at timestamp with time zone NOT NULL DEFAULT now(), updated_at timestamp with time zone NOT NULL DEFAULT now(), url text NOT NULL, title text NOT NULL, progress bigint NOT NULL DEFAULT '0'::bigint, CONSTRAINT user_tracker_pkey PRIMARY KEY (id) );