From d2eea77842189c6964b51bc75ca5a62172b77dcd Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 18 Jan 2018 21:30:24 +0100 Subject: Add users table to schema. --- migrations/2018-01-18-202058_create_users/down.sql | 2 ++ migrations/2018-01-18-202058_create_users/up.sql | 8 ++++++++ src/schema.rs | 15 +++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 migrations/2018-01-18-202058_create_users/down.sql create mode 100644 migrations/2018-01-18-202058_create_users/up.sql diff --git a/migrations/2018-01-18-202058_create_users/down.sql b/migrations/2018-01-18-202058_create_users/down.sql new file mode 100644 index 0000000..dc3714b --- /dev/null +++ b/migrations/2018-01-18-202058_create_users/down.sql @@ -0,0 +1,2 @@ +-- This file should undo anything in `up.sql` +DROP TABLE users; diff --git a/migrations/2018-01-18-202058_create_users/up.sql b/migrations/2018-01-18-202058_create_users/up.sql new file mode 100644 index 0000000..fee1340 --- /dev/null +++ b/migrations/2018-01-18-202058_create_users/up.sql @@ -0,0 +1,8 @@ +-- Create users table +CREATE TABLE users ( + id SERIAL PRIMARY KEY, + username VARCHAR NOT NULL, + realname VARCHAR, + email VARCHAR, + password VARCHAR NOT NULL +) diff --git a/src/schema.rs b/src/schema.rs index 3124ea5..ad122fd 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -6,3 +6,18 @@ table! { published -> Bool, } } + +table! { + users (id) { + id -> Int4, + username -> Varchar, + realname -> Nullable, + email -> Nullable, + password -> Varchar, + } +} + +allow_tables_to_appear_in_same_query!( + posts, + users, +); -- cgit v1.2.3