Table creation: Difference between revisions

Content added Content deleted
No edit summary
Line 12: Line 12:
CREATE SEQUENCE account_seq start 100;
CREATE SEQUENCE account_seq start 100;
CREATE TABLE account (
CREATE TABLE account (
account_id int4 PRIMARY KEY DEFAULT nextval('account_seq'),
account_id int4 PRIMARY KEY DEFAULT nextval('account_seq'),
created date not null default now(),
created date not null default now(),
active bool not null default 't',
active bool not null default 't',
username varchar(16) unique not null,
username varchar(16) unique not null,
balance float default 0,
balance float default 0,
age int2,
age int2,
notes text
notes text
Line 22: Line 22:
CREATE TABLE account_note (
CREATE TABLE account_note (
account_id int4 not null REFERENCES account,
account_id int4 not null REFERENCES account,
created timestamp not null default now(),
created timestamp not null default now(),
note text not null,
note text not null,
unique(account_id, note)
unique(account_id, note)
);
);