got tables laid out correctl

This commit is contained in:
Derek McQuay 2017-02-04 21:38:31 -08:00
parent 4d533d295c
commit a5f0979116
No known key found for this signature in database
GPG Key ID: 92A7BC0C86B0B91A
2 changed files with 7 additions and 5 deletions

View File

@ -42,7 +42,7 @@ func main() {
Run: func(cmd *cobra.Command, args []string) {
config := &Config{
DBHost: "localhost",
DBName: "postgres",
DBName: "dmcquay",
}
err := envconfig.Process("chipd", config)
if err != nil {

10
sql.go
View File

@ -3,7 +3,7 @@ package chipmunk
const createdb = `
CREATE TABLE IF NOT EXISTS
users (
id uuid PRIMARY KEY,
id SERIAL PRIMARY KEY,
email varchar(64) UNIQUE,
admin boolean DEFAULT false
);
@ -18,9 +18,11 @@ CREATE TABLE IF NOT EXISTS
tranx (
id SERIAL PRIMARY KEY,
cost numeric DEFAULT 0,
store varchar(64) UNIQUE,
info varchar(1024) UNIQUE,
user uuid
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
);
`