--
--


ALTER TABLE ONLY public.hashtagpost DROP CONSTRAINT hashtagpost_post_id_fkey;
ALTER TABLE ONLY public.hashtagpost DROP CONSTRAINT hashtagpost_hashtag_id_fkey;
DROP INDEX public.index_foreignkey_userrecovery_user;
DROP INDEX public.index_foreignkey_userfollow_followed_user;
DROP INDEX public.index_foreignkey_userfollow_followed_by_user;
DROP INDEX public.index_foreignkey_useremailverification_user;
DROP INDEX public.index_foreignkey_userblock_blocked_user;
DROP INDEX public.index_foreignkey_userblock_blocked_by_user;
DROP INDEX public.index_foreignkey_postusertag_tagged_user;
DROP INDEX public.index_foreignkey_postusertag_tagged_in_post;
DROP INDEX public.index_foreignkey_postusertag_post_owner_user;
DROP INDEX public.index_foreignkey_postsave_saved_to_collection;
DROP INDEX public.index_foreignkey_postsave_saved_post;
DROP INDEX public.index_foreignkey_postsave_saved_by_user;
DROP INDEX public.index_foreignkey_postlike_liked_post;
DROP INDEX public.index_foreignkey_postlike_liked_by_user;
DROP INDEX public.index_foreignkey_postcommentlike_parent_post;
DROP INDEX public.index_foreignkey_postcommentlike_liked_postcomment;
DROP INDEX public.index_foreignkey_postcommentlike_liked_by_user;
DROP INDEX public.index_foreignkey_postcomment_reply_to_postcomment;
DROP INDEX public.index_foreignkey_postcomment_parent_post;
DROP INDEX public.index_foreignkey_postcomment_owner_user;
DROP INDEX public.index_foreignkey_post_owner_user;
DROP INDEX public.index_foreignkey_notification_to_user;
DROP INDEX public.index_foreignkey_notification_target_content;
DROP INDEX public.index_foreignkey_hashtagpost_post_owner_user;
DROP INDEX public.index_foreignkey_hashtagpost_post;
DROP INDEX public.index_foreignkey_hashtagpost_hashtag;
DROP INDEX public.index_foreignkey_hashtagfollow_followed_hashtag;
DROP INDEX public.index_foreignkey_hashtagfollow_followed_by_user;
DROP INDEX public.index_foreignkey_collection_owner_user;
ALTER TABLE ONLY public.userfollow DROP CONSTRAINT userfollow_pkey;
ALTER TABLE ONLY public.userblock DROP CONSTRAINT userblock_pkey;
ALTER TABLE ONLY public.postusertag DROP CONSTRAINT postusertag_pkey;
ALTER TABLE ONLY public.postsave DROP CONSTRAINT postsave_pkey;
ALTER TABLE ONLY public.postlike DROP CONSTRAINT postlike_pkey;
ALTER TABLE ONLY public.postcommentlike DROP CONSTRAINT postcommentlike_pkey;
ALTER TABLE ONLY public.postcomment DROP CONSTRAINT postcomment_pkey;
ALTER TABLE ONLY public.post DROP CONSTRAINT post_pkey;
ALTER TABLE ONLY public.notification DROP CONSTRAINT notification_pkey;
ALTER TABLE ONLY public.hashtagpost DROP CONSTRAINT hashtagpost_pkey;
ALTER TABLE ONLY public.hashtagfollow DROP CONSTRAINT hashtagfollow_pkey;
ALTER TABLE ONLY public.hashtag DROP CONSTRAINT hashtag_pkey;
ALTER TABLE ONLY public.collection DROP CONSTRAINT collection_pkey;
ALTER TABLE public.userfollow ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.userblock ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.postusertag ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.postsave ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.postlike ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.postcommentlike ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.postcomment ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.post ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.notification ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.hashtagpost ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.hashtagfollow ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.hashtag ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.collection ALTER COLUMN id DROP DEFAULT;
DROP SEQUENCE public.userrecovery_id_seq;
DROP SEQUENCE public.userfollow_id_seq;
DROP TABLE public.userfollow;
DROP SEQUENCE public.useremailverification_id_seq;
DROP SEQUENCE public.userblock_id_seq;
DROP TABLE public.userblock;
DROP SEQUENCE public.user_id_seq;
DROP SEQUENCE public.setting_id_seq;
DROP SEQUENCE public.postusertag_id_seq;
DROP TABLE public.postusertag;
DROP SEQUENCE public.postsave_id_seq;
DROP TABLE public.postsave;
DROP SEQUENCE public.postlike_id_seq;
DROP TABLE public.postlike;
DROP SEQUENCE public.postcommentlike_id_seq;
DROP TABLE public.postcommentlike;
DROP SEQUENCE public.postcomment_id_seq;
DROP TABLE public.postcomment;
DROP SEQUENCE public.post_id_seq;
DROP TABLE public.post;
DROP SEQUENCE public.notification_id_seq;
DROP TABLE public.notification;
DROP SEQUENCE public.hashtagpost_id_seq;
DROP TABLE public.hashtagpost;
DROP SEQUENCE public.hashtagfollow_id_seq;
DROP TABLE public.hashtagfollow;
DROP SEQUENCE public.hashtag_id_seq;
DROP TABLE public.hashtag;
DROP SEQUENCE public.collection_id_seq;
DROP TABLE public.collection;
DROP SEQUENCE public.admin_id_seq;


