@spfn/core 0.2.0-beta.23 → 0.2.0-beta.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -380,6 +380,8 @@ interface DrizzleConfigOptions {
380
380
  schemaFilter?: string[];
381
381
  /** Auto-detect PostgreSQL schemas from entity files (requires expandGlobs: true) */
382
382
  autoDetectSchemas?: boolean;
383
+ /** Migration prefix strategy (default: 'timestamp') */
384
+ migrationPrefix?: 'index' | 'timestamp' | 'unix' | 'none';
383
385
  }
384
386
  /**
385
387
  * Detect database dialect from connection URL
@@ -411,6 +413,9 @@ declare function getDrizzleConfig(options?: DrizzleConfigOptions): {
411
413
  dbCredentials: {
412
414
  url: string;
413
415
  };
416
+ migrations: {
417
+ prefix: "timestamp" | "none" | "index" | "unix";
418
+ };
414
419
  schemaFilter?: undefined;
415
420
  } | {
416
421
  schema: string | string[];
@@ -420,6 +425,9 @@ declare function getDrizzleConfig(options?: DrizzleConfigOptions): {
420
425
  url: string;
421
426
  };
422
427
  schemaFilter: string[] | undefined;
428
+ migrations: {
429
+ prefix: "timestamp" | "none" | "index" | "unix";
430
+ };
423
431
  };
424
432
  /**
425
433
  * Generate drizzle.config.ts file content
package/dist/db/index.js CHANGED
@@ -1030,7 +1030,10 @@ function getDrizzleConfig(options = {}) {
1030
1030
  schema: schema2,
1031
1031
  out,
1032
1032
  dialect,
1033
- dbCredentials: getDbCredentials(dialect, databaseUrl)
1033
+ dbCredentials: getDbCredentials(dialect, databaseUrl),
1034
+ migrations: {
1035
+ prefix: options.migrationPrefix ?? "timestamp"
1036
+ }
1034
1037
  };
1035
1038
  }
1036
1039
  const userSchema = options.schema ?? "./src/server/entities/**/*.ts";
@@ -1062,7 +1065,10 @@ function getDrizzleConfig(options = {}) {
1062
1065
  out,
1063
1066
  dialect,
1064
1067
  dbCredentials: getDbCredentials(dialect, databaseUrl),
1065
- schemaFilter
1068
+ schemaFilter,
1069
+ migrations: {
1070
+ prefix: options.migrationPrefix ?? "timestamp"
1071
+ }
1066
1072
  };
1067
1073
  }
1068
1074
  function getDbCredentials(dialect, url) {
@@ -1091,13 +1097,15 @@ function generateDrizzleConfigFile(options = {}) {
1091
1097
  ]` : `'${normalizeSchemaPath(config.schema)}'`;
1092
1098
  const schemaFilterLine = config.schemaFilter && config.schemaFilter.length > 0 ? `
1093
1099
  schemaFilter: ${JSON.stringify(config.schemaFilter)},` : "";
1100
+ const migrationsLine = config.migrations ? `
1101
+ migrations: ${JSON.stringify(config.migrations)},` : "";
1094
1102
  return `import { defineConfig } from 'drizzle-kit';
1095
1103
 
1096
1104
  export default defineConfig({
1097
1105
  schema: ${schemaValue},
1098
1106
  out: '${config.out}',
1099
1107
  dialect: '${config.dialect}',
1100
- dbCredentials: ${JSON.stringify(config.dbCredentials, null, 4)},${schemaFilterLine}
1108
+ dbCredentials: ${JSON.stringify(config.dbCredentials, null, 4)},${schemaFilterLine}${migrationsLine}
1101
1109
  });
1102
1110
  `;
1103
1111
  }