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
595 B
TypeScript
23 lines
595 B
TypeScript
import { drizzle } from "drizzle-orm/postgres-js";
|
|
import { migrate } from "drizzle-orm/postgres-js/migrator";
|
|
import postgres from "postgres";
|
|
import "dotenv/config";
|
|
import * as schema from "./src/schema";
|
|
|
|
const connectionString = process.env.DATABASE_URL!;
|
|
const sql = postgres(connectionString, { max: 1 });
|
|
const db = drizzle(sql, { schema });
|
|
|
|
await migrate(db, { migrationsFolder: "drizzle" })
|
|
.then(() => {
|
|
console.log("Migration complete");
|
|
sql.end();
|
|
})
|
|
.catch((error) => {
|
|
console.error("Migration failed", error);
|
|
process.exit(1);
|
|
})
|
|
.finally(() => {
|
|
sql.end();
|
|
});
|