diff --git a/migrations/.gitkeep b/migrations/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/migrations/2019-11-13-074151_create_posts/down.sql b/migrations/2022-12-22-062417_create_posts/down.sql similarity index 100% rename from migrations/2019-11-13-074151_create_posts/down.sql rename to migrations/2022-12-22-062417_create_posts/down.sql diff --git a/migrations/2019-11-13-074151_create_posts/up.sql b/migrations/2022-12-22-062417_create_posts/up.sql similarity index 86% rename from migrations/2019-11-13-074151_create_posts/up.sql rename to migrations/2022-12-22-062417_create_posts/up.sql index 7ff0303..c007206 100644 --- a/migrations/2019-11-13-074151_create_posts/up.sql +++ b/migrations/2022-12-22-062417_create_posts/up.sql @@ -3,6 +3,8 @@ CREATE TABLE posts ( title VARCHAR NOT NULL, content TEXT NOT NULL, published BOOLEAN NOT NULL DEFAULT 'f', + views integer NOT NULL DEFAULT 0, created_at TIMESTAMP NOT NULL DEFAULT NOW(), updated_at TIMESTAMP NOT NULL DEFAULT NOW() ) + diff --git a/src/schema.rs b/src/schema.rs index 84a187d..0769d7e 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -1,10 +1,12 @@ -table! { +// @generated automatically by Diesel CLI. + +diesel::table! { posts (id) { - id -> Integer, + id -> Int4, title -> Varchar, content -> Text, published -> Bool, - views -> Integer, + views -> Int4, created_at -> Timestamp, updated_at -> Timestamp, } diff --git a/templates/admin/edit_post.html.tera b/templates/admin/edit_post.html.tera index 0240cfd..63551d2 100644 --- a/templates/admin/edit_post.html.tera +++ b/templates/admin/edit_post.html.tera @@ -31,6 +31,7 @@ +