add hidden date field for sorting posts
This commit is contained in:
@@ -29,7 +29,7 @@ module Q = struct
|
||||
content text NOT NULL,
|
||||
date text NOT NULL,
|
||||
active TINYINT DEFAULT 1,
|
||||
hidden_date DEFAULT (unixepoch('now'))
|
||||
hidden_date timestamp DEFAULT (strftime('%s', 'now')))
|
||||
|eos}
|
||||
|
||||
let create_blog_post =
|
||||
|
||||
2
esy.json
2
esy.json
@@ -6,7 +6,7 @@
|
||||
"@opam/caqti": "*",
|
||||
"@opam/lwt_ppx": "*",
|
||||
"@opam/caqti-driver-sqlite3": "*",
|
||||
"ocaml": "4.12.x"
|
||||
"ocaml": "*"
|
||||
},
|
||||
|
||||
"scripts": {
|
||||
|
||||
@@ -2,12 +2,14 @@ open Lwt.Infix
|
||||
open Database
|
||||
open Render
|
||||
|
||||
exception DatabaseCreationFailure
|
||||
let db_created = ref true
|
||||
|
||||
let _ =
|
||||
Database.create_blog_post_table () >>= function
|
||||
let _ = Database.create_blog_post_table () >>= function
|
||||
| Ok () -> Lwt_io.print "Database initialized successfully.\n"
|
||||
| Error _ -> raise DatabaseCreationFailure
|
||||
| Error _ -> Lwt.return (db_created := false)
|
||||
|
||||
let () = Unix.sleepf 2.0
|
||||
let () = if not !db_created then failwith "Could not initialize database"
|
||||
|
||||
let () =
|
||||
Dream.run
|
||||
|
||||
Reference in New Issue
Block a user