827 lines
18 KiB
PL/PgSQL
827 lines
18 KiB
PL/PgSQL
--
|
|
-- PostgreSQL database dump
|
|
--
|
|
|
|
\restrict FugYqvehfvYcZV6n0VXYfKK3pEfWehcjXHsTSddhC5Qcn0530oCENplg6a2CdZd
|
|
|
|
-- Dumped from database version 18.1
|
|
-- Dumped by pg_dump version 18.1
|
|
|
|
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: truncate_tables(character varying); Type: FUNCTION; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE FUNCTION public.truncate_tables(username character varying) RETURNS void
|
|
LANGUAGE plpgsql
|
|
AS $$
|
|
DECLARE
|
|
statements CURSOR FOR
|
|
SELECT tablename FROM pg_tables
|
|
WHERE tableowner = username AND schemaname = 'public';
|
|
BEGIN
|
|
FOR stmt IN statements LOOP
|
|
EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.tablename) || ' CASCADE;';
|
|
END LOOP;
|
|
END;
|
|
$$;
|
|
|
|
|
|
SET default_tablespace = '';
|
|
|
|
SET default_table_access_method = heap;
|
|
|
|
--
|
|
-- Name: account; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.account (
|
|
id integer NOT NULL,
|
|
number smallint NOT NULL,
|
|
financial_year_id integer NOT NULL,
|
|
description text NOT NULL,
|
|
sru smallint
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: account_balance; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.account_balance (
|
|
account_number integer NOT NULL,
|
|
financial_year_id integer NOT NULL,
|
|
"in" numeric(12,2) DEFAULT 0 NOT NULL,
|
|
"out" numeric(12,2) DEFAULT 0 NOT NULL,
|
|
in_quantity integer,
|
|
out_quantity integer
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: account_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.account_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: account_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.account_id_seq OWNED BY public.account.id;
|
|
|
|
|
|
--
|
|
-- Name: aliases_to_supplier; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.aliases_to_supplier (
|
|
id integer NOT NULL,
|
|
supplier_id integer NOT NULL,
|
|
alias text NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: aliases_to_supplier_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.aliases_to_supplier_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: aliases_to_supplier_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.aliases_to_supplier_id_seq OWNED BY public.aliases_to_supplier.id;
|
|
|
|
|
|
--
|
|
-- Name: dimension; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.dimension (
|
|
id integer NOT NULL,
|
|
number smallint NOT NULL,
|
|
name text
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: dimension_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.dimension_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: dimension_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.dimension_id_seq OWNED BY public.dimension.id;
|
|
|
|
|
|
--
|
|
-- Name: entry; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.entry (
|
|
id integer NOT NULL,
|
|
financial_year_id integer NOT NULL,
|
|
journal_id integer NOT NULL,
|
|
number integer NOT NULL,
|
|
transaction_date date NOT NULL,
|
|
description text,
|
|
entry_date date NOT NULL,
|
|
signature text
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: entry_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.entry_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: entry_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.entry_id_seq OWNED BY public.entry.id;
|
|
|
|
|
|
--
|
|
-- Name: file; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.file (
|
|
id integer NOT NULL,
|
|
filename text CONSTRAINT file_file_not_null NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: file_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.file_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: file_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.file_id_seq OWNED BY public.file.id;
|
|
|
|
|
|
--
|
|
-- Name: files_to_invoice; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.files_to_invoice (
|
|
invoice_id integer NOT NULL,
|
|
file_id integer NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: financial_year; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.financial_year (
|
|
id integer NOT NULL,
|
|
year integer NOT NULL,
|
|
start_date date NOT NULL,
|
|
end_date date NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: financial_year_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.financial_year_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: financial_year_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.financial_year_id_seq OWNED BY public.financial_year.id;
|
|
|
|
|
|
--
|
|
-- Name: invoice; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.invoice (
|
|
id integer NOT NULL,
|
|
financial_year_id integer,
|
|
supplier_id integer NOT NULL,
|
|
fisken_number integer,
|
|
phm_number integer,
|
|
invoice_number text,
|
|
invoice_date date,
|
|
due_date date,
|
|
ocr text,
|
|
amount numeric(12,2)
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: invoice_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.invoice_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: invoice_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.invoice_id_seq OWNED BY public.invoice.id;
|
|
|
|
|
|
--
|
|
-- Name: journal; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.journal (
|
|
id integer NOT NULL,
|
|
identifier text NOT NULL,
|
|
description text
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: journal_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.journal_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: journal_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.journal_id_seq OWNED BY public.journal.id;
|
|
|
|
|
|
--
|
|
-- Name: object; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.object (
|
|
id integer NOT NULL,
|
|
dimension_id integer NOT NULL,
|
|
number smallint NOT NULL,
|
|
name text
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: object_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.object_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: object_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.object_id_seq OWNED BY public.object.id;
|
|
|
|
|
|
--
|
|
-- Name: supplier; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.supplier (
|
|
id integer NOT NULL,
|
|
name text,
|
|
supplier_type_id integer NOT NULL,
|
|
tax_id text
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: supplier_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.supplier_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: supplier_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.supplier_id_seq OWNED BY public.supplier.id;
|
|
|
|
|
|
--
|
|
-- Name: supplier_type; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.supplier_type (
|
|
id integer NOT NULL,
|
|
name text NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: supplier_type_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.supplier_type_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: supplier_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.supplier_type_id_seq OWNED BY public.supplier_type.id;
|
|
|
|
|
|
--
|
|
-- Name: transaction; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.transaction (
|
|
id integer NOT NULL,
|
|
entry_id integer NOT NULL,
|
|
account_number smallint NOT NULL,
|
|
amount numeric(12,2) NOT NULL,
|
|
object_id integer,
|
|
description text,
|
|
transaction_date date,
|
|
quantity numeric(12,2),
|
|
signature text,
|
|
invoice_id integer
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: transaction_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.transaction_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: transaction_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.transaction_id_seq OWNED BY public.transaction.id;
|
|
|
|
|
|
--
|
|
-- Name: transactions_to_objects; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.transactions_to_objects (
|
|
transaction_id integer NOT NULL,
|
|
object_id integer NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: account id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.account ALTER COLUMN id SET DEFAULT nextval('public.account_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: aliases_to_supplier id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.aliases_to_supplier ALTER COLUMN id SET DEFAULT nextval('public.aliases_to_supplier_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: dimension id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.dimension ALTER COLUMN id SET DEFAULT nextval('public.dimension_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: entry id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.entry ALTER COLUMN id SET DEFAULT nextval('public.entry_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: file id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.file ALTER COLUMN id SET DEFAULT nextval('public.file_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: financial_year id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.financial_year ALTER COLUMN id SET DEFAULT nextval('public.financial_year_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: invoice id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.invoice ALTER COLUMN id SET DEFAULT nextval('public.invoice_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: journal id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.journal ALTER COLUMN id SET DEFAULT nextval('public.journal_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: object id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.object ALTER COLUMN id SET DEFAULT nextval('public.object_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: supplier id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.supplier ALTER COLUMN id SET DEFAULT nextval('public.supplier_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: supplier_type id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.supplier_type ALTER COLUMN id SET DEFAULT nextval('public.supplier_type_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: transaction id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.transaction ALTER COLUMN id SET DEFAULT nextval('public.transaction_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: account_balance account_balance_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.account_balance
|
|
ADD CONSTRAINT account_balance_pkey PRIMARY KEY (account_number, financial_year_id);
|
|
|
|
|
|
--
|
|
-- Name: account account_number_financial_year_id_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.account
|
|
ADD CONSTRAINT account_number_financial_year_id_key UNIQUE (number, financial_year_id);
|
|
|
|
|
|
--
|
|
-- Name: account account_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.account
|
|
ADD CONSTRAINT account_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: aliases_to_supplier aliases_to_supplier_alias_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.aliases_to_supplier
|
|
ADD CONSTRAINT aliases_to_supplier_alias_key UNIQUE (alias);
|
|
|
|
|
|
--
|
|
-- Name: aliases_to_supplier aliases_to_supplier_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.aliases_to_supplier
|
|
ADD CONSTRAINT aliases_to_supplier_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: dimension dimension_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.dimension
|
|
ADD CONSTRAINT dimension_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: entry entry_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.entry
|
|
ADD CONSTRAINT entry_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: file file_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.file
|
|
ADD CONSTRAINT file_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: files_to_invoice files_to_invoice_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.files_to_invoice
|
|
ADD CONSTRAINT files_to_invoice_pkey PRIMARY KEY (invoice_id, file_id);
|
|
|
|
|
|
--
|
|
-- Name: financial_year financial_year_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.financial_year
|
|
ADD CONSTRAINT financial_year_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: financial_year financial_year_start_date_end_date_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.financial_year
|
|
ADD CONSTRAINT financial_year_start_date_end_date_key UNIQUE (start_date, end_date);
|
|
|
|
|
|
--
|
|
-- Name: financial_year financial_year_year_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.financial_year
|
|
ADD CONSTRAINT financial_year_year_key UNIQUE (year);
|
|
|
|
|
|
--
|
|
-- Name: invoice invoice_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.invoice
|
|
ADD CONSTRAINT invoice_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: journal journal_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.journal
|
|
ADD CONSTRAINT journal_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: object object_dimension_id_number_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.object
|
|
ADD CONSTRAINT object_dimension_id_number_key UNIQUE (dimension_id, number);
|
|
|
|
|
|
--
|
|
-- Name: object object_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.object
|
|
ADD CONSTRAINT object_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: supplier supplier_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.supplier
|
|
ADD CONSTRAINT supplier_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: supplier supplier_tax_id_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.supplier
|
|
ADD CONSTRAINT supplier_tax_id_key UNIQUE (tax_id);
|
|
|
|
|
|
--
|
|
-- Name: supplier_type supplier_type_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.supplier_type
|
|
ADD CONSTRAINT supplier_type_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: transaction transaction_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.transaction
|
|
ADD CONSTRAINT transaction_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: transactions_to_objects transactions_to_objects_transaction_id_object_id_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.transactions_to_objects
|
|
ADD CONSTRAINT transactions_to_objects_transaction_id_object_id_key UNIQUE (transaction_id, object_id);
|
|
|
|
|
|
--
|
|
-- Name: aliases_to_supplier aliases_to_supplier_supplier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.aliases_to_supplier
|
|
ADD CONSTRAINT aliases_to_supplier_supplier_id_fkey FOREIGN KEY (supplier_id) REFERENCES public.supplier(id);
|
|
|
|
|
|
--
|
|
-- Name: files_to_invoice files_to_invoice_file_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.files_to_invoice
|
|
ADD CONSTRAINT files_to_invoice_file_id_fkey FOREIGN KEY (file_id) REFERENCES public.file(id);
|
|
|
|
|
|
--
|
|
-- Name: files_to_invoice files_to_invoice_invoice_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.files_to_invoice
|
|
ADD CONSTRAINT files_to_invoice_invoice_id_fkey FOREIGN KEY (invoice_id) REFERENCES public.invoice(id);
|
|
|
|
|
|
--
|
|
-- Name: invoice invoice_financial_year_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.invoice
|
|
ADD CONSTRAINT invoice_financial_year_id_fkey FOREIGN KEY (financial_year_id) REFERENCES public.financial_year(id);
|
|
|
|
|
|
--
|
|
-- Name: invoice invoice_supplier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.invoice
|
|
ADD CONSTRAINT invoice_supplier_id_fkey FOREIGN KEY (supplier_id) REFERENCES public.supplier(id);
|
|
|
|
|
|
--
|
|
-- Name: object object_dimension_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.object
|
|
ADD CONSTRAINT object_dimension_id_fkey FOREIGN KEY (dimension_id) REFERENCES public.dimension(id);
|
|
|
|
|
|
--
|
|
-- Name: supplier supplier_supplier_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.supplier
|
|
ADD CONSTRAINT supplier_supplier_type_id_fkey FOREIGN KEY (supplier_type_id) REFERENCES public.supplier_type(id);
|
|
|
|
|
|
--
|
|
-- Name: transaction transaction_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.transaction
|
|
ADD CONSTRAINT transaction_entry_id_fkey FOREIGN KEY (entry_id) REFERENCES public.entry(id);
|
|
|
|
|
|
--
|
|
-- Name: transaction transaction_invoice_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.transaction
|
|
ADD CONSTRAINT transaction_invoice_id_fkey FOREIGN KEY (invoice_id) REFERENCES public.invoice(id);
|
|
|
|
|
|
--
|
|
-- Name: transaction transaction_object_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.transaction
|
|
ADD CONSTRAINT transaction_object_id_fkey FOREIGN KEY (object_id) REFERENCES public.object(id);
|
|
|
|
|
|
--
|
|
-- Name: transactions_to_objects transactions_to_objects_object_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.transactions_to_objects
|
|
ADD CONSTRAINT transactions_to_objects_object_id_fkey FOREIGN KEY (object_id) REFERENCES public.object(id);
|
|
|
|
|
|
--
|
|
-- Name: transactions_to_objects transactions_to_objects_transaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.transactions_to_objects
|
|
ADD CONSTRAINT transactions_to_objects_transaction_id_fkey FOREIGN KEY (transaction_id) REFERENCES public.transaction(id);
|
|
|
|
|
|
--
|
|
-- PostgreSQL database dump complete
|
|
--
|
|
|
|
\unrestrict FugYqvehfvYcZV6n0VXYfKK3pEfWehcjXHsTSddhC5Qcn0530oCENplg6a2CdZd
|
|
|