1CREATE TABLE users (
2 id CHARACTER(20) PRIMARY KEY,
3 username CHARACTER(20) UNIQUE,
4 api_token CHARACTER(40) UNIQUE,
5 status CHARACTER(20), -- active, inactive
6 created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL
7);
8
9CREATE TABLE urls (
10 id CHARACTER(20) PRIMARY KEY,
11 destination TEXT,
12 short CHARACTER(20),
13 user CHARACTER(20),
14 created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
15
16 -- a url belongs to a user
17 FOREIGN KEY (user) REFERENCES users(id)
18);