diff --git a/migrations/2020-06-24-164134_create_users/down.sql b/migrations/2020-06-24-164134_create_users/down.sql new file mode 100644 index 0000000..ea15b38 --- /dev/null +++ b/migrations/2020-06-24-164134_create_users/down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS users \ No newline at end of file diff --git a/migrations/2020-06-24-164134_create_users/up.sql b/migrations/2020-06-24-164134_create_users/up.sql new file mode 100644 index 0000000..55355d2 --- /dev/null +++ b/migrations/2020-06-24-164134_create_users/up.sql @@ -0,0 +1,7 @@ +CREATE TABLE IF NOT EXISTS users +( + id VARCHAR PRIMARY KEY, + username VARCHAR, + password VARCHAR, + activated BOOLEAN +) \ No newline at end of file diff --git a/migrations/2020-06-24-170630_create_paste/down.sql b/migrations/2020-06-24-170630_create_paste/down.sql new file mode 100644 index 0000000..f5fa99c --- /dev/null +++ b/migrations/2020-06-24-170630_create_paste/down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS pastes \ No newline at end of file diff --git a/migrations/2020-06-24-170630_create_paste/up.sql b/migrations/2020-06-24-170630_create_paste/up.sql new file mode 100644 index 0000000..88a0ae3 --- /dev/null +++ b/migrations/2020-06-24-170630_create_paste/up.sql @@ -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 +) \ No newline at end of file diff --git a/src/schema.rs b/src/schema.rs new file mode 100644 index 0000000..1564ab4 --- /dev/null +++ b/src/schema.rs @@ -0,0 +1,34 @@ +table! { + games (id) { + id -> Int4, + name -> Text, + developer -> Text, + is_goty -> Bool, + } +} + +table! { + pastes (id) { + id -> Varchar, + belongs_to -> Nullable, + is_url -> Bool, + content -> Text, + } +} + +table! { + users (id) { + id -> Varchar, + username -> Nullable, + password -> Nullable, + activated -> Nullable, + } +} + +joinable!(pastes -> users (belongs_to)); + +allow_tables_to_appear_in_same_query!( + games, + pastes, + users, +);