
ALTER TABLE IF EXISTS ONLY public.password_reset_codes DROP CONSTRAINT IF EXISTS password_reset_codes_user_id_fkey;
DROP INDEX IF EXISTS public.idx_subscription_lookup;
DROP INDEX IF EXISTS public.idx_password_reset_codes_user_id;
DROP INDEX IF EXISTS public.idx_password_reset_codes_expires_at;
DROP INDEX IF EXISTS public.idx_api_key_lookup;
ALTER TABLE IF EXISTS ONLY public.password_reset_codes DROP CONSTRAINT IF EXISTS password_reset_codes_user_id_key;
ALTER TABLE IF EXISTS ONLY public.password_reset_codes DROP CONSTRAINT IF EXISTS password_reset_codes_pkey;
ALTER TABLE IF EXISTS public.password_reset_codes ALTER COLUMN id DROP DEFAULT;
DROP SEQUENCE IF EXISTS public.scan_history_id_seq;
DROP SEQUENCE IF EXISTS public.password_reset_codes_id_seq;
DROP SEQUENCE IF EXISTS public.api_key_id_seq1;
DROP SEQUENCE IF EXISTS public.api_key_id_seq;


--
-- Name: api_key_id_seq; Type: SEQUENCE; Schema: public; Owner: websentinel_user
--

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


ALTER TABLE public.api_key_id_seq OWNER TO websentinel_user;

--
-- Name: api_key_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: websentinel_user
--

ALTER SEQUENCE public.api_key_id_seq OWNED BY public.users.id;


--
-- Name: api_key_id_seq1; Type: SEQUENCE; Schema: public; Owner: websentinel_user
--

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


ALTER TABLE public.api_key_id_seq1 OWNER TO websentinel_user;

--
-- Name: api_key_id_seq1; Type: SEQUENCE OWNED BY; Schema: public; Owner: websentinel_user
--

ALTER SEQUENCE public.api_key_id_seq1 OWNED BY public.api_key.id;


--
-- Name: password_reset_codes; Type: TABLE; Schema: public; Owner: websentinel_user
--

CREATE TABLE public.password_reset_codes (
    id integer NOT NULL,
    user_id integer NOT NULL,
    code character varying(6) NOT NULL,
    expires_at timestamp without time zone NOT NULL,
    used boolean DEFAULT false,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.password_reset_codes OWNER TO websentinel_user;

--
-- Name: password_reset_codes_id_seq; Type: SEQUENCE; Schema: public; Owner: websentinel_user
--

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


ALTER TABLE public.password_reset_codes_id_seq OWNER TO websentinel_user;

--
-- Name: password_reset_codes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: websentinel_user
--

ALTER SEQUENCE public.password_reset_codes_id_seq OWNED BY public.password_reset_codes.id;

--
-- Name: scan_history_id_seq; Type: SEQUENCE; Schema: public; Owner: websentinel_user
--

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


ALTER TABLE public.scan_history_id_seq OWNER TO websentinel_user;

--
-- Name: scan_history_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: websentinel_user
--

ALTER SEQUENCE public.scan_history_id_seq OWNED BY public.scans.id;


--
-- Name: password_reset_codes id; Type: DEFAULT; Schema: public; Owner: websentinel_user
--

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

--
-- Data for Name: password_reset_codes; Type: TABLE DATA; Schema: public; Owner: websentinel_user
--

COPY public.password_reset_codes (id, user_id, code, expires_at, used, created_at) FROM stdin;
1	4	086780	2025-11-06 13:58:34.638966	f	2025-11-06 12:50:47.891881
16	21	979744	2025-11-06 14:10:05.664853	f	2025-11-06 13:35:22.590359
17	22	858431	2025-11-06 14:10:29.318347	f	2025-11-06 13:35:37.503563
\.



--
-- Name: password_reset_codes password_reset_codes_pkey; Type: CONSTRAINT; Schema: public; Owner: websentinel_user
--

ALTER TABLE ONLY public.password_reset_codes
    ADD CONSTRAINT password_reset_codes_pkey PRIMARY KEY (id);


--
-- Name: password_reset_codes password_reset_codes_user_id_key; Type: CONSTRAINT; Schema: public; Owner: websentinel_user
--

ALTER TABLE ONLY public.password_reset_codes
    ADD CONSTRAINT password_reset_codes_user_id_key UNIQUE (user_id);


--
-- Name: idx_password_reset_codes_expires_at; Type: INDEX; Schema: public; Owner: websentinel_user
--

CREATE INDEX idx_password_reset_codes_expires_at ON public.password_reset_codes USING btree (expires_at);


--
-- Name: idx_password_reset_codes_user_id; Type: INDEX; Schema: public; Owner: websentinel_user
--

CREATE INDEX idx_password_reset_codes_user_id ON public.password_reset_codes USING btree (user_id);


--
-- Name: password_reset_codes password_reset_codes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: websentinel_user
--

ALTER TABLE ONLY public.password_reset_codes
    ADD CONSTRAINT password_reset_codes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;