chore:little fixes and formating and linting and patches
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { dirname } from 'node:path';
|
||||
import path, { dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
import { db } from '../index';
|
||||
import {
|
||||
getIsCluster,
|
||||
@@ -38,7 +38,7 @@ async function migrate() {
|
||||
printBoxMessage('📋 Plan', [
|
||||
'\t✅ Finished:',
|
||||
...finishedMigrations.map(
|
||||
(migration) => `\t- ${migration.name} (${migration.createdAt})`,
|
||||
(migration) => `\t- ${migration.name} (${migration.createdAt})`
|
||||
),
|
||||
'',
|
||||
'\t🔄 Will run now:',
|
||||
@@ -46,8 +46,8 @@ async function migrate() {
|
||||
.filter(
|
||||
(migration) =>
|
||||
!finishedMigrations.some(
|
||||
(finishedMigration) => finishedMigration.name === migration,
|
||||
),
|
||||
(finishedMigration) => finishedMigration.name === migration
|
||||
)
|
||||
)
|
||||
.map((migration) => `\t- ${migration}`),
|
||||
]);
|
||||
@@ -63,11 +63,11 @@ async function migrate() {
|
||||
]);
|
||||
|
||||
if (!getIsSelfHosting()) {
|
||||
if (!getIsDry()) {
|
||||
printBoxMessage('🕒 Migrations starts in 10 seconds', []);
|
||||
await new Promise((resolve) => setTimeout(resolve, 10000));
|
||||
} else {
|
||||
if (getIsDry()) {
|
||||
printBoxMessage('🕒 Migrations starts now (dry run)', []);
|
||||
} else {
|
||||
printBoxMessage('🕒 Migrations starts in 10 seconds', []);
|
||||
await new Promise((resolve) => setTimeout(resolve, 10_000));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ async function runMigration(migrationsDir: string, file: string) {
|
||||
try {
|
||||
const migration = await import(path.join(migrationsDir, file));
|
||||
await migration.up();
|
||||
if (!getIsDry() && !getShouldIgnoreRecord()) {
|
||||
if (!(getIsDry() || getShouldIgnoreRecord())) {
|
||||
await db.codeMigration.upsert({
|
||||
where: {
|
||||
name: file,
|
||||
|
||||
Reference in New Issue
Block a user