Started writing auth sql schema

develop
Jef Roosens 2021-08-20 14:06:01 +02:00
parent fcd31fd6a8
commit 4ccee64323
Signed by untrusted user: Jef Roosens
GPG Key ID: 955C0660072F691F
4 changed files with 27 additions and 5 deletions

View File

@ -15,11 +15,18 @@ path = "src/rbs/main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
# Backend web framework
rocket = "0.5.0-rc.1"
# ORM
diesel = { version = "1.4.7", features = ["postgres"] }
diesel_migrations = "1.4.0"
# To properly compile libpq statically
openssl = "0.10.36"
# For password hashing & verification
rust-argon2 = "0.8.3"
rand = "0.8.4"
# Used to provide Rocket routes with database connections
[dependencies.rocket_sync_db_pools]
version = "0.1.0-rc.1"
default_features = false

View File

@ -0,0 +1 @@
-- This file should undo anything in `up.sql`

View File

@ -0,0 +1,17 @@
-- Users
CREATE TABLE users (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
username varchar(32) UNIQUE NOT NULL,
password text NOT NULL
);
-- Permissions that a user can have
CREATE TABLE permissions (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
user_id uuid REFERENCES users (id) NOT NULL,
name varchar NOT NULL,
UNIQUE (user_id, name)
);

View File

@ -2,11 +2,8 @@
// compilation succeeds
extern crate openssl;
#[macro_use]
extern crate rocket;
#[macro_use]
extern crate diesel_migrations;
#[macro_use] extern crate rocket;
#[macro_use] extern crate diesel_migrations;
use rocket::{fairing::AdHoc, Build, Rocket};
use rocket_sync_db_pools::{database, diesel};