-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_db.sql
More file actions
46 lines (36 loc) · 1.06 KB
/
init_db.sql
File metadata and controls
46 lines (36 loc) · 1.06 KB
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
42
43
44
-- This file initialises the database and all necessary tables.
-- We generated this SQL script by using the built in "SQL Generator" in Jetbrains RustRover.
create table __diesel_schema_migrations
(
version VARCHAR(50) not null
primary key,
run_on TIMESTAMP default CURRENT_TIMESTAMP not null
);
create table users
(
id integer not null
constraint users_pk
primary key autoincrement,
username TEXT not null,
password TEXT not null,
login_key text not null
);
create table posts
(
id integer not null
constraint posts_pk
primary key autoincrement,
content TEXT not null,
time INTEGER not null,
user_id integer not null
constraint posts_users_id_fk
references users
);
create unique index posts_id_uindex
on posts (id);
create unique index users_id_uindex
on users (id);
create unique index users_login_key_uindex
on users (login_key);
create unique index users_username_uindex
on users (username);