CREATE TABLE `payment_receipts` (
	`id` text PRIMARY KEY NOT NULL,
	`subscription_id` text NOT NULL,
	`amount_cents` integer NOT NULL,
	`received_at` integer NOT NULL
);
--> statement-breakpoint
CREATE INDEX `idx_payment_receipts_subscription` ON `payment_receipts` (`subscription_id`);--> statement-breakpoint
CREATE TABLE `payment_settings` (
	`id` text PRIMARY KEY NOT NULL,
	`encrypted` text NOT NULL
);
--> statement-breakpoint
CREATE TABLE `payment_subscriptions` (
	`id` text PRIMARY KEY NOT NULL,
	`user_email` text NOT NULL,
	`plan` text NOT NULL,
	`mode` text NOT NULL,
	`amount_cents` integer NOT NULL,
	`status` text DEFAULT 'pending' NOT NULL,
	`token` text,
	`created_at` integer NOT NULL,
	`paid_until` integer,
	`cancelled_at` integer
);
--> statement-breakpoint
CREATE INDEX `idx_payment_subscriptions_user_plan` ON `payment_subscriptions` (`user_email`,`plan`);