mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
feat(licenses): update database schema and enhance license management
- 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.
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
CREATE TYPE "public"."billing_type" AS ENUM('monthly', 'annual');--> statement-breakpoint
|
||||
CREATE TYPE "public"."license_status" AS ENUM('active', 'expired', 'cancelled');--> 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,
|
||||
"customer_id" text NOT NULL,
|
||||
"product_id" text NOT NULL,
|
||||
"license_key" text NOT NULL,
|
||||
"status" "license_status" DEFAULT 'active' NOT NULL,
|
||||
@@ -13,6 +12,8 @@ CREATE TABLE "licenses" (
|
||||
"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,
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"id": "41745f43-6627-49f6-afa3-ab192559b5a7",
|
||||
"id": "5a996744-b11f-4f1a-b4b0-91f6bf5c2bed",
|
||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
@@ -15,12 +15,6 @@
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"customer_id": {
|
||||
"name": "customer_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"product_id": {
|
||||
"name": "product_id",
|
||||
"type": "text",
|
||||
@@ -79,6 +73,18 @@
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"stripeCustomerId": {
|
||||
"name": "stripeCustomerId",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"stripeSubscriptionId": {
|
||||
"name": "stripeSubscriptionId",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"created_at": {
|
||||
"name": "created_at",
|
||||
"type": "timestamp",
|
||||
@@ -138,7 +144,8 @@
|
||||
"values": [
|
||||
"active",
|
||||
"expired",
|
||||
"cancelled"
|
||||
"cancelled",
|
||||
"payment_pending"
|
||||
]
|
||||
},
|
||||
"public.license_type": {
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
{
|
||||
"idx": 0,
|
||||
"version": "7",
|
||||
"when": 1742364501431,
|
||||
"tag": "0000_furry_nico_minoru",
|
||||
"when": 1742369437742,
|
||||
"tag": "0000_noisy_epoch",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user