Release v1.0.0
This commit is contained in:
34
server/drizzle/0009_chilly_mockingbird.sql
Normal file
34
server/drizzle/0009_chilly_mockingbird.sql
Normal file
@@ -0,0 +1,34 @@
|
||||
CREATE TABLE "billing_subscriptions" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"workspace_id" uuid NOT NULL,
|
||||
"provider" varchar(32) DEFAULT 'stripe' NOT NULL,
|
||||
"customer_id" varchar(255) NOT NULL,
|
||||
"subscription_id" varchar(255),
|
||||
"price_id" varchar(255),
|
||||
"plan" varchar(32),
|
||||
"status" varchar(48) DEFAULT 'no_subscription' NOT NULL,
|
||||
"current_period_end" timestamp with time zone,
|
||||
"cancel_at_period_end" boolean DEFAULT false NOT NULL,
|
||||
"last_event_created_at" timestamp with time zone,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "billing_webhook_events" (
|
||||
"event_id" varchar(255) PRIMARY KEY NOT NULL,
|
||||
"provider" varchar(32) DEFAULT 'stripe' NOT NULL,
|
||||
"event_type" varchar(160) NOT NULL,
|
||||
"livemode" boolean DEFAULT false NOT NULL,
|
||||
"workspace_id" uuid,
|
||||
"provider_created_at" timestamp with time zone NOT NULL,
|
||||
"processed_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "billing_subscriptions" ADD CONSTRAINT "billing_subscriptions_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "billing_webhook_events" ADD CONSTRAINT "billing_webhook_events_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "billing_subscriptions_workspace_unique" ON "billing_subscriptions" USING btree ("workspace_id");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "billing_subscriptions_customer_unique" ON "billing_subscriptions" USING btree ("customer_id");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "billing_subscriptions_subscription_unique" ON "billing_subscriptions" USING btree ("subscription_id");--> statement-breakpoint
|
||||
CREATE INDEX "billing_subscriptions_status_idx" ON "billing_subscriptions" USING btree ("status");--> statement-breakpoint
|
||||
CREATE INDEX "billing_webhook_events_workspace_idx" ON "billing_webhook_events" USING btree ("workspace_id","processed_at");--> statement-breakpoint
|
||||
CREATE INDEX "billing_webhook_events_type_idx" ON "billing_webhook_events" USING btree ("event_type");
|
||||
Reference in New Issue
Block a user