Files
solidtime/database/schema/pgsql_test-schema.sql
2025-10-21 12:36:32 +02:00

1141 lines
30 KiB
SQL

--
-- PostgreSQL database dump
--
-- Dumped from database version 15.6 (Debian 15.6-1.pgdg120+2)
-- Dumped by pg_dump version 15.7 (Ubuntu 15.7-1.pgdg22.04+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: cache; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.cache (
key character varying(255) NOT NULL,
value text NOT NULL,
expiration integer NOT NULL
);
--
-- Name: cache_locks; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.cache_locks (
key character varying(255) NOT NULL,
owner character varying(255) NOT NULL,
expiration integer NOT NULL
);
--
-- Name: clients; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.clients (
id uuid NOT NULL,
name character varying(255) NOT NULL,
organization_id uuid NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
--
-- Name: customers; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.customers (
id uuid NOT NULL,
billable_id uuid NOT NULL,
billable_type character varying(255) NOT NULL,
paddle_id character varying(255) NOT NULL,
name character varying(255) NOT NULL,
email character varying(255) NOT NULL,
trial_ends_at timestamp(0) without time zone,
pending_checkout_id character varying(255),
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
--
-- Name: failed_jobs; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.failed_jobs (
id uuid NOT NULL,
uuid uuid NOT NULL,
connection text NOT NULL,
queue text NOT NULL,
payload text NOT NULL,
exception text NOT NULL,
failed_at timestamp(0) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);
--
-- Name: jobs; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.jobs (
id bigint NOT NULL,
queue character varying(255) NOT NULL,
payload text NOT NULL,
attempts smallint NOT NULL,
reserved_at integer,
available_at integer NOT NULL,
created_at integer NOT NULL
);
--
-- Name: jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.jobs_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.jobs_id_seq OWNED BY public.jobs.id;
--
-- Name: members; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.members (
id uuid NOT NULL,
organization_id uuid NOT NULL,
user_id uuid NOT NULL,
role character varying(255),
billable_rate integer,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
--
-- Name: migrations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.migrations (
id integer NOT NULL,
migration character varying(255) NOT NULL,
batch integer NOT NULL
);
--
-- Name: migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.migrations_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: migrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.migrations_id_seq OWNED BY public.migrations.id;
--
-- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.oauth_access_tokens (
id character varying(100) NOT NULL,
user_id uuid,
client_id uuid NOT NULL,
name character varying(255),
scopes text,
revoked boolean NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
expires_at timestamp(0) without time zone
);
--
-- Name: oauth_auth_codes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.oauth_auth_codes (
id character varying(100) NOT NULL,
user_id uuid NOT NULL,
client_id uuid NOT NULL,
scopes text,
revoked boolean NOT NULL,
expires_at timestamp(0) without time zone
);
--
-- Name: oauth_clients; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.oauth_clients (
id uuid NOT NULL,
user_id uuid,
name character varying(255) NOT NULL,
secret character varying(100),
provider character varying(255),
redirect text NOT NULL,
personal_access_client boolean NOT NULL,
password_client boolean NOT NULL,
revoked boolean NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
--
-- Name: oauth_personal_access_clients; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.oauth_personal_access_clients (
id bigint NOT NULL,
client_id uuid NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
--
-- Name: oauth_personal_access_clients_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.oauth_personal_access_clients_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: oauth_personal_access_clients_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.oauth_personal_access_clients_id_seq OWNED BY public.oauth_personal_access_clients.id;
--
-- Name: oauth_refresh_tokens; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.oauth_refresh_tokens (
id character varying(100) NOT NULL,
access_token_id character varying(100) NOT NULL,
revoked boolean NOT NULL,
expires_at timestamp(0) without time zone
);
--
-- Name: organization_invitations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.organization_invitations (
id uuid NOT NULL,
organization_id uuid NOT NULL,
email character varying(255) NOT NULL,
role character varying(255),
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
--
-- Name: organizations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.organizations (
id uuid NOT NULL,
user_id uuid NOT NULL,
name character varying(255) NOT NULL,
personal_team boolean NOT NULL,
billable_rate integer,
currency character varying(3) NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
--
-- Name: password_reset_tokens; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.password_reset_tokens (
email character varying(255) NOT NULL,
token character varying(255) NOT NULL,
created_at timestamp(0) without time zone
);
--
-- Name: personal_access_tokens; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.personal_access_tokens (
id uuid NOT NULL,
tokenable_type character varying(255) NOT NULL,
tokenable_id bigint NOT NULL,
name character varying(255) NOT NULL,
token character varying(64) NOT NULL,
abilities text,
last_used_at timestamp(0) without time zone,
expires_at timestamp(0) without time zone,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
--
-- Name: project_members; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.project_members (
id uuid NOT NULL,
billable_rate integer,
project_id uuid NOT NULL,
user_id uuid NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
member_id uuid NOT NULL
);
--
-- Name: projects; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.projects (
id uuid NOT NULL,
name character varying(255) NOT NULL,
color character varying(16) NOT NULL,
billable_rate integer,
is_public boolean DEFAULT false NOT NULL,
client_id uuid,
organization_id uuid NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
is_billable boolean NOT NULL
);
--
-- Name: sessions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.sessions (
id character varying(255) NOT NULL,
user_id uuid,
ip_address character varying(45),
user_agent text,
payload text NOT NULL,
last_activity integer NOT NULL
);
--
-- Name: subscription_items; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.subscription_items (
id uuid NOT NULL,
subscription_id uuid NOT NULL,
product_id character varying(255) NOT NULL,
price_id character varying(255) NOT NULL,
status character varying(255) NOT NULL,
quantity integer NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
--
-- Name: subscriptions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.subscriptions (
id uuid NOT NULL,
billable_id uuid NOT NULL,
billable_type character varying(255) NOT NULL,
type character varying(255) NOT NULL,
paddle_id character varying(255) NOT NULL,
status character varying(255) NOT NULL,
trial_ends_at timestamp(0) without time zone,
paused_at timestamp(0) without time zone,
ends_at timestamp(0) without time zone,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
--
-- Name: tags; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.tags (
id uuid NOT NULL,
name character varying(255) NOT NULL,
organization_id uuid NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
--
-- Name: tasks; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.tasks (
id uuid NOT NULL,
name character varying(500) NOT NULL,
project_id uuid NOT NULL,
organization_id uuid NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
--
-- Name: time_entries; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.time_entries (
id uuid NOT NULL,
description character varying(5000) NOT NULL,
start timestamp(0) without time zone NOT NULL,
"end" timestamp(0) without time zone,
billable_rate integer,
billable boolean DEFAULT false NOT NULL,
user_id uuid NOT NULL,
organization_id uuid NOT NULL,
project_id uuid,
task_id uuid,
tags jsonb,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
member_id uuid NOT NULL,
client_id uuid,
is_imported boolean DEFAULT false NOT NULL
);
--
-- Name: transactions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.transactions (
id uuid NOT NULL,
billable_id uuid NOT NULL,
billable_type character varying(255) NOT NULL,
paddle_id character varying(255) NOT NULL,
paddle_subscription_id character varying(255),
invoice_number character varying(255),
status character varying(255) NOT NULL,
total character varying(255) NOT NULL,
tax character varying(255) NOT NULL,
currency character varying(3) NOT NULL,
billed_at timestamp(0) without time zone NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
--
-- Name: users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.users (
id uuid NOT NULL,
name character varying(255) NOT NULL,
email character varying(255) NOT NULL,
email_verified_at timestamp(0) without time zone,
password character varying(255),
remember_token character varying(100),
is_placeholder boolean DEFAULT false NOT NULL,
current_team_id uuid,
profile_photo_path character varying(2048),
timezone character varying(255) NOT NULL,
week_start character varying(255) NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
two_factor_secret text,
two_factor_recovery_codes text,
two_factor_confirmed_at timestamp(0) without time zone,
CONSTRAINT users_week_start_check CHECK (((week_start)::text = ANY ((ARRAY['monday'::character varying, 'tuesday'::character varying, 'wednesday'::character varying, 'thursday'::character varying, 'friday'::character varying, 'saturday'::character varying, 'sunday'::character varying])::text[])))
);
--
-- Name: jobs id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.jobs ALTER COLUMN id SET DEFAULT nextval('public.jobs_id_seq'::regclass);
--
-- Name: migrations id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.migrations ALTER COLUMN id SET DEFAULT nextval('public.migrations_id_seq'::regclass);
--
-- Name: oauth_personal_access_clients id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.oauth_personal_access_clients ALTER COLUMN id SET DEFAULT nextval('public.oauth_personal_access_clients_id_seq'::regclass);
--
-- Name: cache_locks cache_locks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.cache_locks
ADD CONSTRAINT cache_locks_pkey PRIMARY KEY (key);
--
-- Name: cache cache_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.cache
ADD CONSTRAINT cache_pkey PRIMARY KEY (key);
--
-- Name: clients clients_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.clients
ADD CONSTRAINT clients_pkey PRIMARY KEY (id);
--
-- Name: customers customers_paddle_id_unique; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.customers
ADD CONSTRAINT customers_paddle_id_unique UNIQUE (paddle_id);
--
-- Name: customers customers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.customers
ADD CONSTRAINT customers_pkey PRIMARY KEY (id);
--
-- Name: failed_jobs failed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.failed_jobs
ADD CONSTRAINT failed_jobs_pkey PRIMARY KEY (id);
--
-- Name: failed_jobs failed_jobs_uuid_unique; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.failed_jobs
ADD CONSTRAINT failed_jobs_uuid_unique UNIQUE (uuid);
--
-- Name: jobs jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.jobs
ADD CONSTRAINT jobs_pkey PRIMARY KEY (id);
--
-- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.migrations
ADD CONSTRAINT migrations_pkey PRIMARY KEY (id);
--
-- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.oauth_access_tokens
ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
--
-- Name: oauth_auth_codes oauth_auth_codes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.oauth_auth_codes
ADD CONSTRAINT oauth_auth_codes_pkey PRIMARY KEY (id);
--
-- Name: oauth_clients oauth_clients_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.oauth_clients
ADD CONSTRAINT oauth_clients_pkey PRIMARY KEY (id);
--
-- Name: oauth_personal_access_clients oauth_personal_access_clients_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.oauth_personal_access_clients
ADD CONSTRAINT oauth_personal_access_clients_pkey PRIMARY KEY (id);
--
-- Name: oauth_refresh_tokens oauth_refresh_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.oauth_refresh_tokens
ADD CONSTRAINT oauth_refresh_tokens_pkey PRIMARY KEY (id);
--
-- Name: organization_invitations organization_invitations_organization_id_email_unique; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.organization_invitations
ADD CONSTRAINT organization_invitations_organization_id_email_unique UNIQUE (organization_id, email);
--
-- Name: organization_invitations organization_invitations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.organization_invitations
ADD CONSTRAINT organization_invitations_pkey PRIMARY KEY (id);
--
-- Name: members organization_user_organization_id_user_id_unique; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.members
ADD CONSTRAINT organization_user_organization_id_user_id_unique UNIQUE (organization_id, user_id);
--
-- Name: members organization_user_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.members
ADD CONSTRAINT organization_user_pkey PRIMARY KEY (id);
--
-- Name: organizations organizations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.organizations
ADD CONSTRAINT organizations_pkey PRIMARY KEY (id);
--
-- Name: password_reset_tokens password_reset_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.password_reset_tokens
ADD CONSTRAINT password_reset_tokens_pkey PRIMARY KEY (email);
--
-- Name: personal_access_tokens personal_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.personal_access_tokens
ADD CONSTRAINT personal_access_tokens_pkey PRIMARY KEY (id);
--
-- Name: personal_access_tokens personal_access_tokens_token_unique; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.personal_access_tokens
ADD CONSTRAINT personal_access_tokens_token_unique UNIQUE (token);
--
-- Name: project_members project_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.project_members
ADD CONSTRAINT project_members_pkey PRIMARY KEY (id);
--
-- Name: project_members project_members_project_id_user_id_unique; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.project_members
ADD CONSTRAINT project_members_project_id_user_id_unique UNIQUE (project_id, user_id);
--
-- Name: projects projects_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.projects
ADD CONSTRAINT projects_pkey PRIMARY KEY (id);
--
-- Name: sessions sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.sessions
ADD CONSTRAINT sessions_pkey PRIMARY KEY (id);
--
-- Name: subscription_items subscription_items_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_items
ADD CONSTRAINT subscription_items_pkey PRIMARY KEY (id);
--
-- Name: subscription_items subscription_items_subscription_id_price_id_unique; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_items
ADD CONSTRAINT subscription_items_subscription_id_price_id_unique UNIQUE (subscription_id, price_id);
--
-- Name: subscriptions subscriptions_paddle_id_unique; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscriptions
ADD CONSTRAINT subscriptions_paddle_id_unique UNIQUE (paddle_id);
--
-- Name: subscriptions subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscriptions
ADD CONSTRAINT subscriptions_pkey PRIMARY KEY (id);
--
-- Name: tags tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.tags
ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
--
-- Name: tasks tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.tasks
ADD CONSTRAINT tasks_pkey PRIMARY KEY (id);
--
-- Name: time_entries time_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.time_entries
ADD CONSTRAINT time_entries_pkey PRIMARY KEY (id);
--
-- Name: transactions transactions_paddle_id_unique; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.transactions
ADD CONSTRAINT transactions_paddle_id_unique UNIQUE (paddle_id);
--
-- Name: transactions transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.transactions
ADD CONSTRAINT transactions_pkey PRIMARY KEY (id);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: customers_billable_id_billable_type_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX customers_billable_id_billable_type_index ON public.customers USING btree (billable_id, billable_type);
--
-- Name: jobs_queue_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX jobs_queue_index ON public.jobs USING btree (queue);
--
-- Name: oauth_access_tokens_user_id_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX oauth_access_tokens_user_id_index ON public.oauth_access_tokens USING btree (user_id);
--
-- Name: oauth_auth_codes_user_id_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX oauth_auth_codes_user_id_index ON public.oauth_auth_codes USING btree (user_id);
--
-- Name: oauth_clients_user_id_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX oauth_clients_user_id_index ON public.oauth_clients USING btree (user_id);
--
-- Name: oauth_refresh_tokens_access_token_id_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX oauth_refresh_tokens_access_token_id_index ON public.oauth_refresh_tokens USING btree (access_token_id);
--
-- Name: organizations_user_id_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX organizations_user_id_index ON public.organizations USING btree (user_id);
--
-- Name: personal_access_tokens_tokenable_type_tokenable_id_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX personal_access_tokens_tokenable_type_tokenable_id_index ON public.personal_access_tokens USING btree (tokenable_type, tokenable_id);
--
-- Name: sessions_last_activity_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX sessions_last_activity_index ON public.sessions USING btree (last_activity);
--
-- Name: sessions_user_id_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX sessions_user_id_index ON public.sessions USING btree (user_id);
--
-- Name: subscriptions_billable_id_billable_type_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX subscriptions_billable_id_billable_type_index ON public.subscriptions USING btree (billable_id, billable_type);
--
-- Name: tags_created_at_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX tags_created_at_index ON public.tags USING btree (created_at);
--
-- Name: time_entries_billable_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX time_entries_billable_index ON public.time_entries USING btree (billable);
--
-- Name: time_entries_end_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX time_entries_end_index ON public.time_entries USING btree ("end");
--
-- Name: time_entries_start_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX time_entries_start_index ON public.time_entries USING btree (start);
--
-- Name: transactions_billable_id_billable_type_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX transactions_billable_id_billable_type_index ON public.transactions USING btree (billable_id, billable_type);
--
-- Name: transactions_paddle_subscription_id_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX transactions_paddle_subscription_id_index ON public.transactions USING btree (paddle_subscription_id);
--
-- Name: users_email_unique; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX users_email_unique ON public.users USING btree (email) WHERE (is_placeholder = false);
--
-- Name: clients clients_organization_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.clients
ADD CONSTRAINT clients_organization_id_foreign FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: organization_invitations organization_invitations_organization_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.organization_invitations
ADD CONSTRAINT organization_invitations_organization_id_foreign FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: project_members project_members_member_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.project_members
ADD CONSTRAINT project_members_member_id_foreign FOREIGN KEY (member_id) REFERENCES public.members(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: project_members project_members_project_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.project_members
ADD CONSTRAINT project_members_project_id_foreign FOREIGN KEY (project_id) REFERENCES public.projects(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: project_members project_members_user_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.project_members
ADD CONSTRAINT project_members_user_id_foreign FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: projects projects_client_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.projects
ADD CONSTRAINT projects_client_id_foreign FOREIGN KEY (client_id) REFERENCES public.clients(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: projects projects_organization_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.projects
ADD CONSTRAINT projects_organization_id_foreign FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: tags tags_organization_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.tags
ADD CONSTRAINT tags_organization_id_foreign FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: tasks tasks_organization_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.tasks
ADD CONSTRAINT tasks_organization_id_foreign FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: tasks tasks_project_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.tasks
ADD CONSTRAINT tasks_project_id_foreign FOREIGN KEY (project_id) REFERENCES public.projects(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: time_entries time_entries_client_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.time_entries
ADD CONSTRAINT time_entries_client_id_foreign FOREIGN KEY (client_id) REFERENCES public.clients(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: time_entries time_entries_member_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.time_entries
ADD CONSTRAINT time_entries_member_id_foreign FOREIGN KEY (member_id) REFERENCES public.members(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: time_entries time_entries_organization_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.time_entries
ADD CONSTRAINT time_entries_organization_id_foreign FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: time_entries time_entries_project_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.time_entries
ADD CONSTRAINT time_entries_project_id_foreign FOREIGN KEY (project_id) REFERENCES public.projects(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: time_entries time_entries_task_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.time_entries
ADD CONSTRAINT time_entries_task_id_foreign FOREIGN KEY (task_id) REFERENCES public.tasks(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: time_entries time_entries_user_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.time_entries
ADD CONSTRAINT time_entries_user_id_foreign FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.6 (Debian 15.6-1.pgdg120+2)
-- Dumped by pg_dump version 15.7 (Ubuntu 15.7-1.pgdg22.04+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- Data for Name: migrations; Type: TABLE DATA; Schema: public; Owner: -
--
COPY public.migrations (id, migration, batch) FROM stdin;
1 2014_10_12_000000_create_users_table 1
2 2014_10_12_100000_create_password_reset_tokens_table 1
3 2014_10_12_200000_add_two_factor_columns_to_users_table 1
4 2016_06_01_000001_create_oauth_auth_codes_table 1
5 2016_06_01_000002_create_oauth_access_tokens_table 1
6 2016_06_01_000003_create_oauth_refresh_tokens_table 1
7 2016_06_01_000004_create_oauth_clients_table 1
8 2016_06_01_000005_create_oauth_personal_access_clients_table 1
9 2018_08_08_100000_create_telescope_entries_table 1
10 2019_05_03_000001_create_customers_table 1
11 2019_05_03_000002_create_subscriptions_table 1
12 2019_05_03_000003_create_subscription_items_table 1
13 2019_05_03_000004_create_transactions_table 1
14 2019_08_19_000000_create_failed_jobs_table 1
15 2019_12_14_000001_create_personal_access_tokens_table 1
16 2020_05_21_100000_create_organizations_table 1
17 2020_05_21_200000_create_organization_user_table 1
18 2020_05_21_300000_create_organization_invitations_table 1
19 2024_01_16_161030_create_sessions_table 1
20 2024_01_20_110218_create_clients_table 1
21 2024_01_20_110439_create_projects_table 1
22 2024_01_20_110444_create_tasks_table 1
23 2024_01_20_110452_create_tags_table 1
24 2024_01_20_110837_create_time_entries_table 1
25 2024_03_26_171253_create_project_members_table 1
26 2024_04_11_150130_create_jobs_table 1
27 2024_04_12_095010_create_cache_table 1
28 2024_05_07_134711_move_from_user_id_to_member_id_in_project_members_table 1
29 2024_05_07_141842_move_from_user_id_to_member_id_in_time_entries_table 1
30 2024_05_13_171020_rename_table_organization_user_to_members 1
31 2024_05_22_151226_add_client_id_to_time_entries_table 1
32 2024_05_30_175801_add_is_billable_column_to_projects_table 1
33 2024_05_30_175825_add_is_imported_column_to_time_entries_table 1
34 2024_06_07_113443_change_member_id_foreign_keys_to_restrict_on_delete 1
35 2024_06_10_161831_reset_billable_rates_with_zero_as_value 1
\.
--
-- Name: migrations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('public.migrations_id_seq', 35, true);
--
-- PostgreSQL database dump complete
--