-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sql
37 lines (29 loc) · 1003 Bytes
/
init.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
CREATE EXTENSION pgcrypto;
CREATE TABLE people (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
age INT NOT NULL,
height_inches FLOAT NOT NULL
);
INSERT INTO people (name, age, height_inches) VALUES
('Daniel', 34, 68),
('Marx', 10, 12.5);
CREATE TABLE tasks (
id SERIAL PRIMARY KEY,
owner INT NOT NULL REFERENCES people(id),
description TEXT
);
INSERT INTO tasks (owner, description) VALUES
(1, 'feed Marx'),
(2, 'nap');
CREATE TYPE meeting_type AS enum ('Slack', 'Phone', 'Face');
CREATE TABLE meetings (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
time TIMESTAMPTZ,
type meeting_type,
details JSONB NOT NULL default '{}',
attendees text[] NOT NULL default '{}'
);
INSERT INTO meetings (time, details, type, attendees) VALUES
('2018-01-01', '{"location": "home", "topic": "happy new year"}', Face, '{Daniel, Marx}'),
('2018-10-11', '{"location": "office", "topic": "SQL libraries"}', Slack, '{Daniel, Jim}');