WIP
This commit is contained in:
parent
eb79b6f28f
commit
4fd2b61322
|
@ -14,4 +14,4 @@ This will watch the project directory and restart as necessary.
|
|||
|
||||
- Authn: https://github.com/dashbitco/mix_phx_gen_auth_demo/blob/auth/README.md
|
||||
- Mail client
|
||||
- Tokens and IDs? I'd love to use ULIDs or something
|
||||
- Tokens and IDs? I'd love to use some kind of short identifier (youtube-esque IDs) or something
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { query } from "@/db/mod.ts";
|
||||
|
||||
const id = "id uuid primary key default uuid_generate_v4()";
|
||||
const id = "id uuid primary key default generate_ulid()";
|
||||
|
||||
interface TableSpec {
|
||||
columns: string[];
|
||||
|
@ -106,6 +106,12 @@ begin;
|
|||
${dropTables}
|
||||
|
||||
create extension if not exists "uuid-ossp";
|
||||
create extension if not exists "pgcrypto";
|
||||
|
||||
create or replace function generate_ulid() returns uuid
|
||||
as $$
|
||||
select (lpad(to_hex(floor(extract(epoch from clock_timestamp()) * 1000)::bigint), 12, '0') || encode(gen_random_bytes(10), 'hex'))::uuid;
|
||||
$$ language sql;
|
||||
|
||||
${createTables}
|
||||
|
||||
|
|
Loading…
Reference in a new issue