Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions singlefile/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ $$;
CREATE TABLE IF NOT EXISTS users (
id integer PRIMARY KEY,
email text NOT NULL CHECK (email LIKE '%@%'),
name text NOT NULL
name text NOT NULL,
age integer CHECK (age >= 0)
);

COMMENT ON TABLE users IS 'User accounts';
Expand Down Expand Up @@ -117,8 +118,7 @@ CREATE OR REPLACE TRIGGER users_update_trigger
CREATE TABLE IF NOT EXISTS orders (
id integer PRIMARY KEY,
user_id integer NOT NULL REFERENCES users(id),
status text DEFAULT 'pending' NOT NULL CHECK (status IN ('pending', 'completed')),
amount numeric(10,2) DEFAULT 0.00
status text DEFAULT 'pending' NOT NULL CHECK (status IN ('pending', 'completed'))
);

COMMENT ON TABLE orders IS 'Customer orders';
Expand Down
Loading