lulw just setting up database schemas via diesel

This commit is contained in:
shockrah 2019-12-08 21:28:31 -08:00
parent a765f8b9ff
commit 3d8d8f93b9
9 changed files with 46 additions and 0 deletions

1
server/src/db_io/.env Normal file
View File

@ -0,0 +1 @@
DATABASE_URL=mysql://freechat_server:@localhost/freechat_dev

View File

@ -0,0 +1,12 @@
[package]
name = "db_io"
version = "0.1.0"
authors = ["shockrah <alejandros714@protonmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
diesel = { version = "1.0.0", features = ["postgres"] }
dotenv = "0.9.0"

View File

@ -0,0 +1,5 @@
# For documentation on how to configure this file,
# see diesel.rs/guides/configuring-diesel-cli
[print_schema]
file = "src/schema.rs"

View File

@ -0,0 +1 @@
drop table users;

View File

@ -0,0 +1,6 @@
CREATE TABLE users (
id INTEGER PRIMARY KEY,
strid VARCHAR(256),
display VARCHAR(256),
native BOOLEAN
);

View File

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

View File

@ -0,0 +1,5 @@
CREATE TABLE channels (
id INTEGER PRIMARY KEY,
name VARCHAR(128) NOT NULL,
type INTEGER NOT NULL,
);

View File

@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}

View File

@ -0,0 +1,8 @@
table! {
users (id) {
id -> Integer,
strid -> Nullable<Varchar>,
display -> Nullable<Varchar>,
native -> Nullable<Bool>,
}
}