chore: update package licences and migration script
This commit is contained in:
@@ -5,17 +5,10 @@ export default {
|
||||
out: "./migrations",
|
||||
dialect: "postgresql",
|
||||
dbCredentials: {
|
||||
host: process.env.POSTGRES_HOST ?? "localhost",
|
||||
port: process.env.POSTGRES_PORT
|
||||
? parseInt(process.env.POSTGRES_PORT)
|
||||
: 5432,
|
||||
user: process.env.POSTGRES_USER,
|
||||
password: process.env.POSTGRES_PASSWORD,
|
||||
database: process.env.POSTGRES_DATABASE ?? "postgres",
|
||||
ssl: true,
|
||||
url: process.env.POSTGRES_URL ?? "",
|
||||
ssl: process.env.NODE_ENV === "production" ? true : false,
|
||||
},
|
||||
migrations: {
|
||||
prefix: "timestamp",
|
||||
},
|
||||
// tablesFilter: ["kan_*"],
|
||||
} satisfies Config;
|
||||
|
||||
@@ -25,13 +25,14 @@
|
||||
"default": "./src/repository/*.ts"
|
||||
}
|
||||
},
|
||||
"license": "MIT",
|
||||
"license": "GPL-3.0",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"clean": "git clean -xdf .cache .turbo dist node_modules",
|
||||
"dev": "tsc",
|
||||
"format": "prettier --check . --ignore-path ../../.gitignore",
|
||||
"lint": "eslint",
|
||||
"migrate": "pnpm with-env drizzle-kit migrate",
|
||||
"push": "pnpm with-env drizzle-kit push",
|
||||
"studio": "pnpm with-env drizzle-kit studio",
|
||||
"typecheck": "tsc --noEmit --emitDeclarationOnly false",
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import "dotenv/config";
|
||||
|
||||
import { drizzle } from "drizzle-orm/postgres-js";
|
||||
import { migrate } from "drizzle-orm/postgres-js/migrator";
|
||||
import postgres from "postgres";
|
||||
|
||||
const postgresUrl = process.env.POSTGRES_URL;
|
||||
if (!postgresUrl) {
|
||||
throw new Error("POSTGRES_URL environment variable is not set");
|
||||
}
|
||||
|
||||
const migrationClient = postgres(postgresUrl, { max: 1 });
|
||||
console.log("Starting database migration...");
|
||||
|
||||
migrate(drizzle(migrationClient), {
|
||||
migrationsFolder: "./migrations",
|
||||
})
|
||||
.then(() => {
|
||||
console.log("✅ Database migration completed successfully");
|
||||
process.exit(0);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("❌ Migration failed:");
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user