Reset SQL init script.
This commit is contained in:
parent
c5e7b8c94b
commit
dd38e6036d
@ -1,22 +1,136 @@
|
||||
BEGIN;
|
||||
--
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
CREATE TABLE "account" (
|
||||
"id" SERIAL PRIMARY KEY,
|
||||
"name" VARCHAR(200) NOT NULL
|
||||
SET statement_timeout = 0;
|
||||
SET client_encoding = 'UTF8';
|
||||
SET standard_conforming_strings = on;
|
||||
SET check_function_bodies = false;
|
||||
SET client_min_messages = warning;
|
||||
|
||||
SET search_path = public, pg_catalog;
|
||||
|
||||
SET default_tablespace = '';
|
||||
|
||||
SET default_with_oids = false;
|
||||
|
||||
--
|
||||
-- Name: account; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE account (
|
||||
id integer NOT NULL,
|
||||
name character varying(200) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE "entry" (
|
||||
"id" BIGSERIAL PRIMARY KEY,
|
||||
"value_date" DATE NOT NULL,
|
||||
"operation_date" DATE,
|
||||
"label" VARCHAR(500) NOT NULL,
|
||||
"comment" VARCHAR(500),
|
||||
"value" NUMERIC(15,4) NOT NULL,
|
||||
"account_id" INTEGER NOT NULL REFERENCES "account"("id"),
|
||||
"category" VARCHAR(100),
|
||||
|
||||
--
|
||||
-- Name: account_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE account_id_seq
|
||||
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 account_id_seq OWNED BY account.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: entry; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE entry (
|
||||
id bigint NOT NULL,
|
||||
value_date date NOT NULL,
|
||||
operation_date date,
|
||||
label character varying(500) NOT NULL,
|
||||
comment character varying(500),
|
||||
value numeric(15,2) NOT NULL,
|
||||
account_id integer NOT NULL,
|
||||
category character varying(100)
|
||||
);
|
||||
|
||||
CREATE INDEX on entry(value_date);
|
||||
|
||||
COMMIT;
|
||||
--
|
||||
-- Name: entry_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE entry_id_seq
|
||||
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 entry_id_seq OWNED BY entry.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY account ALTER COLUMN id SET DEFAULT nextval('account_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY entry ALTER COLUMN id SET DEFAULT nextval('entry_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: account_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY account
|
||||
ADD CONSTRAINT account_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: entry_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY entry
|
||||
ADD CONSTRAINT entry_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: entry_account_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX entry_account_id_idx ON entry USING btree (account_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: entry_value_date_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX entry_value_date_idx ON entry USING btree (value_date);
|
||||
|
||||
|
||||
--
|
||||
-- Name: entry_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY entry
|
||||
ADD CONSTRAINT entry_account_id_fkey FOREIGN KEY (account_id) REFERENCES account(id);
|
||||
|
||||
|
||||
--
|
||||
-- PostgreSQL database dump complete
|
||||
--
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user