feat: assign deterministic operation UUIDs

This commit is contained in:
2026-08-19 17:46:50 +03:00
parent 3d08c9e5c6
commit 5c059cbc62
8 changed files with 34 additions and 7 deletions

View File

@@ -133,6 +133,16 @@ const migrations: { name: string; sql: string }[] = [
AND NOT EXISTS (SELECT 1 FROM category_rules LIMIT 1);
`,
},
{
name: '006_transaction_operation_uuid',
sql: `
CREATE EXTENSION IF NOT EXISTS pgcrypto;
ALTER TABLE transactions
ADD COLUMN IF NOT EXISTS operation_id UUID NOT NULL DEFAULT gen_random_uuid();
CREATE UNIQUE INDEX IF NOT EXISTS ux_transactions_account_operation_id
ON transactions(account_id, operation_id);
`,
},
{
name: '005_imports_table',
sql: `