feat: add site setting

This commit is contained in:
Kilerd Chan 2018-10-23 15:22:52 +08:00
parent b7c4a6bcb5
commit 5f10efa6d7
5 changed files with 20 additions and 1 deletions

View File

@ -1,5 +1,6 @@
-- Your SQL goes here -- Your SQL goes here
CREATE TABLE "public"."setting" ( CREATE TABLE "public"."setting" (
"name" varchar NOT NULL, "name" varchar NOT NULL,
"value" varchar "value" text,
PRIMARY KEY ("name")
); );

View File

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

View File

@ -0,0 +1,3 @@
-- Your SQL goes here
INSERT INTO setting ("name", "value")
VALUES ('title', 'rubble'), ('description', 'description of rubble application');

View File

@ -93,3 +93,9 @@ impl User {
} }
} }
} }
#[derive(Queryable, Debug, Seriable, Insertable, AsChangeset)]
pub struct Setting {
pub name: String,
pub value: Option<String>,
}

View File

@ -10,6 +10,13 @@ table! {
} }
} }
table! {
setting (name) {
name -> Varchar,
value -> Nullable<Text>,
}
}
table! { table! {
users (id) { users (id) {
id -> Int4, id -> Int4,
@ -24,5 +31,6 @@ joinable!(articles -> users (user_id));
allow_tables_to_appear_in_same_query!( allow_tables_to_appear_in_same_query!(
articles, articles,
setting,
users, users,
); );