mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 21:04:03 +00:00
feat(finance): add settlement currency and cycle fx rates
This commit is contained in:
16
packages/db/drizzle/0012_clumsy_maestro.sql
Normal file
16
packages/db/drizzle/0012_clumsy_maestro.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
CREATE TABLE "billing_cycle_exchange_rates" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"cycle_id" uuid NOT NULL,
|
||||
"source_currency" text NOT NULL,
|
||||
"target_currency" text NOT NULL,
|
||||
"rate_micros" bigint NOT NULL,
|
||||
"effective_date" date NOT NULL,
|
||||
"source" text DEFAULT 'nbg' NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "household_billing_settings" ADD COLUMN "settlement_currency" text DEFAULT 'GEL' NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "billing_cycle_exchange_rates" ADD CONSTRAINT "billing_cycle_exchange_rates_cycle_id_billing_cycles_id_fk" FOREIGN KEY ("cycle_id") REFERENCES "public"."billing_cycles"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "billing_cycle_exchange_rates_cycle_pair_unique" ON "billing_cycle_exchange_rates" USING btree ("cycle_id","source_currency","target_currency");--> statement-breakpoint
|
||||
CREATE INDEX "billing_cycle_exchange_rates_cycle_idx" ON "billing_cycle_exchange_rates" USING btree ("cycle_id");
|
||||
2514
packages/db/drizzle/meta/0012_snapshot.json
Normal file
2514
packages/db/drizzle/meta/0012_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -85,6 +85,13 @@
|
||||
"when": 1773096404367,
|
||||
"tag": "0011_previous_ezekiel_stane",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 12,
|
||||
"version": "7",
|
||||
"when": 1773146577992,
|
||||
"tag": "0012_clumsy_maestro",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user