diff --git a/src/models.rs b/src/models.rs index 268a264..429d53c 100644 --- a/src/models.rs +++ b/src/models.rs @@ -9,6 +9,7 @@ pub struct Post { pub title: String, pub content: String, pub published: bool, + pub views: i32, pub created_at: NaiveDateTime, pub updated_at: NaiveDateTime, } @@ -19,4 +20,5 @@ pub struct NewPost { pub title: String, pub content: String, pub published: bool, + pub views: i32, } diff --git a/src/schema.rs b/src/schema.rs index b93068c..84a187d 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -1,9 +1,10 @@ table! { posts (id) { - id -> Int4, + id -> Integer, title -> Varchar, content -> Text, published -> Bool, + views -> Integer, created_at -> Timestamp, updated_at -> Timestamp, } diff --git a/templates/admin/add_post.html.tera b/templates/admin/add_post.html.tera index 439705c..3b20401 100644 --- a/templates/admin/add_post.html.tera +++ b/templates/admin/add_post.html.tera @@ -31,6 +31,7 @@ +