generated from alecodes/base-template
feat: add database service as dev dependency
This commit is contained in:
parent
5362d2ba30
commit
ca2ea91976
9 changed files with 1047 additions and 0 deletions
13
db/migrations/20250205190533_create_sources_table.sql
Normal file
13
db/migrations/20250205190533_create_sources_table.sql
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
-- migrate:up
|
||||
CREATE TABLE public.sources (
|
||||
id serial PRIMARY KEY,
|
||||
name character varying(20) NOT NULL,
|
||||
uid character varying(8) NOT NULL,
|
||||
uri character varying,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
);
|
||||
|
||||
-- migrate:down
|
||||
DROP TABLE public.sources;
|
||||
15
db/migrations/20250206220324_create_logic_groups_table.sql
Normal file
15
db/migrations/20250206220324_create_logic_groups_table.sql
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
-- migrate:up
|
||||
CREATE TABLE public.logic_groups (
|
||||
id serial PRIMARY KEY,
|
||||
name character varying(20) NOT NULL,
|
||||
uid character varying(8) NOT NULL,
|
||||
uri character varying,
|
||||
source_id int,
|
||||
created_at timestamp WITH time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp WITH time zone,
|
||||
deleted_at timestamp WITH time zone,
|
||||
CONSTRAINT fk_source FOREIGN KEY (source_id) REFERENCES public.sources(id)
|
||||
);
|
||||
|
||||
-- migrate:down
|
||||
DROP TABLE public.logic_groups;
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
-- migrate:up
|
||||
CREATE TABLE public.desambiguator_types(
|
||||
id serial PRIMARY KEY,
|
||||
name varchar(15) NOT NULL,
|
||||
input_type varchar(15) NOT NULL,
|
||||
placeholder varchar(30),
|
||||
created_at timestamp WITH time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp WITH time zone,
|
||||
deleted_at timestamp WITH time zone
|
||||
);
|
||||
|
||||
INSERT INTO
|
||||
public.desambiguator_types(name, input_type, placeholder)
|
||||
VALUES
|
||||
('Text', 'text', 'XXX-XXX-XXX'),
|
||||
('Date', 'date', '2020-12-31');
|
||||
|
||||
ALTER TABLE
|
||||
public.sources
|
||||
ADD
|
||||
COLUMN desambiguator_type_id int NOT NULL DEFAULT 1;
|
||||
|
||||
ALTER TABLE
|
||||
public.sources
|
||||
ADD
|
||||
CONSTRAINT fk_desambiguator_type FOREIGN KEY (desambiguator_type_id) REFERENCES public.desambiguator_types(id);
|
||||
|
||||
-- migrate:down
|
||||
ALTER TABLE
|
||||
public.sources DROP CONSTRAINT fk_desambiguator_type;
|
||||
|
||||
ALTER TABLE
|
||||
public.sources DROP COLUMN desambiguator_type_id;
|
||||
|
||||
DROP TABLE public.desambiguator_types;
|
||||
77
db/migrations/20250207174953_add_table_entries.sql
Normal file
77
db/migrations/20250207174953_add_table_entries.sql
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
-- migrate:up
|
||||
CREATE TABLE public.entries (
|
||||
id serial NOT NULL,
|
||||
uid varchar NOT NULL,
|
||||
desambiguator text NOT NULL,
|
||||
text text,
|
||||
logic_group_id integer NOT NULL,
|
||||
created_at timestamp WITH time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp WITH time zone,
|
||||
deleted_at timestamp WITH time zone,
|
||||
PRIMARY KEY (id, created_at),
|
||||
CONSTRAINT fk_logic_group FOREIGN KEY (logic_group_id) REFERENCES public.logic_groups(id)
|
||||
) PARTITION BY RANGE (created_at);
|
||||
|
||||
CREATE INDEX index_entries_uid ON ONLY public.entries USING btree (uid);
|
||||
|
||||
CREATE SCHEMA entries_partitions;
|
||||
|
||||
CREATE TABLE entries_partitions.e2020 PARTITION OF public.entries FOR
|
||||
VALUES
|
||||
FROM
|
||||
('2020-01-01') TO ('2021-01-01');
|
||||
|
||||
CREATE TABLE entries_partitions.e2021 PARTITION OF public.entries FOR
|
||||
VALUES
|
||||
FROM
|
||||
('2021-01-01') TO ('2022-01-01');
|
||||
|
||||
CREATE TABLE entries_partitions.e2022 PARTITION OF public.entries FOR
|
||||
VALUES
|
||||
FROM
|
||||
('2022-01-01') TO ('2023-01-01');
|
||||
|
||||
CREATE TABLE entries_partitions.e2023 PARTITION OF public.entries FOR
|
||||
VALUES
|
||||
FROM
|
||||
('2023-01-01') TO ('2024-01-01');
|
||||
|
||||
CREATE TABLE entries_partitions.e2024 PARTITION OF public.entries FOR
|
||||
VALUES
|
||||
FROM
|
||||
('2024-01-01') TO ('2025-01-01');
|
||||
|
||||
CREATE TABLE entries_partitions.e2025 PARTITION OF public.entries FOR
|
||||
VALUES
|
||||
FROM
|
||||
('2025-01-01') TO ('2026-01-01');
|
||||
|
||||
CREATE TABLE entries_partitions.e2026 PARTITION OF public.entries FOR
|
||||
VALUES
|
||||
FROM
|
||||
('2026-01-01') TO ('2027-01-01');
|
||||
|
||||
CREATE TABLE entries_partitions.e2027 PARTITION OF public.entries FOR
|
||||
VALUES
|
||||
FROM
|
||||
('2027-01-01') TO ('2028-01-01');
|
||||
|
||||
CREATE TABLE entries_partitions.e2028 PARTITION OF public.entries FOR
|
||||
VALUES
|
||||
FROM
|
||||
('2028-01-01') TO ('2029-01-01');
|
||||
|
||||
CREATE TABLE entries_partitions.e2029 PARTITION OF public.entries FOR
|
||||
VALUES
|
||||
FROM
|
||||
('2029-01-01') TO ('2030-01-01');
|
||||
|
||||
CREATE TABLE entries_partitions.e2030 PARTITION OF public.entries FOR
|
||||
VALUES
|
||||
FROM
|
||||
('2030-01-01') TO ('2031-01-01');
|
||||
|
||||
-- migrate:down
|
||||
DROP TABLE public.entries;
|
||||
|
||||
DROP schema entries_partitions;
|
||||
861
db/schema.sql
Normal file
861
db/schema.sql
Normal file
|
|
@ -0,0 +1,861 @@
|
|||
SET statement_timeout = 0;
|
||||
SET lock_timeout = 0;
|
||||
SET idle_in_transaction_session_timeout = 0;
|
||||
SET transaction_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: entries_partitions; Type: SCHEMA; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
CREATE SCHEMA entries_partitions;
|
||||
|
||||
|
||||
SET default_tablespace = '';
|
||||
|
||||
--
|
||||
-- Name: entries; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.entries (
|
||||
id integer NOT NULL,
|
||||
uid character varying NOT NULL,
|
||||
desambiguator text NOT NULL,
|
||||
text text,
|
||||
logic_group_id integer NOT NULL,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
)
|
||||
PARTITION BY RANGE (created_at);
|
||||
|
||||
|
||||
--
|
||||
-- Name: entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.entries_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.entries_id_seq OWNED BY public.entries.id;
|
||||
|
||||
|
||||
SET default_table_access_method = heap;
|
||||
|
||||
--
|
||||
-- Name: e2020; Type: TABLE; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE entries_partitions.e2020 (
|
||||
id integer DEFAULT nextval('public.entries_id_seq'::regclass) NOT NULL,
|
||||
uid character varying NOT NULL,
|
||||
desambiguator text NOT NULL,
|
||||
text text,
|
||||
logic_group_id integer NOT NULL,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2021; Type: TABLE; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE entries_partitions.e2021 (
|
||||
id integer DEFAULT nextval('public.entries_id_seq'::regclass) NOT NULL,
|
||||
uid character varying NOT NULL,
|
||||
desambiguator text NOT NULL,
|
||||
text text,
|
||||
logic_group_id integer NOT NULL,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2022; Type: TABLE; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE entries_partitions.e2022 (
|
||||
id integer DEFAULT nextval('public.entries_id_seq'::regclass) NOT NULL,
|
||||
uid character varying NOT NULL,
|
||||
desambiguator text NOT NULL,
|
||||
text text,
|
||||
logic_group_id integer NOT NULL,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2023; Type: TABLE; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE entries_partitions.e2023 (
|
||||
id integer DEFAULT nextval('public.entries_id_seq'::regclass) NOT NULL,
|
||||
uid character varying NOT NULL,
|
||||
desambiguator text NOT NULL,
|
||||
text text,
|
||||
logic_group_id integer NOT NULL,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2024; Type: TABLE; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE entries_partitions.e2024 (
|
||||
id integer DEFAULT nextval('public.entries_id_seq'::regclass) NOT NULL,
|
||||
uid character varying NOT NULL,
|
||||
desambiguator text NOT NULL,
|
||||
text text,
|
||||
logic_group_id integer NOT NULL,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2025; Type: TABLE; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE entries_partitions.e2025 (
|
||||
id integer DEFAULT nextval('public.entries_id_seq'::regclass) NOT NULL,
|
||||
uid character varying NOT NULL,
|
||||
desambiguator text NOT NULL,
|
||||
text text,
|
||||
logic_group_id integer NOT NULL,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2026; Type: TABLE; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE entries_partitions.e2026 (
|
||||
id integer DEFAULT nextval('public.entries_id_seq'::regclass) NOT NULL,
|
||||
uid character varying NOT NULL,
|
||||
desambiguator text NOT NULL,
|
||||
text text,
|
||||
logic_group_id integer NOT NULL,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2027; Type: TABLE; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE entries_partitions.e2027 (
|
||||
id integer DEFAULT nextval('public.entries_id_seq'::regclass) NOT NULL,
|
||||
uid character varying NOT NULL,
|
||||
desambiguator text NOT NULL,
|
||||
text text,
|
||||
logic_group_id integer NOT NULL,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2028; Type: TABLE; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE entries_partitions.e2028 (
|
||||
id integer DEFAULT nextval('public.entries_id_seq'::regclass) NOT NULL,
|
||||
uid character varying NOT NULL,
|
||||
desambiguator text NOT NULL,
|
||||
text text,
|
||||
logic_group_id integer NOT NULL,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2029; Type: TABLE; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE entries_partitions.e2029 (
|
||||
id integer DEFAULT nextval('public.entries_id_seq'::regclass) NOT NULL,
|
||||
uid character varying NOT NULL,
|
||||
desambiguator text NOT NULL,
|
||||
text text,
|
||||
logic_group_id integer NOT NULL,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2030; Type: TABLE; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE entries_partitions.e2030 (
|
||||
id integer DEFAULT nextval('public.entries_id_seq'::regclass) NOT NULL,
|
||||
uid character varying NOT NULL,
|
||||
desambiguator text NOT NULL,
|
||||
text text,
|
||||
logic_group_id integer NOT NULL,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: desambiguator_types; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.desambiguator_types (
|
||||
id integer NOT NULL,
|
||||
name character varying(15) NOT NULL,
|
||||
input_type character varying(15) NOT NULL,
|
||||
placeholder character varying(30),
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: desambiguator_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.desambiguator_types_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: desambiguator_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.desambiguator_types_id_seq OWNED BY public.desambiguator_types.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: logic_groups; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.logic_groups (
|
||||
id integer NOT NULL,
|
||||
name character varying(20) NOT NULL,
|
||||
uid character varying(8) NOT NULL,
|
||||
uri character varying,
|
||||
source_id integer,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: logic_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.logic_groups_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: logic_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.logic_groups_id_seq OWNED BY public.logic_groups.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.schema_migrations (
|
||||
version character varying(128) NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: sources; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.sources (
|
||||
id integer NOT NULL,
|
||||
name character varying(20) NOT NULL,
|
||||
uid character varying(8) NOT NULL,
|
||||
uri character varying,
|
||||
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp with time zone,
|
||||
deleted_at timestamp with time zone,
|
||||
desambiguator_type_id integer DEFAULT 1 NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: sources_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.sources_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: sources_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.sources_id_seq OWNED BY public.sources.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2020; Type: TABLE ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.entries ATTACH PARTITION entries_partitions.e2020 FOR VALUES FROM ('2020-01-01 00:00:00+00') TO ('2021-01-01 00:00:00+00');
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2021; Type: TABLE ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.entries ATTACH PARTITION entries_partitions.e2021 FOR VALUES FROM ('2021-01-01 00:00:00+00') TO ('2022-01-01 00:00:00+00');
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2022; Type: TABLE ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.entries ATTACH PARTITION entries_partitions.e2022 FOR VALUES FROM ('2022-01-01 00:00:00+00') TO ('2023-01-01 00:00:00+00');
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2023; Type: TABLE ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.entries ATTACH PARTITION entries_partitions.e2023 FOR VALUES FROM ('2023-01-01 00:00:00+00') TO ('2024-01-01 00:00:00+00');
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2024; Type: TABLE ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.entries ATTACH PARTITION entries_partitions.e2024 FOR VALUES FROM ('2024-01-01 00:00:00+00') TO ('2025-01-01 00:00:00+00');
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2025; Type: TABLE ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.entries ATTACH PARTITION entries_partitions.e2025 FOR VALUES FROM ('2025-01-01 00:00:00+00') TO ('2026-01-01 00:00:00+00');
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2026; Type: TABLE ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.entries ATTACH PARTITION entries_partitions.e2026 FOR VALUES FROM ('2026-01-01 00:00:00+00') TO ('2027-01-01 00:00:00+00');
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2027; Type: TABLE ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.entries ATTACH PARTITION entries_partitions.e2027 FOR VALUES FROM ('2027-01-01 00:00:00+00') TO ('2028-01-01 00:00:00+00');
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2028; Type: TABLE ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.entries ATTACH PARTITION entries_partitions.e2028 FOR VALUES FROM ('2028-01-01 00:00:00+00') TO ('2029-01-01 00:00:00+00');
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2029; Type: TABLE ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.entries ATTACH PARTITION entries_partitions.e2029 FOR VALUES FROM ('2029-01-01 00:00:00+00') TO ('2030-01-01 00:00:00+00');
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2030; Type: TABLE ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.entries ATTACH PARTITION entries_partitions.e2030 FOR VALUES FROM ('2030-01-01 00:00:00+00') TO ('2031-01-01 00:00:00+00');
|
||||
|
||||
|
||||
--
|
||||
-- Name: desambiguator_types id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.desambiguator_types ALTER COLUMN id SET DEFAULT nextval('public.desambiguator_types_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: entries id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.entries ALTER COLUMN id SET DEFAULT nextval('public.entries_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: logic_groups id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.logic_groups ALTER COLUMN id SET DEFAULT nextval('public.logic_groups_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: sources id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.sources ALTER COLUMN id SET DEFAULT nextval('public.sources_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: entries entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.entries
|
||||
ADD CONSTRAINT entries_pkey PRIMARY KEY (id, created_at);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2020 e2020_pkey; Type: CONSTRAINT; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY entries_partitions.e2020
|
||||
ADD CONSTRAINT e2020_pkey PRIMARY KEY (id, created_at);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2021 e2021_pkey; Type: CONSTRAINT; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY entries_partitions.e2021
|
||||
ADD CONSTRAINT e2021_pkey PRIMARY KEY (id, created_at);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2022 e2022_pkey; Type: CONSTRAINT; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY entries_partitions.e2022
|
||||
ADD CONSTRAINT e2022_pkey PRIMARY KEY (id, created_at);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2023 e2023_pkey; Type: CONSTRAINT; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY entries_partitions.e2023
|
||||
ADD CONSTRAINT e2023_pkey PRIMARY KEY (id, created_at);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2024 e2024_pkey; Type: CONSTRAINT; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY entries_partitions.e2024
|
||||
ADD CONSTRAINT e2024_pkey PRIMARY KEY (id, created_at);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2025 e2025_pkey; Type: CONSTRAINT; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY entries_partitions.e2025
|
||||
ADD CONSTRAINT e2025_pkey PRIMARY KEY (id, created_at);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2026 e2026_pkey; Type: CONSTRAINT; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY entries_partitions.e2026
|
||||
ADD CONSTRAINT e2026_pkey PRIMARY KEY (id, created_at);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2027 e2027_pkey; Type: CONSTRAINT; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY entries_partitions.e2027
|
||||
ADD CONSTRAINT e2027_pkey PRIMARY KEY (id, created_at);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2028 e2028_pkey; Type: CONSTRAINT; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY entries_partitions.e2028
|
||||
ADD CONSTRAINT e2028_pkey PRIMARY KEY (id, created_at);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2029 e2029_pkey; Type: CONSTRAINT; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY entries_partitions.e2029
|
||||
ADD CONSTRAINT e2029_pkey PRIMARY KEY (id, created_at);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2030 e2030_pkey; Type: CONSTRAINT; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY entries_partitions.e2030
|
||||
ADD CONSTRAINT e2030_pkey PRIMARY KEY (id, created_at);
|
||||
|
||||
|
||||
--
|
||||
-- Name: desambiguator_types desambiguator_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.desambiguator_types
|
||||
ADD CONSTRAINT desambiguator_types_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: logic_groups logic_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.logic_groups
|
||||
ADD CONSTRAINT logic_groups_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: sources sources_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.sources
|
||||
ADD CONSTRAINT sources_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_entries_uid; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_entries_uid ON ONLY public.entries USING btree (uid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2020_uid_idx; Type: INDEX; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX e2020_uid_idx ON entries_partitions.e2020 USING btree (uid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2021_uid_idx; Type: INDEX; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX e2021_uid_idx ON entries_partitions.e2021 USING btree (uid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2022_uid_idx; Type: INDEX; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX e2022_uid_idx ON entries_partitions.e2022 USING btree (uid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2023_uid_idx; Type: INDEX; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX e2023_uid_idx ON entries_partitions.e2023 USING btree (uid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2024_uid_idx; Type: INDEX; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX e2024_uid_idx ON entries_partitions.e2024 USING btree (uid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2025_uid_idx; Type: INDEX; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX e2025_uid_idx ON entries_partitions.e2025 USING btree (uid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2026_uid_idx; Type: INDEX; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX e2026_uid_idx ON entries_partitions.e2026 USING btree (uid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2027_uid_idx; Type: INDEX; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX e2027_uid_idx ON entries_partitions.e2027 USING btree (uid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2028_uid_idx; Type: INDEX; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX e2028_uid_idx ON entries_partitions.e2028 USING btree (uid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2029_uid_idx; Type: INDEX; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX e2029_uid_idx ON entries_partitions.e2029 USING btree (uid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2030_uid_idx; Type: INDEX; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX e2030_uid_idx ON entries_partitions.e2030 USING btree (uid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2020_pkey; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.entries_pkey ATTACH PARTITION entries_partitions.e2020_pkey;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2020_uid_idx; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.index_entries_uid ATTACH PARTITION entries_partitions.e2020_uid_idx;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2021_pkey; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.entries_pkey ATTACH PARTITION entries_partitions.e2021_pkey;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2021_uid_idx; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.index_entries_uid ATTACH PARTITION entries_partitions.e2021_uid_idx;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2022_pkey; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.entries_pkey ATTACH PARTITION entries_partitions.e2022_pkey;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2022_uid_idx; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.index_entries_uid ATTACH PARTITION entries_partitions.e2022_uid_idx;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2023_pkey; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.entries_pkey ATTACH PARTITION entries_partitions.e2023_pkey;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2023_uid_idx; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.index_entries_uid ATTACH PARTITION entries_partitions.e2023_uid_idx;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2024_pkey; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.entries_pkey ATTACH PARTITION entries_partitions.e2024_pkey;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2024_uid_idx; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.index_entries_uid ATTACH PARTITION entries_partitions.e2024_uid_idx;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2025_pkey; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.entries_pkey ATTACH PARTITION entries_partitions.e2025_pkey;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2025_uid_idx; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.index_entries_uid ATTACH PARTITION entries_partitions.e2025_uid_idx;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2026_pkey; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.entries_pkey ATTACH PARTITION entries_partitions.e2026_pkey;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2026_uid_idx; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.index_entries_uid ATTACH PARTITION entries_partitions.e2026_uid_idx;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2027_pkey; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.entries_pkey ATTACH PARTITION entries_partitions.e2027_pkey;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2027_uid_idx; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.index_entries_uid ATTACH PARTITION entries_partitions.e2027_uid_idx;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2028_pkey; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.entries_pkey ATTACH PARTITION entries_partitions.e2028_pkey;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2028_uid_idx; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.index_entries_uid ATTACH PARTITION entries_partitions.e2028_uid_idx;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2029_pkey; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.entries_pkey ATTACH PARTITION entries_partitions.e2029_pkey;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2029_uid_idx; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.index_entries_uid ATTACH PARTITION entries_partitions.e2029_uid_idx;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2030_pkey; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.entries_pkey ATTACH PARTITION entries_partitions.e2030_pkey;
|
||||
|
||||
|
||||
--
|
||||
-- Name: e2030_uid_idx; Type: INDEX ATTACH; Schema: entries_partitions; Owner: -
|
||||
--
|
||||
|
||||
ALTER INDEX public.index_entries_uid ATTACH PARTITION entries_partitions.e2030_uid_idx;
|
||||
|
||||
|
||||
--
|
||||
-- Name: sources fk_desambiguator_type; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.sources
|
||||
ADD CONSTRAINT fk_desambiguator_type FOREIGN KEY (desambiguator_type_id) REFERENCES public.desambiguator_types(id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: entries fk_logic_group; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE public.entries
|
||||
ADD CONSTRAINT fk_logic_group FOREIGN KEY (logic_group_id) REFERENCES public.logic_groups(id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: logic_groups fk_source; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.logic_groups
|
||||
ADD CONSTRAINT fk_source FOREIGN KEY (source_id) REFERENCES public.sources(id);
|
||||
|
||||
|
||||
--
|
||||
-- PostgreSQL database dump complete
|
||||
--
|
||||
|
||||
|
||||
--
|
||||
-- Dbmate schema migrations
|
||||
--
|
||||
|
||||
INSERT INTO public.schema_migrations (version) VALUES
|
||||
('20250205190533'),
|
||||
('20250206220324'),
|
||||
('20250207152518'),
|
||||
('20250207174953');
|
||||
Loading…
Add table
Add a link
Reference in a new issue