chipmunk/sql.go

39 lines
767 B
Go
Raw Normal View History

2017-02-04 19:48:02 -08:00
package chipmunk
const createdb = `
CREATE TABLE IF NOT EXISTS
users (
2017-02-04 21:38:31 -08:00
id SERIAL PRIMARY KEY,
2017-02-04 19:48:02 -08:00
email varchar(64) UNIQUE,
admin boolean DEFAULT false
);
CREATE TABLE IF NOT EXISTS
categories (
id SERIAL PRIMARY KEY,
2017-02-04 21:48:43 -08:00
name varchar(1024) UNIQUE,
budget numeric DEFAULT 0
2017-02-04 19:48:02 -08:00
);
CREATE TABLE IF NOT EXISTS
tranx (
id SERIAL PRIMARY KEY,
cost numeric DEFAULT 0,
2017-02-04 21:38:31 -08:00
store varchar(64),
info varchar(1024),
category_id integer references categories(id) DEFAULT 0,
date timestamp DEFAULT CURRENT_TIMESTAMP,
user_id integer references users(id) DEFAULT 0
2017-02-04 19:48:02 -08:00
);
`
const primeCategories = `
2017-02-04 21:48:43 -08:00
INSERT INTO categories (name, budget) VALUES
('Derek', 100),
('Colleen', 100),
('Groceries', 200),
('Restaurant', 200),
('Misc', 100)
2017-02-04 19:48:02 -08:00
;
`