diesel: Create migrations for users and pastes
Signed-off-by: ATechnoHazard <amolele@gmail.com>
This commit is contained in:
parent
2a1034c70f
commit
e782e6640f
1
migrations/2020-06-24-164134_create_users/down.sql
Normal file
1
migrations/2020-06-24-164134_create_users/down.sql
Normal file
@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS users
|
7
migrations/2020-06-24-164134_create_users/up.sql
Normal file
7
migrations/2020-06-24-164134_create_users/up.sql
Normal file
@ -0,0 +1,7 @@
|
||||
CREATE TABLE IF NOT EXISTS users
|
||||
(
|
||||
id VARCHAR PRIMARY KEY,
|
||||
username VARCHAR,
|
||||
password VARCHAR,
|
||||
activated BOOLEAN
|
||||
)
|
1
migrations/2020-06-24-170630_create_paste/down.sql
Normal file
1
migrations/2020-06-24-170630_create_paste/down.sql
Normal file
@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS pastes
|
7
migrations/2020-06-24-170630_create_paste/up.sql
Normal file
7
migrations/2020-06-24-170630_create_paste/up.sql
Normal file
@ -0,0 +1,7 @@
|
||||
CREATE TABLE IF NOT EXISTS pastes
|
||||
(
|
||||
id VARCHAR PRIMARY KEY,
|
||||
belongs_to VARCHAR references users(id),
|
||||
is_url BOOLEAN NOT NULL DEFAULT 'f',
|
||||
content TEXT NOT NULL
|
||||
)
|
34
src/schema.rs
Normal file
34
src/schema.rs
Normal file
@ -0,0 +1,34 @@
|
||||
table! {
|
||||
games (id) {
|
||||
id -> Int4,
|
||||
name -> Text,
|
||||
developer -> Text,
|
||||
is_goty -> Bool,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
pastes (id) {
|
||||
id -> Varchar,
|
||||
belongs_to -> Nullable<Varchar>,
|
||||
is_url -> Bool,
|
||||
content -> Text,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
users (id) {
|
||||
id -> Varchar,
|
||||
username -> Nullable<Varchar>,
|
||||
password -> Nullable<Varchar>,
|
||||
activated -> Nullable<Bool>,
|
||||
}
|
||||
}
|
||||
|
||||
joinable!(pastes -> users (belongs_to));
|
||||
|
||||
allow_tables_to_appear_in_same_query!(
|
||||
games,
|
||||
pastes,
|
||||
users,
|
||||
);
|
Loading…
Reference in New Issue
Block a user