From 27384b1735cc558614ccfc3b9cac89bcd5869b4d Mon Sep 17 00:00:00 2001 From: Michael McVady Date: Mon, 7 Mar 2022 22:09:01 -0500 Subject: Use UUIDs ... --- README.md | 2 -- conf/clog.conf | 2 +- db/db.sql | 4 +++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8eed2df..f30867b 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,7 @@ An attempt to reimplement flog, using the [kore.io](https://kore.io) framework. ## TODO -* Use UUIDs for primary key in PostgreSQL. * Dockerize. * Determine how to handle `lib`/dependencies. -* Add GET /resource/{UUID} endpoint. * Figure out how to build a statically-linked/standalone binary. * Upgrade to Kore 4.2. diff --git a/conf/clog.conf b/conf/clog.conf index 8a6cf81..2415e5b 100644 --- a/conf/clog.conf +++ b/conf/clog.conf @@ -27,7 +27,7 @@ domain * { filemap /static/ assets/static route / posts - route ^/posts/[a-z1-9\-]+$ post + route ^/posts/[a-z0-9\-]+$ post route /posts posts } diff --git a/db/db.sql b/db/db.sql index 921ce06..421176f 100644 --- a/db/db.sql +++ b/db/db.sql @@ -2,8 +2,10 @@ CREATE DATABASE clog; \connect clog +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; + CREATE TABLE posts ( - id BIGINT NOT NULL, -- PRIMARY KEY UUID + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), title CHARACTER VARYING NOT NULL, body CHARACTER VARYING NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT NOW(), -- cgit v1.2.3