-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Guillaume Hivert <[email protected]>
- Loading branch information
Showing
6 changed files
with
241 additions
and
1 deletion.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
apps/backend/db/migrations/20240412153209_create_extensions.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- migrate:up | ||
create extension if not exists "uuid-ossp"; | ||
create extension if not exists "moddatetime"; | ||
|
||
-- migrate:down | ||
drop extension if exists "uuid-ossp"; | ||
drop extension if exists "moddatetime"; |
10 changes: 10 additions & 0 deletions
10
apps/backend/db/migrations/20240412154007_create_packages_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- migrate:up | ||
create table package ( | ||
id integer primary key generated always as identity, | ||
name text not null, | ||
repository text, | ||
documentation text | ||
); | ||
|
||
-- migrate:down | ||
drop table package; |
9 changes: 9 additions & 0 deletions
9
apps/backend/db/migrations/20240412154430_create_package_version.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- migrate:up | ||
create table package_version ( | ||
id integer primary key generated always as identity, | ||
package_id int references package(id), | ||
version text not null | ||
); | ||
|
||
-- migrate:down | ||
drop table package_version; |
12 changes: 12 additions & 0 deletions
12
apps/backend/db/migrations/20240412155057_create_signature.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- migrate:up | ||
create table signature ( | ||
id integer primary key generated always as identity, | ||
package_id int references package(id), | ||
package_version_id int references package_version(id), | ||
name text not null, | ||
content text not null, | ||
comment text | ||
); | ||
|
||
-- migrate:down | ||
drop table signature; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
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; | ||
|
||
-- | ||
-- Name: moddatetime; Type: EXTENSION; Schema: -; Owner: - | ||
-- | ||
|
||
CREATE EXTENSION IF NOT EXISTS moddatetime WITH SCHEMA public; | ||
|
||
|
||
-- | ||
-- Name: EXTENSION moddatetime; Type: COMMENT; Schema: -; Owner: - | ||
-- | ||
|
||
COMMENT ON EXTENSION moddatetime IS 'functions for tracking last modification time'; | ||
|
||
|
||
-- | ||
-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: - | ||
-- | ||
|
||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public; | ||
|
||
|
||
-- | ||
-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: - | ||
-- | ||
|
||
COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)'; | ||
|
||
|
||
SET default_tablespace = ''; | ||
|
||
SET default_table_access_method = heap; | ||
|
||
-- | ||
-- Name: package; Type: TABLE; Schema: public; Owner: - | ||
-- | ||
|
||
CREATE TABLE public.package ( | ||
id integer NOT NULL, | ||
name text NOT NULL, | ||
repository text, | ||
documentation text | ||
); | ||
|
||
|
||
-- | ||
-- Name: package_id_seq; Type: SEQUENCE; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER TABLE public.package ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( | ||
SEQUENCE NAME public.package_id_seq | ||
START WITH 1 | ||
INCREMENT BY 1 | ||
NO MINVALUE | ||
NO MAXVALUE | ||
CACHE 1 | ||
); | ||
|
||
|
||
-- | ||
-- Name: package_version; Type: TABLE; Schema: public; Owner: - | ||
-- | ||
|
||
CREATE TABLE public.package_version ( | ||
id integer NOT NULL, | ||
package_id integer, | ||
version text NOT NULL | ||
); | ||
|
||
|
||
-- | ||
-- Name: package_version_id_seq; Type: SEQUENCE; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER TABLE public.package_version ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( | ||
SEQUENCE NAME public.package_version_id_seq | ||
START WITH 1 | ||
INCREMENT BY 1 | ||
NO MINVALUE | ||
NO MAXVALUE | ||
CACHE 1 | ||
); | ||
|
||
|
||
-- | ||
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - | ||
-- | ||
|
||
CREATE TABLE public.schema_migrations ( | ||
version character varying(128) NOT NULL | ||
); | ||
|
||
|
||
-- | ||
-- Name: signature; Type: TABLE; Schema: public; Owner: - | ||
-- | ||
|
||
CREATE TABLE public.signature ( | ||
id integer NOT NULL, | ||
package_id integer, | ||
package_version_id integer, | ||
name text NOT NULL, | ||
content text NOT NULL, | ||
comment text | ||
); | ||
|
||
|
||
-- | ||
-- Name: signature_id_seq; Type: SEQUENCE; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER TABLE public.signature ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( | ||
SEQUENCE NAME public.signature_id_seq | ||
START WITH 1 | ||
INCREMENT BY 1 | ||
NO MINVALUE | ||
NO MAXVALUE | ||
CACHE 1 | ||
); | ||
|
||
|
||
-- | ||
-- Name: package package_pkey; Type: CONSTRAINT; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY public.package | ||
ADD CONSTRAINT package_pkey PRIMARY KEY (id); | ||
|
||
|
||
-- | ||
-- Name: package_version package_version_pkey; Type: CONSTRAINT; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY public.package_version | ||
ADD CONSTRAINT package_version_pkey PRIMARY KEY (id); | ||
|
||
|
||
-- | ||
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY public.schema_migrations | ||
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); | ||
|
||
|
||
-- | ||
-- Name: signature signature_pkey; Type: CONSTRAINT; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY public.signature | ||
ADD CONSTRAINT signature_pkey PRIMARY KEY (id); | ||
|
||
|
||
-- | ||
-- Name: package_version package_version_package_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY public.package_version | ||
ADD CONSTRAINT package_version_package_id_fkey FOREIGN KEY (package_id) REFERENCES public.package(id); | ||
|
||
|
||
-- | ||
-- Name: signature signature_package_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY public.signature | ||
ADD CONSTRAINT signature_package_id_fkey FOREIGN KEY (package_id) REFERENCES public.package(id); | ||
|
||
|
||
-- | ||
-- Name: signature signature_package_version_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY public.signature | ||
ADD CONSTRAINT signature_package_version_id_fkey FOREIGN KEY (package_version_id) REFERENCES public.package_version(id); | ||
|
||
|
||
-- | ||
-- PostgreSQL database dump complete | ||
-- | ||
|
||
|
||
-- | ||
-- Dbmate schema migrations | ||
-- | ||
|
||
INSERT INTO public.schema_migrations (version) VALUES | ||
('20240412153209'), | ||
('20240412154007'), | ||
('20240412154430'), | ||
('20240412155057'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters