lulw just setting up database schemas via diesel
This commit is contained in:
parent
a765f8b9ff
commit
3d8d8f93b9
1
server/src/db_io/.env
Normal file
1
server/src/db_io/.env
Normal file
@ -0,0 +1 @@
|
|||||||
|
DATABASE_URL=mysql://freechat_server:@localhost/freechat_dev
|
12
server/src/db_io/Cargo.toml
Normal file
12
server/src/db_io/Cargo.toml
Normal 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"
|
||||||
|
|
5
server/src/db_io/diesel.toml
Normal file
5
server/src/db_io/diesel.toml
Normal 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"
|
@ -0,0 +1 @@
|
|||||||
|
drop table users;
|
@ -0,0 +1,6 @@
|
|||||||
|
CREATE TABLE users (
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
|
strid VARCHAR(256),
|
||||||
|
display VARCHAR(256),
|
||||||
|
native BOOLEAN
|
||||||
|
);
|
@ -0,0 +1 @@
|
|||||||
|
-- This file should undo anything in `up.sql`
|
@ -0,0 +1,5 @@
|
|||||||
|
CREATE TABLE channels (
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
|
name VARCHAR(128) NOT NULL,
|
||||||
|
type INTEGER NOT NULL,
|
||||||
|
);
|
7
server/src/db_io/src/lib.rs
Normal file
7
server/src/db_io/src/lib.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
#[test]
|
||||||
|
fn it_works() {
|
||||||
|
assert_eq!(2 + 2, 4);
|
||||||
|
}
|
||||||
|
}
|
8
server/src/db_io/src/schema.rs
Normal file
8
server/src/db_io/src/schema.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
table! {
|
||||||
|
users (id) {
|
||||||
|
id -> Integer,
|
||||||
|
strid -> Nullable<Varchar>,
|
||||||
|
display -> Nullable<Varchar>,
|
||||||
|
native -> Nullable<Bool>,
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user