--
-- Name: admin_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.admin_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.admin_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: admin_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.admin_id_seq OWNED BY public.admin.id;


--
-- Name: collection; Type: TABLE; Schema: public; Owner: root
--

CREATE TABLE public.collection (
    id integer NOT NULL,
    owner_user_id integer,
    display_title text,
    display_image text,
    stamp_registration timestamp without time zone,
    stamp_last_update timestamp without time zone
);


ALTER TABLE public.collection OWNER TO DATABASE_USERNAME;

--
-- Name: collection_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.collection_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.collection_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: collection_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.collection_id_seq OWNED BY public.collection.id;


--
-- Name: hashtag; Type: TABLE; Schema: public; Owner: root
--

CREATE TABLE public.hashtag (
    id integer NOT NULL,
    display_text text,
    cache_posts_count integer,
    stamp_registration timestamp without time zone,
    stamp_last_update timestamp without time zone
);


ALTER TABLE public.hashtag OWNER TO DATABASE_USERNAME;

--
-- Name: hashtag_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.hashtag_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.hashtag_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: hashtag_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.hashtag_id_seq OWNED BY public.hashtag.id;


--
-- Name: hashtagfollow; Type: TABLE; Schema: public; Owner: root
--

CREATE TABLE public.hashtagfollow (
    id integer NOT NULL,
    followed_hashtag_id integer,
    followed_by_user_id integer,
    stamp_registration timestamp without time zone,
    stamp_last_update timestamp without time zone
);


ALTER TABLE public.hashtagfollow OWNER TO DATABASE_USERNAME;

--
-- Name: hashtagfollow_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.hashtagfollow_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.hashtagfollow_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: hashtagfollow_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.hashtagfollow_id_seq OWNED BY public.hashtagfollow.id;


--
-- Name: hashtagpost; Type: TABLE; Schema: public; Owner: root
--

CREATE TABLE public.hashtagpost (
    id integer NOT NULL,
    hashtag_id integer,
    post_id integer,
    post_owner_user_id integer,
    stamp_registration timestamp without time zone,
    stamp_last_update timestamp without time zone
);


ALTER TABLE public.hashtagpost OWNER TO DATABASE_USERNAME;

--
-- Name: hashtagpost_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.hashtagpost_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.hashtagpost_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: hashtagpost_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.hashtagpost_id_seq OWNED BY public.hashtagpost.id;


--
-- Name: notification; Type: TABLE; Schema: public; Owner: root
--

CREATE TABLE public.notification (
    id integer NOT NULL,
    to_user_id integer,
    target_content_id integer,
    linked_content text,
    meta_type text,
    meta_is_read text,
    meta_is_transient text,
    stamp_registration_date date,
    stamp_registration timestamp without time zone,
    stamp_last_update timestamp without time zone
);


ALTER TABLE public.notification OWNER TO DATABASE_USERNAME;

--
-- Name: notification_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.notification_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.notification_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: notification_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.notification_id_seq OWNED BY public.notification.id;


--
-- Name: post; Type: TABLE; Schema: public; Owner: root
--

CREATE TABLE public.post (
    id integer NOT NULL,
    owner_user_id integer,
    display_caption text,
    display_location text,
    display_content text,
    meta_hashtags text,
    cache_likes_count integer,
    cache_comments_count integer,
    stamp_registration timestamp without time zone,
    stamp_last_update timestamp without time zone
);


ALTER TABLE public.post OWNER TO DATABASE_USERNAME;

--
-- Name: post_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.post_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.post_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: post_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.post_id_seq OWNED BY public.post.id;


--
-- Name: postcomment; Type: TABLE; Schema: public; Owner: root
--

