accountant/sql/install/01_init.sql

179 lines
3.8 KiB
MySQL
Raw Normal View History

2013-02-08 13:07:27 +01:00
/*
This file is part of Accountant.
Accountant is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Accountant is distributed in the hope that it will be useful,
2013-02-08 13:07:27 +01:00
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Accountant. If not, see <http://www.gnu.org/licenses/>.
*/
2013-01-24 19:39:06 +01:00
--
-- PostgreSQL database dump
--
2013-01-07 18:42:02 +01:00
2013-01-24 19:39:06 +01:00
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
2013-01-24 20:44:09 +01:00
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
2013-01-24 19:39:06 +01:00
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,
2013-01-24 20:44:09 +01:00
name character varying(200) NOT NULL,
authorized_overdraft integer DEFAULT 0 NOT NULL
2013-01-07 18:42:02 +01:00
);
2013-01-24 19:39:06 +01:00
--
-- 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,
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),
pointed boolean DEFAULT false NOT NULL
2013-01-07 18:42:02 +01:00
);
2013-01-24 19:39:06 +01:00
--
-- 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_operation_date_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2013-01-24 19:39:06 +01:00
--
CREATE INDEX entry_operation_date_idx ON entry USING btree (operation_date);
2013-01-24 19:39:06 +01:00
--
-- 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);
2013-01-24 20:44:09 +01:00
--
-- Name: public; Type: ACL; Schema: -; Owner: -
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
2013-01-24 19:39:06 +01:00
--
-- PostgreSQL database dump complete
--
2013-01-07 18:42:02 +01:00