Skip to content

Commit

Permalink
Merge pull request #143 from codex-team/migrations-add-teams-table
Browse files Browse the repository at this point in the history
[feat] added migration for teams table
  • Loading branch information
e11sy authored Nov 30, 2023
2 parents cdf8910 + c15c455 commit 65931bf
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions migrations/tenant/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
--
-- Name: teams; Type: TABLE; Schema: public; Owner: codex
--

CREATE TABLE IF NOT EXISTS public.teams (
id integer NOT NULL,
user_id integer NOT NULL,
note_id integer NOT NULL,
role integer NOT NULL
);

--
-- Name: teams relation_id_pkey; Type: PK CONSTRAINT; Schema: public; Owner: codex
--
ALTER TABLE public.teams DROP CONSTRAINT IF EXISTS relation_id_pkey;
ALTER TABLE public.teams
ADD CONSTRAINT relation_id_pkey PRIMARY KEY (id);

--
-- Name: teams user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: codex
--
ALTER TABLE public.teams DROP CONSTRAINT IF EXISTS user_id_fkey;
ALTER TABLE public.teams
ADD CONSTRAINT user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id)
ON UPDATE CASCADE ON DELETE CASCADE;

--
-- Name: teams note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: codex
--
ALTER TABLE public.teams DROP CONSTRAINT IF EXISTS note_id_fkey;
ALTER TABLE public.teams
ADD CONSTRAINT note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id)
ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE public.teams OWNER TO codex;

0 comments on commit 65931bf

Please sign in to comment.