51f95e0fd6
Part of GRO-802 monorepo breakdown. Changes: - Extract apps/api/ as the main API service - Inline packages/db/ (database schema, migrations, utilities) - Inline packages/types/ (shared TypeScript types) - Add CI workflow for lint, typecheck, test, build, docker - Port Dockerfile with 4 stages: runner, migrate, seed, reset Co-Authored-By: Paperclip <noreply@paperclip.ing>
12 lines
442 B
SQL
12 lines
442 B
SQL
CREATE TABLE "refunds" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
"invoice_id" uuid NOT NULL REFERENCES "invoices"("id") ON DELETE RESTRICT,
|
|
"stripe_refund_id" text NOT NULL,
|
|
"idempotency_key" text UNIQUE,
|
|
"amount_cents" integer,
|
|
"created_at" timestamp NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX "idx_refunds_invoice_id" ON "refunds"("invoice_id");
|
|
CREATE INDEX "idx_refunds_idempotency_key" ON "refunds"("idempotency_key");
|