rake-db 2.8.7 → 2.8.9

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.
package/dist/index.d.ts CHANGED
@@ -1,17 +1,17 @@
1
- import * as pqb from 'pqb';
2
- import { ColumnsShape, Db as Db$1, ColumnType, EnumColumn, Adapter, DefaultColumnTypes, DbResult, TransactionAdapter, QueryLogObject, IndexColumnOptions, IndexOptions, ForeignKeyOptions, TextColumn, NoPrimaryKeyOption, TableData, SingleColumnIndexOptions, AdapterOptions, QueryLogOptions } from 'pqb';
3
1
  import * as orchid_core from 'orchid-core';
4
2
  import { ColumnTypesBase, EmptyObject, RawExpression, raw, MaybeArray } from 'orchid-core';
3
+ import * as pqb from 'pqb';
4
+ import { ColumnsShape, Db as Db$1, ColumnType, EnumColumn, Adapter, DefaultColumnTypes, DbResult, TransactionAdapter, QueryLogObject, IndexColumnOptions, IndexOptions, ForeignKeyOptions, TextColumn, NoPrimaryKeyOption, TableData, SingleColumnIndexOptions, AdapterOptions, QueryLogOptions } from 'pqb';
5
5
 
6
6
  type CreateTableResult<Table extends string, Shape extends ColumnsShape> = {
7
7
  table: Db$1<Table, Shape>;
8
8
  };
9
9
 