CREATE TABLE public.postcomment (
    id integer NOT NULL,
    owner_user_id integer,
    parent_post_id integer,
    reply_to_postcomment_id integer,
    display_text text,
    cache_likes_count integer,
    cache_comments_count integer,
    stamp_registration timestamp without time zone,
    stamp_last_update timestamp without time zone
);


ALTER TABLE public.postcomment OWNER TO DATABASE_USERNAME;

--
-- Name: postcomment_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.postcomment_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.postcomment_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: postcomment_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.postcomment_id_seq OWNED BY public.postcomment.id;


--
-- Name: postcommentlike; Type: TABLE; Schema: public; Owner: root
--

CREATE TABLE public.postcommentlike (
    id integer NOT NULL,
    liked_by_user_id integer,
    liked_postcomment_id integer,
    parent_post_id integer,
    stamp_registration timestamp without time zone,
    stamp_last_update timestamp without time zone
);


ALTER TABLE public.postcommentlike OWNER TO DATABASE_USERNAME;

--
-- Name: postcommentlike_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.postcommentlike_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.postcommentlike_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: postcommentlike_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.postcommentlike_id_seq OWNED BY public.postcommentlike.id;


--
-- Name: postlike; Type: TABLE; Schema: public; Owner: root
--

CREATE TABLE public.postlike (
    id integer NOT NULL,
    liked_post_id integer,
    liked_by_user_id integer,
    stamp_registration timestamp without time zone,
    stamp_last_update timestamp without time zone
);


ALTER TABLE public.postlike OWNER TO DATABASE_USERNAME;

--
-- Name: postlike_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.postlike_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.postlike_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: postlike_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.postlike_id_seq OWNED BY public.postlike.id;


--
-- Name: postsave; Type: TABLE; Schema: public; Owner: root
--

CREATE TABLE public.postsave (
    id integer NOT NULL,
    saved_post_id integer,
    saved_by_user_id integer,
    saved_to_collection_id integer,
    stamp_registration timestamp without time zone,
    stamp_last_update timestamp without time zone
);


ALTER TABLE public.postsave OWNER TO DATABASE_USERNAME;

--
-- Name: postsave_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.postsave_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.postsave_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: postsave_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.postsave_id_seq OWNED BY public.postsave.id;


--
-- Name: postusertag; Type: TABLE; Schema: public; Owner: root
--

CREATE TABLE public.postusertag (
    id integer NOT NULL,
    tagged_user_id integer,
    tagged_in_post_id integer,
    post_owner_user_id integer,
    stamp_registration timestamp without time zone,
    stamp_last_update timestamp without time zone
);


ALTER TABLE public.postusertag OWNER TO DATABASE_USERNAME;

--
-- Name: postusertag_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.postusertag_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.postusertag_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: postusertag_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.postusertag_id_seq OWNED BY public.postusertag.id;

--
-- Name: setting_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.setting_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.setting_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: setting_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.setting_id_seq OWNED BY public.setting.id;

--
-- Name: user_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.user_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.user_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.user_id_seq OWNED BY public."user".id;


--
-- Name: userblock; Type: TABLE; Schema: public; Owner: root
--

CREATE TABLE public.userblock (
    id integer NOT NULL,
    blocked_user_id integer,
    blocked_by_user_id integer,
    stamp_registration timestamp without time zone,
    stamp_last_update timestamp without time zone
);


ALTER TABLE public.userblock OWNER TO DATABASE_USERNAME;

--
-- Name: userblock_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.userblock_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.userblock_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: userblock_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.userblock_id_seq OWNED BY public.userblock.id;

--
-- Name: useremailverification_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.useremailverification_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.useremailverification_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: useremailverification_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.useremailverification_id_seq OWNED BY public.useremailverification.id;


--
-- Name: userfollow; Type: TABLE; Schema: public; Owner: root
--

CREATE TABLE public.userfollow (
    id integer NOT NULL,
    followed_user_id integer,
    followed_by_user_id integer,
    meta_is_pending text,
    stamp_registration timestamp without time zone,
    stamp_last_update timestamp without time zone
);


ALTER TABLE public.userfollow OWNER TO DATABASE_USERNAME;

--
-- Name: userfollow_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.userfollow_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.userfollow_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: userfollow_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.userfollow_id_seq OWNED BY public.userfollow.id;

--
-- Name: userrecovery_id_seq; Type: SEQUENCE; Schema: public; Owner: root
--

CREATE SEQUENCE public.userrecovery_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.userrecovery_id_seq OWNER TO DATABASE_USERNAME;

--
-- Name: userrecovery_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root
--

