Skip to content

Commit 3bf66a3

Browse files
authored
Merge pull request #13 from pgschema/multi-file-example
feat: multi-file schema example
2 parents af13984 + e01ffe2 commit 3bf66a3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

multifile/tables/orders.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
CREATE TABLE IF NOT EXISTS orders (
66
id integer PRIMARY KEY,
77
user_id integer NOT NULL REFERENCES users(id),
8-
status text DEFAULT 'pending' NOT NULL CHECK (status IN ('pending', 'completed')),
9-
amount numeric(10,2) DEFAULT 0.00
8+
status text DEFAULT 'pending' NOT NULL CHECK (status IN ('pending', 'completed'))
109
);
1110

1211
COMMENT ON TABLE orders IS 'Customer orders';

multifile/tables/users.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
CREATE TABLE IF NOT EXISTS users (
66
id integer PRIMARY KEY,
77
email text NOT NULL CHECK (email LIKE '%@%'),
8-
name text NOT NULL
8+
name text NOT NULL,
9+
age integer CHECK (age >= 0)
910
);
1011

1112
COMMENT ON TABLE users IS 'User accounts';

0 commit comments

Comments
 (0)