-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
24 lines (21 loc) · 680 Bytes
/
Copy pathschema.sql
File metadata and controls
24 lines (21 loc) · 680 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
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS pet;
CREATE TABLE
users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT NOT NULL UNIQUE,
hash TEXT NOT NULL
);
CREATE TABLE
pet (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
name TEXT NOT NULL,
health INTEGER NOT NULL DEFAULT 100,
hunger INTEGER NOT NULL DEFAULT 0,
happiness INTEGER NOT NULL DEFAULT 100,
hygiene INTEGER NOT NULL DEFAULT 100,
birth TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users (id)
);