10
- declare function add(this: ColumnTypesBase, item: ColumnType, options?: {
10
+ declare function add(item: ColumnType, options?: {
11
11
  dropMode?: DropMode;
12
12
  }): RakeDbAst.ChangeTableItem.Column;
13
- declare function add(this: ColumnTypesBase, emptyObject: EmptyObject): EmptyObject;
14
- declare function add(this: ColumnTypesBase, items: Record<string, ColumnType>, options?: {
13
+ declare function add(emptyObject: EmptyObject): EmptyObject;
14
+ declare function add(items: Record<string, ColumnType>, options?: {
15
15
  dropMode?: DropMode;
16
16
  }): Record<string, RakeDbAst.ChangeTableItem.Column>;
17
17
  type Change = RakeDbAst.ChangeTableItem.Change & ChangeOptions;
@@ -21,6 +21,7 @@ type ChangeOptions = {
21
21
  };
22
22
  type TableChangeMethods = typeof tableChangeMethods;
23
23
  declare const tableChangeMethods: {
24
+ name(this: ColumnTypesBase, name: string): any;
24
25
  add: typeof add;
25
26
  drop: typeof add;
26
27
  change(this: ColumnTypesBase, from: ColumnType | Change, to: ColumnType | Change, options?: ChangeOptions): Change;
@@ -29,7 +30,7 @@ declare const tableChangeMethods: {
29
30
  nonNullable(): Change;
30
31
  comment(comment: string | null): Change;
31
32
  rename(name: string): RakeDbAst.ChangeTableItem.Rename;
32
- enum(this: ColumnTypesBase, name: string): EnumColumn<string, [string, ...string[]]>;
33
+ enum(name: string): EnumColumn<string, [string, ...string[]]>;
33
34
  };
34
35
  type TableChanger<CT extends ColumnTypesBase> = MigrationColumnTypes<CT> & TableChangeMethods;
35
36
  type TableChangeData = Record<string, RakeDbAst.ChangeTableItem.Column | RakeDbAst.ChangeTableItem.Rename | Change | EmptyObject>;
@@ -78,7 +79,7 @@ type ConstraintArg = {
78
79
  check?: RawExpression;
79
80
  dropMode?: DropMode;
80
81
  };
81
- declare const createMigrationInterface: <CT extends ColumnTypesBase>(tx: TransactionAdapter, up: boolean, config: RakeDbConfig<CT>) => Migration;
82
+ declare const createMigrationInterface: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>>(tx: TransactionAdapter, up: boolean, config: RakeDbConfig<CT>) => Migration;
82
83
  declare class MigrationBase<CT extends ColumnTypesBase> {
83
84
  adapter: TransactionAdapter;
84
85
  log?: QueryLogObject;
@@ -310,23 +311,23 @@ type AppCodeUpdater = {
310
311
  afterAll(params: AppCodeUpdaterParams): Promise<void>;
311
312
  };
312
313
 
313
- declare const createDb: <CT extends ColumnTypesBase>(arg: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>) => Promise<void>;
314
+ declare const createDb: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>>(arg: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>) => Promise<void>;
314
315
  declare const dropDb: (arg: MaybeArray<AdapterOptions>) => Promise<void>;
315
- declare const resetDb: <CT extends ColumnTypesBase>(arg: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>) => Promise<void>;
316
+ declare const resetDb: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>>(arg: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>) => Promise<void>;
316
317
 
317
- declare const writeMigrationFile: <CT extends ColumnTypesBase>(config: RakeDbConfig<CT>, version: string, name: string, content: (importPath: string, name: string) => string) => Promise<void>;
318
- declare const generate: <CT extends ColumnTypesBase>(config: RakeDbConfig<CT>, [name]: string[]) => Promise<void>;
318
+ declare const writeMigrationFile: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>>(config: RakeDbConfig<CT>, version: string, name: string, content: (importPath: string, name: string) => string) => Promise<void>;
319
+ declare const generate: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>>(config: RakeDbConfig<CT>, [name]: string[]) => Promise<void>;
319
320
  declare const makeFileTimeStamp: () => string;
320
321
 
321
322
  type ChangeCallback<CT extends ColumnTypesBase = ColumnTypesBase> = (db: Migration<CT>, up: boolean) => Promise<void>;
322
323
 
323
- declare const migrateOrRollback: <CT extends ColumnTypesBase>(options: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>, args: string[], up: boolean) => Promise<void>;
324
+ declare const migrateOrRollback: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>>(options: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>, args: string[], up: boolean) => Promise<void>;
324
325
  declare const changeCache: Record<string, ChangeCallback[] | undefined>;
325
- declare const migrate: <CT extends ColumnTypesBase>(options: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>, args?: string[]) => Promise<void>;
326
- declare const rollback: <CT extends ColumnTypesBase>(options: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>, args?: string[]) => Promise<void>;
327
- declare const redo: <CT extends ColumnTypesBase>(options: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>, args?: string[]) => Promise<void>;
326
+ declare const migrate: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>>(options: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>, args?: string[]) => Promise<void>;
327
+ declare const rollback: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>>(options: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>, args?: string[]) => Promise<void>;
328
+ declare const redo: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>>(options: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>, args?: string[]) => Promise<void>;
328
329
 
329
- declare const rakeDb: <CT extends ColumnTypesBase = {
330
+ declare const rakeDb: <CT extends Record<string, orchid_core.AnyColumnTypeCreator> = {
330
331
  timestamps: <T extends orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>(this: {
331
332
  name(name: string): {
332
333
  timestamp(): T;
@@ -347,49 +348,49 @@ declare const rakeDb: <CT extends ColumnTypesBase = {
347
348
  };
348
349
  name: typeof orchid_core.name;
349
350
  raw: (sql: string, values?: false | Record<string, unknown> | undefined) => orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>;
350
- smallint(this: ColumnTypesBase): pqb.SmallIntColumn;
351
- integer(this: ColumnTypesBase): pqb.IntegerColumn;
352
- bigint(this: ColumnTypesBase): pqb.BigIntColumn;
353
- numeric<Precision extends number | undefined = undefined, Scale extends number | undefined = undefined>(this: ColumnTypesBase, precision?: Precision | undefined, scale?: Scale | undefined): pqb.DecimalColumn<Precision, Scale>;
354
- decimal<Precision_1 extends number | undefined = undefined, Scale_1 extends number | undefined = undefined>(this: ColumnTypesBase, precision?: Precision_1 | undefined, scale?: Scale_1 | undefined): pqb.DecimalColumn<Precision_1, Scale_1>;
355
- real(this: ColumnTypesBase): pqb.RealColumn;
356
- doublePrecision(this: ColumnTypesBase): pqb.DoublePrecisionColumn;
357
- identity(this: ColumnTypesBase, options?: pqb.TableData.Identity | undefined): pqb.IntegerColumn;
358
- smallSerial(this: ColumnTypesBase): pqb.SmallSerialColumn;
359
- serial(this: ColumnTypesBase): pqb.SerialColumn;
360
- bigSerial(this: ColumnTypesBase): pqb.BigSerialColumn;
361
- money(this: ColumnTypesBase): pqb.MoneyColumn;
362
- varchar<Limit extends number | undefined = undefined>(this: ColumnTypesBase, limit?: Limit | undefined): pqb.VarCharColumn<Limit>;
363
- char<Limit_1 extends number | undefined = undefined>(this: ColumnTypesBase, limit?: Limit_1 | undefined): pqb.CharColumn<Limit_1>;
364
- text: (this: ColumnTypesBase, min: number, max: number) => pqb.TextColumn;
365
- string: (this: ColumnTypesBase, min: number, max: number) => pqb.TextColumn;
366
- citext(this: ColumnTypesBase, min: number, max: number): pqb.CitextColumn;
367
- bytea(this: ColumnTypesBase): pqb.ByteaColumn;
368
- date(this: ColumnTypesBase): pqb.DateColumn;
369
- timestampWithoutTimeZone<Precision_2 extends number>(this: ColumnTypesBase, precision?: Precision_2 | undefined): pqb.TimestampColumn<Precision_2>;
370
- timestamp<Precision_3 extends number | undefined = undefined>(this: ColumnTypesBase, precision?: Precision_3 | undefined): pqb.TimestampTzColumn<number>;
371
- time<Precision_4 extends number | undefined = undefined>(this: ColumnTypesBase, precision?: Precision_4 | undefined): pqb.TimeColumn<Precision_4>;
372
- interval<Fields extends string | undefined = undefined, Precision_5 extends number | undefined = undefined>(this: ColumnTypesBase, fields?: Fields | undefined, precision?: Precision_5 | undefined): pqb.IntervalColumn<Fields, Precision_5>;
373
- boolean(this: ColumnTypesBase): pqb.BooleanColumn;
374
- enum<U extends string, T_2 extends [U, ...U[]]>(this: ColumnTypesBase, dataType: string, type: T_2): pqb.EnumColumn<U, T_2>;
375
- point(this: ColumnTypesBase): pqb.PointColumn;
376
- line(this: ColumnTypesBase): pqb.LineColumn;
377
- lseg(this: ColumnTypesBase): pqb.LsegColumn;
378
- box(this: ColumnTypesBase): pqb.BoxColumn;
379
- path(this: ColumnTypesBase): pqb.PathColumn;
380
- polygon(this: ColumnTypesBase): pqb.PolygonColumn;
381
- circle(this: ColumnTypesBase): pqb.CircleColumn;
382
- cidr(this: ColumnTypesBase): pqb.CidrColumn;
383
- inet(this: ColumnTypesBase): pqb.InetColumn;
384
- macaddr(this: ColumnTypesBase): pqb.MacAddrColumn;
385
- macaddr8(this: ColumnTypesBase): pqb.MacAddr8Column;
386
- bit<Length extends number>(this: ColumnTypesBase, length: Length): pqb.BitColumn<Length>;
387
- bitVarying<Length_1 extends number | undefined = undefined>(this: ColumnTypesBase, length?: Length_1 | undefined): pqb.BitVaryingColumn<Length_1>;
388
- tsvector(this: ColumnTypesBase): pqb.TsVectorColumn;
389
- tsquery(this: ColumnTypesBase): pqb.TsQueryColumn;
390
- uuid(this: ColumnTypesBase): pqb.UUIDColumn;
391
- xml(this: ColumnTypesBase): pqb.XMLColumn;
392
- json<Type extends orchid_core.JSONTypeAny>(this: ColumnTypesBase, schemaOrFn: Type | ((j: {
351
+ smallint(): pqb.SmallIntColumn;
352
+ integer(): pqb.IntegerColumn;
353
+ bigint(): pqb.BigIntColumn;
354
+ numeric<Precision extends number | undefined = undefined, Scale extends number | undefined = undefined>(precision?: Precision | undefined, scale?: Scale | undefined): pqb.DecimalColumn<Precision, Scale>;
355
+ decimal<Precision_1 extends number | undefined = undefined, Scale_1 extends number | undefined = undefined>(precision?: Precision_1 | undefined, scale?: Scale_1 | undefined): pqb.DecimalColumn<Precision_1, Scale_1>;
356
+ real(): pqb.RealColumn;
357
+ doublePrecision(): pqb.DoublePrecisionColumn;
358
+ identity(options?: pqb.TableData.Identity | undefined): pqb.IntegerColumn;
359
+ smallSerial(): pqb.SmallSerialColumn;
360
+ serial(): pqb.SerialColumn;
361
+ bigSerial(): pqb.BigSerialColumn;
362
+ money(): pqb.MoneyColumn;
363
+ varchar<Limit extends number | undefined = undefined>(limit?: Limit | undefined): pqb.VarCharColumn<Limit>;
364
+ char<Limit_1 extends number | undefined = undefined>(limit?: Limit_1 | undefined): pqb.CharColumn<Limit_1>;
365
+ text: (min: number, max: number) => pqb.TextColumn;
366
+ string: (min: number, max: number) => pqb.TextColumn;
367
+ citext(min: number, max: number): pqb.CitextColumn;
368
+ bytea(): pqb.ByteaColumn;
369
+ date(): pqb.DateColumn;
370
+ timestampWithoutTimeZone<Precision_2 extends number>(precision?: Precision_2 | undefined): pqb.TimestampColumn<Precision_2>;
371
+ timestamp<Precision_3 extends number | undefined = undefined>(precision?: Precision_3 | undefined): pqb.TimestampTzColumn<number>;
372
+ time<Precision_4 extends number | undefined = undefined>(precision?: Precision_4 | undefined): pqb.TimeColumn<Precision_4>;
373
+ interval<Fields extends string | undefined = undefined, Precision_5 extends number | undefined = undefined>(fields?: Fields | undefined, precision?: Precision_5 | undefined): pqb.IntervalColumn<Fields, Precision_5>;
374
+ boolean(): pqb.BooleanColumn;
375
+ enum<U extends string, T_2 extends [U, ...U[]]>(dataType: string, type: T_2): pqb.EnumColumn<U, T_2>;
376
+ point(): pqb.PointColumn;
377
+ line(): pqb.LineColumn;
378
+ lseg(): pqb.LsegColumn;
379
+ box(): pqb.BoxColumn;
380
+ path(): pqb.PathColumn;
381
+ polygon(): pqb.PolygonColumn;
382
+ circle(): pqb.CircleColumn;
383
+ cidr(): pqb.CidrColumn;
384
+ inet(): pqb.InetColumn;
385
+ macaddr(): pqb.MacAddrColumn;
386
+ macaddr8(): pqb.MacAddr8Column;
387
+ bit<Length extends number>(length: Length): pqb.BitColumn<Length>;
388
+ bitVarying<Length_1 extends number | undefined = undefined>(length?: Length_1 | undefined): pqb.BitVaryingColumn<Length_1>;
389
+ tsvector(): pqb.TsVectorColumn;
390
+ tsquery(): pqb.TsQueryColumn;
391
+ uuid(): pqb.UUIDColumn;
392
+ xml(): pqb.XMLColumn;
393
+ json<Type extends orchid_core.JSONTypeAny>(schemaOrFn: Type | ((j: {
393
394
  set: <Value extends orchid_core.JSONTypeAny>(valueType: Value) => orchid_core.JSONSet<Value>;
394
395
  tuple: <T_3 extends [] | orchid_core.JSONTupleItems, Rest extends orchid_core.JSONTypeAny | null = null>(items: T_3, rest?: Rest) => orchid_core.JSONTuple<T_3, Rest>;
395
396
  union: <T_4 extends [orchid_core.JSONTypeAny, orchid_core.JSONTypeAny, ...orchid_core.JSONTypeAny[]]>(types: T_4) => orchid_core.JSONUnion<T_4>;
@@ -422,10 +423,10 @@ declare const rakeDb: <CT extends ColumnTypesBase = {
422
423
  optional: <T_17 extends orchid_core.JSONTypeAny>(type: T_17) => orchid_core.JSONOptional<T_17>;
423
424
  record: typeof orchid_core.record;
424
425
  }) => Type)): pqb.JSONColumn<Type>;
425
- jsonText(this: ColumnTypesBase): pqb.JSONTextColumn;
426
- array<Item extends pqb.ColumnType<unknown, orchid_core.BaseOperators, unknown>>(this: ColumnTypesBase, item: Item): pqb.ArrayColumn<Item>;
427
- type(this: ColumnTypesBase, dataType: string): pqb.CustomTypeColumn;
428
- domain(this: ColumnTypesBase, dataType: string): pqb.DomainColumn;
426
+ jsonText(): pqb.JSONTextColumn;
427
+ array<Item extends pqb.ColumnType<unknown, orchid_core.BaseOperators, unknown>>(item: Item): pqb.ArrayColumn<Item>;
428
+ type(dataType: string): pqb.CustomTypeColumn;
429
+ domain(dataType: string): pqb.DomainColumn;
429
430
  primaryKey(columns: string[], options?: {
430
431
  name?: string | undefined;
431
432
  } | undefined): {};
@@ -446,8 +447,8 @@ declare const rakeDb: <CT extends ColumnTypesBase = {
446
447
  promise: Promise<void>;
447
448
  };
448
449
 
449
- declare const saveMigratedVersion: <CT extends ColumnTypesBase>(db: SilentQueries, version: string, config: RakeDbConfig<CT>) => Promise<void>;
450
- declare const removeMigratedVersion: <CT extends ColumnTypesBase>(db: SilentQueries, version: string, config: RakeDbConfig<CT>) => Promise<void>;
451
- declare const getMigratedVersionsMap: <CT extends ColumnTypesBase>(db: Adapter, config: RakeDbConfig<CT>) => Promise<Record<string, boolean>>;
450
+ declare const saveMigratedVersion: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>>(db: SilentQueries, version: string, config: RakeDbConfig<CT>) => Promise<void>;
451
+ declare const removeMigratedVersion: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>>(db: SilentQueries, version: string, config: RakeDbConfig<CT>) => Promise<void>;
452
+ declare const getMigratedVersionsMap: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>>(db: Adapter, config: RakeDbConfig<CT>) => Promise<Record<string, boolean>>;
452
453
 
453
454
  export { AppCodeUpdater, ChangeTableCallback, ChangeTableOptions, ColumnComment, ColumnsShapeCallback, DropMode, Migration, MigrationBase, MigrationColumnTypes, RakeDbAst, RakeDbConfig, SilentQueries, TableOptions, changeCache, createDb, createMigrationInterface, dropDb, generate, getMigratedVersionsMap, makeFileTimeStamp, migrate, migrateOrRollback, rakeDb, redo, removeMigratedVersion, resetDb, rollback, saveMigratedVersion, writeMigrationFile };
package/dist/index.js CHANGED
@@ -526,7 +526,7 @@ const primaryKeyToSql = (primaryKey) => {
526
526
 
527
527
  const tableMethods = {
528
528
  enum(name) {
529
- return new pqb.EnumColumn(this, name, []);
529
+ return new pqb.EnumColumn(name, []);
530
530
  }
531
531
  };
532
532
 
@@ -774,7 +774,7 @@ const mergeTableData = (a, b) => {
774
774
  };
775
775
  function add(item, options) {
776
776
  if (item instanceof pqb.ColumnType) {
777
- return addOrDrop(this, "add", item, options);
777
+ return addOrDrop("add", item, options);
778
778
  } else if (item === orchidCore.emptyObject) {
779
779
  mergeTableData(changeTableData.add, pqb.getTableData());
780
780
  pqb.resetTableData();
@@ -793,7 +793,7 @@ function add(item, options) {
793
793
  }
794
794
  const drop = function(item, options) {
795
795
  if (item instanceof pqb.ColumnType) {
796
- return addOrDrop(this, "drop", item, options);
796
+ return addOrDrop("drop", item, options);
797
797
  } else if (item === orchidCore.emptyObject) {
798
798
  mergeTableData(changeTableData.drop, pqb.getTableData());
799
799
  pqb.resetTableData();
@@ -810,9 +810,10 @@ const drop = function(item, options) {
810
810
  return result;
811
811
  }
812
812
  };
813
- const addOrDrop = (types, type, item, options) => {
814
- if (types[orchidCore.nameKey]) {
815
- item.data.name = types[orchidCore.nameKey];
813
+ const addOrDrop = (type, item, options) => {
814
+ const name = orchidCore.consumeColumnName();
815
+ if (name) {
816
+ item.data.name = name;
816
817
  }
817
818
  if (item instanceof pqb.UnknownColumn) {
818
819
  const empty = columnTypeToColumnChange({
@@ -856,13 +857,19 @@ const columnTypeToColumnChange = (item) => {
856
857
  }
857
858
  return item.to;
858
859
  };
860
+ const nameKey = Symbol("name");
859
861
  const tableChangeMethods = __spreadProps$2(__spreadValues$3({}, tableMethods), {
862
+ name(name) {
863
+ const types = Object.create(pqb.columnTypes.name.call(this, name));
864
+ types[nameKey] = name;
865
+ return types;
866
+ },
860
867
  add,
861
868
  drop,
862
869
  change(from, to, options) {
863
870
  return __spreadValues$3({
864
871
  type: "change",
865
- name: this[orchidCore.nameKey],
872
+ name: this[nameKey],
866
873
  from: columnTypeToColumnChange(from),
867
874
  to: columnTypeToColumnChange(to)
868
875
  }, options);
@@ -2517,22 +2524,22 @@ const getColumn = (ctx, data, domains, _a) => {
2517
2524
  } else {
2518
2525
  const domainColumn = domains[`${typeSchema}.${type}`];
2519
2526
  if (domainColumn) {
2520
- column = new pqb.DomainColumn({}, type).as(domainColumn);
2527
+ column = new pqb.DomainColumn(type).as(domainColumn);
2521
2528
  } else {
2522
2529
  const enumType = data.enums.find(
2523
2530
  (item) => item.name === type && item.schemaName === typeSchema
2524
2531
  );
2525
2532
  if (enumType) {
2526
- column = new pqb.EnumColumn({}, type, enumType.values);
2533
+ column = new pqb.EnumColumn(type, enumType.values);
2527
2534
  } else {
2528
- column = new pqb.CustomTypeColumn({}, type);
2535
+ column = new pqb.CustomTypeColumn(type);
2529
2536
  ((_b2 = (_a2 = ctx.unsupportedTypes)[type]) != null ? _b2 : _a2[type] = []).push(
2530
2537
  `${schemaName}${tableName ? `.${tableName}` : ""}.${name}`
2531
2538
  );
2532
2539
  }
2533
2540
  }
2534
2541
  }
2535
- return isArray ? new pqb.ArrayColumn({}, column) : column;
2542
+ return isArray ? new pqb.ArrayColumn(column) : column;
2536
2543
  };
2537
2544
  const getColumnType = (type, isSerial) => {
2538
2545
  if (!isSerial)
@@ -2772,9 +2779,10 @@ const makeColumnsShape = (ctx, data, domains, tableName, columns, primaryKey, in
2772
2779
  const camelCaseName = orchidCore.toCamelCase(item.name);
2773
2780
  if (ctx.snakeCase) {
2774
2781
  const snakeCaseName = orchidCore.toSnakeCase(camelCaseName);
2775
- column.data.name = snakeCaseName === item.name ? void 0 : item.name;
2776
- } else {
2777
- column.data.name = camelCaseName === item.name ? void 0 : item.name;
2782
+ if (snakeCaseName !== item.name)
2783
+ column.data.name = item.name;
2784
+ } else if (camelCaseName !== item.name) {
2785
+ column.data.name = item.name;
2778
2786
  }
2779
2787
  shape[camelCaseName] = column;
2780
2788
  }