-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb-script.sql
More file actions
41 lines (36 loc) · 988 Bytes
/
db-script.sql
File metadata and controls
41 lines (36 loc) · 988 Bytes
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
38
39
40
41
-- Create the usermanagementdb database
CREATE DATABASE usermanagementdb;
-- Connect to the usermanagementdb database
\c usermanagementdb;
-- Create the users table
CREATE TABLE users
(
id UUID NOT NULL
PRIMARY KEY,
created TIMESTAMP(6),
email VARCHAR(255) NOT NULL
CONSTRAINT uk6dotkott2kjsp8vw4d0m25fb7
UNIQUE,
is_active BOOLEAN NOT NULL,
last_login TIMESTAMP(6),
modified TIMESTAMP(6),
name VARCHAR(255),
password VARCHAR(255) NOT NULL,
token VARCHAR(500)
);
ALTER TABLE users
OWNER TO postgres;
-- Create the phones table
CREATE TABLE phones
(
id BIGINT GENERATED BY DEFAULT AS IDENTITY
PRIMARY KEY,
city_code VARCHAR(255),
country_code VARCHAR(255),
number VARCHAR(255),
user_id UUID NOT NULL
CONSTRAINT fkmg6d77tgqfen7n1g763nvsqe3
REFERENCES users
);
ALTER TABLE phones
OWNER TO postgres;