ALTER SEQUENCE public.userrecovery_id_seq OWNED BY public.userrecovery.id;


--
-- Name: collection id; Type: DEFAULT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.collection ALTER COLUMN id SET DEFAULT nextval('public.collection_id_seq'::regclass);


--
-- Name: hashtag id; Type: DEFAULT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.hashtag ALTER COLUMN id SET DEFAULT nextval('public.hashtag_id_seq'::regclass);


--
-- Name: hashtagfollow id; Type: DEFAULT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.hashtagfollow ALTER COLUMN id SET DEFAULT nextval('public.hashtagfollow_id_seq'::regclass);


--
-- Name: hashtagpost id; Type: DEFAULT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.hashtagpost ALTER COLUMN id SET DEFAULT nextval('public.hashtagpost_id_seq'::regclass);


--
-- Name: notification id; Type: DEFAULT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.notification ALTER COLUMN id SET DEFAULT nextval('public.notification_id_seq'::regclass);


--
-- Name: post id; Type: DEFAULT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.post ALTER COLUMN id SET DEFAULT nextval('public.post_id_seq'::regclass);


--
-- Name: postcomment id; Type: DEFAULT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.postcomment ALTER COLUMN id SET DEFAULT nextval('public.postcomment_id_seq'::regclass);


--
-- Name: postcommentlike id; Type: DEFAULT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.postcommentlike ALTER COLUMN id SET DEFAULT nextval('public.postcommentlike_id_seq'::regclass);


--
-- Name: postlike id; Type: DEFAULT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.postlike ALTER COLUMN id SET DEFAULT nextval('public.postlike_id_seq'::regclass);


--
-- Name: postsave id; Type: DEFAULT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.postsave ALTER COLUMN id SET DEFAULT nextval('public.postsave_id_seq'::regclass);


--
-- Name: postusertag id; Type: DEFAULT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.postusertag ALTER COLUMN id SET DEFAULT nextval('public.postusertag_id_seq'::regclass);


--
-- Name: userblock id; Type: DEFAULT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.userblock ALTER COLUMN id SET DEFAULT nextval('public.userblock_id_seq'::regclass);


--
-- Name: userfollow id; Type: DEFAULT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.userfollow ALTER COLUMN id SET DEFAULT nextval('public.userfollow_id_seq'::regclass);


--
-- Name: collection collection_pkey; Type: CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.collection
    ADD CONSTRAINT collection_pkey PRIMARY KEY (id);


--
-- Name: hashtag hashtag_pkey; Type: CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.hashtag
    ADD CONSTRAINT hashtag_pkey PRIMARY KEY (id);


--
-- Name: hashtagfollow hashtagfollow_pkey; Type: CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.hashtagfollow
    ADD CONSTRAINT hashtagfollow_pkey PRIMARY KEY (id);


--
-- Name: hashtagpost hashtagpost_pkey; Type: CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.hashtagpost
    ADD CONSTRAINT hashtagpost_pkey PRIMARY KEY (id);


--
-- Name: notification notification_pkey; Type: CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.notification
    ADD CONSTRAINT notification_pkey PRIMARY KEY (id);


--
-- Name: post post_pkey; Type: CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.post
    ADD CONSTRAINT post_pkey PRIMARY KEY (id);


--
-- Name: postcomment postcomment_pkey; Type: CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.postcomment
    ADD CONSTRAINT postcomment_pkey PRIMARY KEY (id);


--
-- Name: postcommentlike postcommentlike_pkey; Type: CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.postcommentlike
    ADD CONSTRAINT postcommentlike_pkey PRIMARY KEY (id);


--
-- Name: postlike postlike_pkey; Type: CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.postlike
    ADD CONSTRAINT postlike_pkey PRIMARY KEY (id);


--
-- Name: postsave postsave_pkey; Type: CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.postsave
    ADD CONSTRAINT postsave_pkey PRIMARY KEY (id);


--
-- Name: postusertag postusertag_pkey; Type: CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.postusertag
    ADD CONSTRAINT postusertag_pkey PRIMARY KEY (id);


--
-- Name: userblock userblock_pkey; Type: CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.userblock
    ADD CONSTRAINT userblock_pkey PRIMARY KEY (id);


--
-- Name: userfollow userfollow_pkey; Type: CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.userfollow
    ADD CONSTRAINT userfollow_pkey PRIMARY KEY (id);


--
-- Name: index_foreignkey_collection_owner_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_collection_owner_user ON public.collection USING btree (owner_user_id);


--
-- Name: index_foreignkey_hashtagfollow_followed_by_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_hashtagfollow_followed_by_user ON public.hashtagfollow USING btree (followed_by_user_id);


