CREATE TABLE "exchange_rates" ( "id" uuid PRIMARY KEY NOT NULL, "from_currency" varchar(10) NOT NULL, "to_currency" varchar(10) NOT NULL, "rate" numeric(20, 8) NOT NULL, "updated_at" timestamp with time zone DEFAULT now() ); --> statement-breakpoint CREATE TABLE "portfolio_snapshots" ( "id" uuid PRIMARY KEY NOT NULL, "date" date NOT NULL, "total_value_cny" numeric(36, 18) NOT NULL, "total_cost_cny" numeric(36, 18) NOT NULL, "created_at" timestamp with time zone DEFAULT now() NOT NULL, "updated_at" timestamp with time zone DEFAULT now() NOT NULL, CONSTRAINT "portfolio_snapshots_date_unique" UNIQUE("date") ); --> statement-breakpoint ALTER TABLE "assets" ALTER COLUMN "id" DROP DEFAULT;--> statement-breakpoint ALTER TABLE "users" ALTER COLUMN "id" DROP DEFAULT;--> statement-breakpoint ALTER TABLE "assets" ADD COLUMN "name" varchar(100);--> statement-breakpoint ALTER TABLE "assets" ADD COLUMN "exchange" varchar(10) DEFAULT 'US';--> statement-breakpoint ALTER TABLE "assets" ADD COLUMN "latest_price" numeric(36, 18) DEFAULT '0' NOT NULL;--> statement-breakpoint CREATE UNIQUE INDEX "currency_pair_idx" ON "exchange_rates" USING btree ("from_currency","to_currency");