init
This commit is contained in:
79
dollhouse/crates/dollhouse-db/src/schema.rs
Executable file
79
dollhouse/crates/dollhouse-db/src/schema.rs
Executable file
@@ -0,0 +1,79 @@
|
||||
// @generated automatically by Diesel CLI.
|
||||
|
||||
pub mod sql_types {
|
||||
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
|
||||
#[diesel(postgres_type(name = "replicant_gender"))]
|
||||
pub struct ReplicantGender;
|
||||
|
||||
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
|
||||
#[diesel(postgres_type(name = "replicant_status"))]
|
||||
pub struct ReplicantStatus;
|
||||
|
||||
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
|
||||
#[diesel(postgres_type(name = "user_role"))]
|
||||
pub struct UserRole;
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
corps (id) {
|
||||
id -> Uuid,
|
||||
#[max_length = 255]
|
||||
name -> Varchar,
|
||||
description -> Text,
|
||||
created_at -> Timestamp,
|
||||
#[max_length = 255]
|
||||
invite_code -> Varchar,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
use diesel::sql_types::*;
|
||||
use super::sql_types::ReplicantStatus;
|
||||
use super::sql_types::ReplicantGender;
|
||||
|
||||
replicants (id) {
|
||||
id -> Uuid,
|
||||
#[max_length = 255]
|
||||
name -> Varchar,
|
||||
description -> Text,
|
||||
status -> ReplicantStatus,
|
||||
created_at -> Timestamp,
|
||||
gender -> ReplicantGender,
|
||||
corp_id -> Uuid,
|
||||
is_private -> Bool,
|
||||
#[max_length = 255]
|
||||
firmware_file -> Nullable<Varchar>,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
replicants_stats (replicant_id) {
|
||||
replicant_id -> Uuid,
|
||||
health -> Int4,
|
||||
strength -> Int4,
|
||||
intelligence -> Int4,
|
||||
created_at -> Timestamp,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
use diesel::sql_types::*;
|
||||
use super::sql_types::UserRole;
|
||||
|
||||
users (id) {
|
||||
id -> Uuid,
|
||||
#[max_length = 255]
|
||||
username -> Varchar,
|
||||
#[max_length = 255]
|
||||
password -> Varchar,
|
||||
role -> UserRole,
|
||||
created_at -> Timestamp,
|
||||
corp_id -> Nullable<Uuid>,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::joinable!(replicants -> corps (corp_id));
|
||||
diesel::joinable!(replicants_stats -> replicants (replicant_id));
|
||||
diesel::joinable!(users -> corps (corp_id));
|
||||
|
||||
diesel::allow_tables_to_appear_in_same_query!(corps, replicants, replicants_stats, users,);
|
||||
Reference in New Issue
Block a user