--
-- Name: index_foreignkey_hashtagfollow_followed_hashtag; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_hashtagfollow_followed_hashtag ON public.hashtagfollow USING btree (followed_hashtag_id);


--
-- Name: index_foreignkey_hashtagpost_hashtag; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_hashtagpost_hashtag ON public.hashtagpost USING btree (hashtag_id);


--
-- Name: index_foreignkey_hashtagpost_post; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_hashtagpost_post ON public.hashtagpost USING btree (post_id);


--
-- Name: index_foreignkey_hashtagpost_post_owner_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_hashtagpost_post_owner_user ON public.hashtagpost USING btree (post_owner_user_id);


--
-- Name: index_foreignkey_notification_target_content; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_notification_target_content ON public.notification USING btree (target_content_id);


--
-- Name: index_foreignkey_notification_to_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_notification_to_user ON public.notification USING btree (to_user_id);


--
-- Name: index_foreignkey_post_owner_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_post_owner_user ON public.post USING btree (owner_user_id);


--
-- Name: index_foreignkey_postcomment_owner_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_postcomment_owner_user ON public.postcomment USING btree (owner_user_id);


--
-- Name: index_foreignkey_postcomment_parent_post; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_postcomment_parent_post ON public.postcomment USING btree (parent_post_id);


--
-- Name: index_foreignkey_postcomment_reply_to_postcomment; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_postcomment_reply_to_postcomment ON public.postcomment USING btree (reply_to_postcomment_id);


--
-- Name: index_foreignkey_postcommentlike_liked_by_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_postcommentlike_liked_by_user ON public.postcommentlike USING btree (liked_by_user_id);


--
-- Name: index_foreignkey_postcommentlike_liked_postcomment; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_postcommentlike_liked_postcomment ON public.postcommentlike USING btree (liked_postcomment_id);


--
-- Name: index_foreignkey_postcommentlike_parent_post; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_postcommentlike_parent_post ON public.postcommentlike USING btree (parent_post_id);


--
-- Name: index_foreignkey_postlike_liked_by_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_postlike_liked_by_user ON public.postlike USING btree (liked_by_user_id);


--
-- Name: index_foreignkey_postlike_liked_post; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_postlike_liked_post ON public.postlike USING btree (liked_post_id);


--
-- Name: index_foreignkey_postsave_saved_by_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_postsave_saved_by_user ON public.postsave USING btree (saved_by_user_id);


--
-- Name: index_foreignkey_postsave_saved_post; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_postsave_saved_post ON public.postsave USING btree (saved_post_id);


--
-- Name: index_foreignkey_postsave_saved_to_collection; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_postsave_saved_to_collection ON public.postsave USING btree (saved_to_collection_id);


--
-- Name: index_foreignkey_postusertag_post_owner_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_postusertag_post_owner_user ON public.postusertag USING btree (post_owner_user_id);


--
-- Name: index_foreignkey_postusertag_tagged_in_post; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_postusertag_tagged_in_post ON public.postusertag USING btree (tagged_in_post_id);


--
-- Name: index_foreignkey_postusertag_tagged_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_postusertag_tagged_user ON public.postusertag USING btree (tagged_user_id);


--
-- Name: index_foreignkey_userblock_blocked_by_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_userblock_blocked_by_user ON public.userblock USING btree (blocked_by_user_id);


--
-- Name: index_foreignkey_userblock_blocked_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_userblock_blocked_user ON public.userblock USING btree (blocked_user_id);


--
-- Name: index_foreignkey_userfollow_followed_by_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_userfollow_followed_by_user ON public.userfollow USING btree (followed_by_user_id);


--
-- Name: index_foreignkey_userfollow_followed_user; Type: INDEX; Schema: public; Owner: root
--

CREATE INDEX index_foreignkey_userfollow_followed_user ON public.userfollow USING btree (followed_user_id);


--
-- Name: hashtagpost hashtagpost_hashtag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.hashtagpost
    ADD CONSTRAINT hashtagpost_hashtag_id_fkey FOREIGN KEY (hashtag_id) REFERENCES public.hashtag(id) ON UPDATE SET NULL ON DELETE SET NULL DEFERRABLE;


--
-- Name: hashtagpost hashtagpost_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: root
--

ALTER TABLE ONLY public.hashtagpost
    ADD CONSTRAINT hashtagpost_post_id_fkey FOREIGN KEY (post_id) REFERENCES public.post(id) ON UPDATE SET NULL ON DELETE SET NULL DEFERRABLE;


--
--

