fix: wrap uuid_generate_v7 function in goose StatementBegin/End

goose splits SQL on semicolons and misinterprets dollar-quoted strings
($$...$$) as statement boundaries, causing a parse error on the PL/pgSQL
function body. StatementBegin/End annotations tell goose to treat the
block as a single statement.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
dbastrikin
2026-03-16 11:42:22 +02:00
parent 6e0d55d511
commit 67d8897c95

View File

@@ -10,6 +10,7 @@ CREATE EXTENSION IF NOT EXISTS pg_trgm;
-- UUID v7 generator (time-ordered, millisecond precision).
-- Structure: 48-bit unix_ts_ms | 4-bit version (0111) | 12-bit rand_a | 2-bit variant (10) | 62-bit rand_b
-- ---------------------------------------------------------------------------
-- +goose StatementBegin
CREATE OR REPLACE FUNCTION uuid_generate_v7()
RETURNS uuid
AS $$
@@ -38,6 +39,7 @@ BEGIN
RETURN encode(uuid_bytes, 'hex')::uuid;
END
$$ LANGUAGE plpgsql VOLATILE;
-- +goose StatementEnd
-- ---------------------------------------------------------------------------
-- Enums