mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
- Refactored migration script to import schema from the correct path. - Updated package.json scripts for improved execution of migration and truncation tasks. - Added new SQL file to define license-related types and table structure. - Enhanced license management with new fields for Stripe customer and subscription IDs. - Implemented license deactivation logic and improved error handling in license validation. - Introduced health check endpoint for database connectivity verification.
23 lines
983 B
SQL
23 lines
983 B
SQL
CREATE TYPE "public"."billing_type" AS ENUM('monthly', 'annual');--> statement-breakpoint
|
|
CREATE TYPE "public"."license_status" AS ENUM('active', 'expired', 'cancelled', 'payment_pending');--> statement-breakpoint
|
|
CREATE TYPE "public"."license_type" AS ENUM('basic', 'premium', 'business');--> statement-breakpoint
|
|
CREATE TABLE "licenses" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"product_id" text NOT NULL,
|
|
"license_key" text NOT NULL,
|
|
"status" "license_status" DEFAULT 'active' NOT NULL,
|
|
"type" "license_type" NOT NULL,
|
|
"billing_type" "billing_type" NOT NULL,
|
|
"server_ip" text,
|
|
"activated_at" timestamp,
|
|
"last_verified_at" timestamp,
|
|
"expires_at" timestamp NOT NULL,
|
|
"stripeCustomerId" text NOT NULL,
|
|
"stripeSubscriptionId" text NOT NULL,
|
|
"created_at" timestamp DEFAULT CURRENT_TIMESTAMP,
|
|
"updated_at" timestamp DEFAULT CURRENT_TIMESTAMP,
|
|
"metadata" text,
|
|
"email" text NOT NULL,
|
|
CONSTRAINT "licenses_license_key_unique" UNIQUE("license_key")
|
|
);
|