drizzle-seed 0.3.1-fd5d1e8 → 0.3.1-fd8bfcc
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/index.cjs +24 -29
- package/index.cjs.map +1 -1
- package/index.d.cts +8 -8
- package/index.d.mts +8 -8
- package/index.d.ts +8 -8
- package/index.mjs +25 -30
- package/index.mjs.map +1 -1
- package/package.json +6 -6
- package/services/SeedService.d.cts +4 -4
- package/services/SeedService.d.mts +4 -4
- package/services/SeedService.d.ts +4 -4
package/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Relations } from 'drizzle-orm/_relations';
|
|
2
2
|
import type { MySqlColumn, MySqlSchema } from 'drizzle-orm/mysql-core';
|
|
3
3
|
import { MySqlDatabase, MySqlTable } from 'drizzle-orm/mysql-core';
|
|
4
|
-
import
|
|
4
|
+
import { PgColumn, PgSchema } from 'drizzle-orm/pg-core';
|
|
5
5
|
import { PgDatabase, PgTable } from 'drizzle-orm/pg-core';
|
|
6
6
|
import type { SQLiteColumn } from 'drizzle-orm/sqlite-core';
|
|
7
7
|
import { BaseSQLiteDatabase, SQLiteTable } from 'drizzle-orm/sqlite-core';
|
|
@@ -9,9 +9,9 @@ import { generatorsFuncs, generatorsFuncsV2 } from './services/GeneratorFuncs.js
|
|
|
9
9
|
import type { AbstractGenerator } from './services/Generators.js';
|
|
10
10
|
import type { DrizzleStudioObjectType, DrizzleStudioRelationType } from './types/drizzleStudio.js';
|
|
11
11
|
import type { RefinementsType } from './types/seedService.js';
|
|
12
|
-
type InferCallbackType<DB extends PgDatabase<any, any, any, any
|
|
12
|
+
type InferCallbackType<DB extends PgDatabase<any, any, any, any> | MySqlDatabase<any, any, any, any, any> | BaseSQLiteDatabase<any, any, any, any, any>, SCHEMA extends {
|
|
13
13
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
14
|
-
}> = DB extends PgDatabase<any, any, any, any
|
|
14
|
+
}> = DB extends PgDatabase<any, any, any, any> ? SCHEMA extends {
|
|
15
15
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
16
16
|
} ? {
|
|
17
17
|
[table in keyof SCHEMA as SCHEMA[table] extends PgTable ? table : never]?: {
|
|
@@ -26,7 +26,7 @@ type InferCallbackType<DB extends PgDatabase<any, any, any, any, any> | MySqlDat
|
|
|
26
26
|
}[];
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
} : {} : DB extends MySqlDatabase<any, any, any, any, any
|
|
29
|
+
} : {} : DB extends MySqlDatabase<any, any, any, any, any> ? SCHEMA extends {
|
|
30
30
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
31
31
|
} ? {
|
|
32
32
|
[table in keyof SCHEMA as SCHEMA[table] extends MySqlTable ? table : never]?: {
|
|
@@ -41,7 +41,7 @@ type InferCallbackType<DB extends PgDatabase<any, any, any, any, any> | MySqlDat
|
|
|
41
41
|
}[];
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
-
} : {} : DB extends BaseSQLiteDatabase<any, any, any, any, any
|
|
44
|
+
} : {} : DB extends BaseSQLiteDatabase<any, any, any, any, any> ? SCHEMA extends {
|
|
45
45
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
46
46
|
} ? {
|
|
47
47
|
[table in keyof SCHEMA as SCHEMA[table] extends SQLiteTable ? table : never]?: {
|
|
@@ -57,7 +57,7 @@ type InferCallbackType<DB extends PgDatabase<any, any, any, any, any> | MySqlDat
|
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
59
|
} : {} : {};
|
|
60
|
-
declare class SeedPromise<DB extends PgDatabase<any, any, any, any
|
|
60
|
+
declare class SeedPromise<DB extends PgDatabase<any, any, any, any> | MySqlDatabase<any, any, any, any, any> | BaseSQLiteDatabase<any, any, any, any, any>, SCHEMA extends {
|
|
61
61
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
62
62
|
}, VERSION extends string | undefined> implements Promise<void> {
|
|
63
63
|
private db;
|
|
@@ -278,7 +278,7 @@ export declare function seedForDrizzleStudio({ sqlDialect, drizzleStudioObject,
|
|
|
278
278
|
*
|
|
279
279
|
* ```
|
|
280
280
|
*/
|
|
281
|
-
export declare function seed<DB extends PgDatabase<any, any, any, any
|
|
281
|
+
export declare function seed<DB extends PgDatabase<any, any, any, any> | MySqlDatabase<any, any, any, any, any> | BaseSQLiteDatabase<any, any, any, any, any>, SCHEMA extends {
|
|
282
282
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations | any;
|
|
283
283
|
}, VERSION extends '2' | '1' | undefined>(db: DB, schema: SCHEMA, options?: {
|
|
284
284
|
count?: number;
|
|
@@ -325,7 +325,7 @@ export declare function seed<DB extends PgDatabase<any, any, any, any, any> | My
|
|
|
325
325
|
* await reset(db, schema);
|
|
326
326
|
* ```
|
|
327
327
|
*/
|
|
328
|
-
export declare function reset<DB extends PgDatabase<any, any, any, any
|
|
328
|
+
export declare function reset<DB extends PgDatabase<any, any, any, any> | MySqlDatabase<any, any, any, any, any> | BaseSQLiteDatabase<any, any, any, any, any>, SCHEMA extends {
|
|
329
329
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | any;
|
|
330
330
|
}>(db: DB, schema: SCHEMA): Promise<void>;
|
|
331
331
|
export { default as cities } from './datasets/cityNames.js';
|
package/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Relations } from 'drizzle-orm/_relations';
|
|
2
2
|
import type { MySqlColumn, MySqlSchema } from 'drizzle-orm/mysql-core';
|
|
3
3
|
import { MySqlDatabase, MySqlTable } from 'drizzle-orm/mysql-core';
|
|
4
|
-
import
|
|
4
|
+
import { PgColumn, PgSchema } from 'drizzle-orm/pg-core';
|
|
5
5
|
import { PgDatabase, PgTable } from 'drizzle-orm/pg-core';
|
|
6
6
|
import type { SQLiteColumn } from 'drizzle-orm/sqlite-core';
|
|
7
7
|
import { BaseSQLiteDatabase, SQLiteTable } from 'drizzle-orm/sqlite-core';
|
|
@@ -9,9 +9,9 @@ import { generatorsFuncs, generatorsFuncsV2 } from './services/GeneratorFuncs.js
|
|
|
9
9
|
import type { AbstractGenerator } from './services/Generators.js';
|
|
10
10
|
import type { DrizzleStudioObjectType, DrizzleStudioRelationType } from './types/drizzleStudio.js';
|
|
11
11
|
import type { RefinementsType } from './types/seedService.js';
|
|
12
|
-
type InferCallbackType<DB extends PgDatabase<any, any, any, any
|
|
12
|
+
type InferCallbackType<DB extends PgDatabase<any, any, any, any> | MySqlDatabase<any, any, any, any, any> | BaseSQLiteDatabase<any, any, any, any, any>, SCHEMA extends {
|
|
13
13
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
14
|
-
}> = DB extends PgDatabase<any, any, any, any
|
|
14
|
+
}> = DB extends PgDatabase<any, any, any, any> ? SCHEMA extends {
|
|
15
15
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
16
16
|
} ? {
|
|
17
17
|
[table in keyof SCHEMA as SCHEMA[table] extends PgTable ? table : never]?: {
|
|
@@ -26,7 +26,7 @@ type InferCallbackType<DB extends PgDatabase<any, any, any, any, any> | MySqlDat
|
|
|
26
26
|
}[];
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
} : {} : DB extends MySqlDatabase<any, any, any, any, any
|
|
29
|
+
} : {} : DB extends MySqlDatabase<any, any, any, any, any> ? SCHEMA extends {
|
|
30
30
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
31
31
|
} ? {
|
|
32
32
|
[table in keyof SCHEMA as SCHEMA[table] extends MySqlTable ? table : never]?: {
|
|
@@ -41,7 +41,7 @@ type InferCallbackType<DB extends PgDatabase<any, any, any, any, any> | MySqlDat
|
|
|
41
41
|
}[];
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
-
} : {} : DB extends BaseSQLiteDatabase<any, any, any, any, any
|
|
44
|
+
} : {} : DB extends BaseSQLiteDatabase<any, any, any, any, any> ? SCHEMA extends {
|
|
45
45
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
46
46
|
} ? {
|
|
47
47
|
[table in keyof SCHEMA as SCHEMA[table] extends SQLiteTable ? table : never]?: {
|
|
@@ -57,7 +57,7 @@ type InferCallbackType<DB extends PgDatabase<any, any, any, any, any> | MySqlDat
|
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
59
|
} : {} : {};
|
|
60
|
-
declare class SeedPromise<DB extends PgDatabase<any, any, any, any
|
|
60
|
+
declare class SeedPromise<DB extends PgDatabase<any, any, any, any> | MySqlDatabase<any, any, any, any, any> | BaseSQLiteDatabase<any, any, any, any, any>, SCHEMA extends {
|
|
61
61
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
62
62
|
}, VERSION extends string | undefined> implements Promise<void> {
|
|
63
63
|
private db;
|
|
@@ -278,7 +278,7 @@ export declare function seedForDrizzleStudio({ sqlDialect, drizzleStudioObject,
|
|
|
278
278
|
*
|
|
279
279
|
* ```
|
|
280
280
|
*/
|
|
281
|
-
export declare function seed<DB extends PgDatabase<any, any, any, any
|
|
281
|
+
export declare function seed<DB extends PgDatabase<any, any, any, any> | MySqlDatabase<any, any, any, any, any> | BaseSQLiteDatabase<any, any, any, any, any>, SCHEMA extends {
|
|
282
282
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations | any;
|
|
283
283
|
}, VERSION extends '2' | '1' | undefined>(db: DB, schema: SCHEMA, options?: {
|
|
284
284
|
count?: number;
|
|
@@ -325,7 +325,7 @@ export declare function seed<DB extends PgDatabase<any, any, any, any, any> | My
|
|
|
325
325
|
* await reset(db, schema);
|
|
326
326
|
* ```
|
|
327
327
|
*/
|
|
328
|
-
export declare function reset<DB extends PgDatabase<any, any, any, any
|
|
328
|
+
export declare function reset<DB extends PgDatabase<any, any, any, any> | MySqlDatabase<any, any, any, any, any> | BaseSQLiteDatabase<any, any, any, any, any>, SCHEMA extends {
|
|
329
329
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | any;
|
|
330
330
|
}>(db: DB, schema: SCHEMA): Promise<void>;
|
|
331
331
|
export { default as cities } from './datasets/cityNames.js';
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Relations } from 'drizzle-orm/_relations';
|
|
2
2
|
import type { MySqlColumn, MySqlSchema } from 'drizzle-orm/mysql-core';
|
|
3
3
|
import { MySqlDatabase, MySqlTable } from 'drizzle-orm/mysql-core';
|
|
4
|
-
import
|
|
4
|
+
import { PgColumn, PgSchema } from 'drizzle-orm/pg-core';
|
|
5
5
|
import { PgDatabase, PgTable } from 'drizzle-orm/pg-core';
|
|
6
6
|
import type { SQLiteColumn } from 'drizzle-orm/sqlite-core';
|
|
7
7
|
import { BaseSQLiteDatabase, SQLiteTable } from 'drizzle-orm/sqlite-core';
|
|
@@ -9,9 +9,9 @@ import { generatorsFuncs, generatorsFuncsV2 } from './services/GeneratorFuncs.js
|
|
|
9
9
|
import type { AbstractGenerator } from './services/Generators.js';
|
|
10
10
|
import type { DrizzleStudioObjectType, DrizzleStudioRelationType } from './types/drizzleStudio.js';
|
|
11
11
|
import type { RefinementsType } from './types/seedService.js';
|
|
12
|
-
type InferCallbackType<DB extends PgDatabase<any, any, any, any
|
|
12
|
+
type InferCallbackType<DB extends PgDatabase<any, any, any, any> | MySqlDatabase<any, any, any, any, any> | BaseSQLiteDatabase<any, any, any, any, any>, SCHEMA extends {
|
|
13
13
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
14
|
-
}> = DB extends PgDatabase<any, any, any, any
|
|
14
|
+
}> = DB extends PgDatabase<any, any, any, any> ? SCHEMA extends {
|
|
15
15
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
16
16
|
} ? {
|
|
17
17
|
[table in keyof SCHEMA as SCHEMA[table] extends PgTable ? table : never]?: {
|
|
@@ -26,7 +26,7 @@ type InferCallbackType<DB extends PgDatabase<any, any, any, any, any> | MySqlDat
|
|
|
26
26
|
}[];
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
} : {} : DB extends MySqlDatabase<any, any, any, any, any
|
|
29
|
+
} : {} : DB extends MySqlDatabase<any, any, any, any, any> ? SCHEMA extends {
|
|
30
30
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
31
31
|
} ? {
|
|
32
32
|
[table in keyof SCHEMA as SCHEMA[table] extends MySqlTable ? table : never]?: {
|
|
@@ -41,7 +41,7 @@ type InferCallbackType<DB extends PgDatabase<any, any, any, any, any> | MySqlDat
|
|
|
41
41
|
}[];
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
-
} : {} : DB extends BaseSQLiteDatabase<any, any, any, any, any
|
|
44
|
+
} : {} : DB extends BaseSQLiteDatabase<any, any, any, any, any> ? SCHEMA extends {
|
|
45
45
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
46
46
|
} ? {
|
|
47
47
|
[table in keyof SCHEMA as SCHEMA[table] extends SQLiteTable ? table : never]?: {
|
|
@@ -57,7 +57,7 @@ type InferCallbackType<DB extends PgDatabase<any, any, any, any, any> | MySqlDat
|
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
59
|
} : {} : {};
|
|
60
|
-
declare class SeedPromise<DB extends PgDatabase<any, any, any, any
|
|
60
|
+
declare class SeedPromise<DB extends PgDatabase<any, any, any, any> | MySqlDatabase<any, any, any, any, any> | BaseSQLiteDatabase<any, any, any, any, any>, SCHEMA extends {
|
|
61
61
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations;
|
|
62
62
|
}, VERSION extends string | undefined> implements Promise<void> {
|
|
63
63
|
private db;
|
|
@@ -278,7 +278,7 @@ export declare function seedForDrizzleStudio({ sqlDialect, drizzleStudioObject,
|
|
|
278
278
|
*
|
|
279
279
|
* ```
|
|
280
280
|
*/
|
|
281
|
-
export declare function seed<DB extends PgDatabase<any, any, any, any
|
|
281
|
+
export declare function seed<DB extends PgDatabase<any, any, any, any> | MySqlDatabase<any, any, any, any, any> | BaseSQLiteDatabase<any, any, any, any, any>, SCHEMA extends {
|
|
282
282
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | Relations | any;
|
|
283
283
|
}, VERSION extends '2' | '1' | undefined>(db: DB, schema: SCHEMA, options?: {
|
|
284
284
|
count?: number;
|
|
@@ -325,7 +325,7 @@ export declare function seed<DB extends PgDatabase<any, any, any, any, any> | My
|
|
|
325
325
|
* await reset(db, schema);
|
|
326
326
|
* ```
|
|
327
327
|
*/
|
|
328
|
-
export declare function reset<DB extends PgDatabase<any, any, any, any
|
|
328
|
+
export declare function reset<DB extends PgDatabase<any, any, any, any> | MySqlDatabase<any, any, any, any, any> | BaseSQLiteDatabase<any, any, any, any, any>, SCHEMA extends {
|
|
329
329
|
[key: string]: PgTable | PgSchema | MySqlTable | MySqlSchema | SQLiteTable | any;
|
|
330
330
|
}>(db: DB, schema: SCHEMA): Promise<void>;
|
|
331
331
|
export { default as cities } from './datasets/cityNames.js';
|
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { is, entityKind, eq, sql, getTableName } from 'drizzle-orm';
|
|
1
|
+
import { is, entityKind, eq, sql, getTableName, getColumnTable, Column } from 'drizzle-orm';
|
|
2
2
|
import { Relations, extractTablesRelationalConfig, createTableRelationsHelpers, One } from 'drizzle-orm/_relations';
|
|
3
3
|
import { MySqlDatabase, MySqlTable, getTableConfig as getTableConfig$1 } from 'drizzle-orm/mysql-core';
|
|
4
4
|
import { PgDatabase, getTableConfig, PgTable } from 'drizzle-orm/pg-core';
|
|
@@ -133096,7 +133096,7 @@ class GeneratePoint extends AbstractGenerator {
|
|
|
133096
133096
|
}
|
|
133097
133097
|
const x = this.state.xCoordinateGen.generate();
|
|
133098
133098
|
const y = this.state.yCoordinateGen.generate();
|
|
133099
|
-
if (this.dataType === '
|
|
133099
|
+
if (this.dataType === 'object') {
|
|
133100
133100
|
return { x, y };
|
|
133101
133101
|
}
|
|
133102
133102
|
else if (this.dataType === 'string') {
|
|
@@ -133133,7 +133133,7 @@ class GenerateUniquePoint extends AbstractGenerator {
|
|
|
133133
133133
|
}
|
|
133134
133134
|
const x = this.state.xCoordinateGen.generate();
|
|
133135
133135
|
const y = this.state.yCoordinateGen.generate();
|
|
133136
|
-
if (this.dataType === '
|
|
133136
|
+
if (this.dataType === 'object') {
|
|
133137
133137
|
return { x, y };
|
|
133138
133138
|
}
|
|
133139
133139
|
else if (this.dataType === 'string') {
|
|
@@ -133182,7 +133182,7 @@ class GenerateLine extends AbstractGenerator {
|
|
|
133182
133182
|
b = this.state.bCoefficientGen.generate();
|
|
133183
133183
|
}
|
|
133184
133184
|
const c = this.state.cCoefficientGen.generate();
|
|
133185
|
-
if (this.dataType === '
|
|
133185
|
+
if (this.dataType === 'object') {
|
|
133186
133186
|
return { a, b, c };
|
|
133187
133187
|
}
|
|
133188
133188
|
else if (this.dataType === 'string') {
|
|
@@ -133230,7 +133230,7 @@ class GenerateUniqueLine extends AbstractGenerator {
|
|
|
133230
133230
|
b = this.state.bCoefficientGen.generate();
|
|
133231
133231
|
}
|
|
133232
133232
|
const c = this.state.cCoefficientGen.generate();
|
|
133233
|
-
if (this.dataType === '
|
|
133233
|
+
if (this.dataType === 'object') {
|
|
133234
133234
|
return { a, b, c };
|
|
133235
133235
|
}
|
|
133236
133236
|
else if (this.dataType === 'string') {
|
|
@@ -134944,7 +134944,7 @@ class SeedService {
|
|
|
134944
134944
|
const generator = new generatorsMap.GenerateBoolean[0]();
|
|
134945
134945
|
return generator;
|
|
134946
134946
|
}
|
|
134947
|
-
if ((col.columnType === 'integer' && col.dataType === '
|
|
134947
|
+
if ((col.columnType === 'integer' && col.dataType === 'object')) {
|
|
134948
134948
|
const generator = new generatorsMap.GenerateTimestamp[0]();
|
|
134949
134949
|
return generator;
|
|
134950
134950
|
}
|
|
@@ -135569,8 +135569,10 @@ const getPostgresInfo = (pgSchema, pgTables) => {
|
|
|
135569
135569
|
return dbToTsColumnNamesMap;
|
|
135570
135570
|
}
|
|
135571
135571
|
const tableConfig = getTableConfig(table);
|
|
135572
|
-
for (const [tsCol, col] of Object.entries(tableConfig.columns[0]
|
|
135573
|
-
dbToTsColumnNamesMap[col.name] = tsCol;
|
|
135572
|
+
for (const [tsCol, col] of Object.entries(getColumnTable(tableConfig.columns[0]))) {
|
|
135573
|
+
// dbToTsColumnNamesMap[col.name] = tsCol;
|
|
135574
|
+
if (is(col, Column))
|
|
135575
|
+
dbToTsColumnNamesMap[col.name] = tsCol;
|
|
135574
135576
|
}
|
|
135575
135577
|
dbToTsColumnNamesMapGlobal[tableName] = dbToTsColumnNamesMap;
|
|
135576
135578
|
return dbToTsColumnNamesMap;
|
|
@@ -135626,10 +135628,7 @@ const getPostgresInfo = (pgSchema, pgTables) => {
|
|
|
135626
135628
|
};
|
|
135627
135629
|
for (const table of Object.values(pgTables)) {
|
|
135628
135630
|
tableConfig = getTableConfig(table);
|
|
135629
|
-
dbToTsColumnNamesMap =
|
|
135630
|
-
for (const [tsCol, col] of Object.entries(tableConfig.columns[0].table)) {
|
|
135631
|
-
dbToTsColumnNamesMap[col.name] = tsCol;
|
|
135632
|
-
}
|
|
135631
|
+
dbToTsColumnNamesMap = getDbToTsColumnNamesMap(table);
|
|
135633
135632
|
// might be empty list
|
|
135634
135633
|
const newRelations = tableConfig.foreignKeys.map((fk) => {
|
|
135635
135634
|
const table = dbToTsTableNamesMap[tableConfig.name];
|
|
@@ -135660,8 +135659,8 @@ const getPostgresInfo = (pgSchema, pgTables) => {
|
|
|
135660
135659
|
name: baseColumn.name,
|
|
135661
135660
|
columnType: baseColumn.getSQLType(),
|
|
135662
135661
|
typeParams: getTypeParams(baseColumn.getSQLType()),
|
|
135663
|
-
dataType: baseColumn.dataType,
|
|
135664
|
-
size: baseColumn.
|
|
135662
|
+
dataType: baseColumn.dataType.split(' ')[0],
|
|
135663
|
+
size: baseColumn.length,
|
|
135665
135664
|
hasDefault: baseColumn.hasDefault,
|
|
135666
135665
|
enumValues: baseColumn.enumValues,
|
|
135667
135666
|
default: baseColumn.default,
|
|
@@ -135713,8 +135712,8 @@ const getPostgresInfo = (pgSchema, pgTables) => {
|
|
|
135713
135712
|
name: dbToTsColumnNamesMap[column.name],
|
|
135714
135713
|
columnType: column.getSQLType(),
|
|
135715
135714
|
typeParams: getTypeParams(column.getSQLType()),
|
|
135716
|
-
dataType: column.dataType,
|
|
135717
|
-
size: column.
|
|
135715
|
+
dataType: column.dataType.split(' ')[0],
|
|
135716
|
+
size: column.length,
|
|
135718
135717
|
hasDefault: column.hasDefault,
|
|
135719
135718
|
default: column.default,
|
|
135720
135719
|
enumValues: column.enumValues,
|
|
@@ -135819,8 +135818,9 @@ const getMySqlInfo = (mysqlSchema, mysqlTables) => {
|
|
|
135819
135818
|
return dbToTsColumnNamesMap;
|
|
135820
135819
|
}
|
|
135821
135820
|
const tableConfig = getTableConfig$1(table);
|
|
135822
|
-
for (const [tsCol, col] of Object.entries(tableConfig.columns[0]
|
|
135823
|
-
|
|
135821
|
+
for (const [tsCol, col] of Object.entries(getColumnTable(tableConfig.columns[0]))) {
|
|
135822
|
+
if (is(col, Column))
|
|
135823
|
+
dbToTsColumnNamesMap[col.name] = tsCol;
|
|
135824
135824
|
}
|
|
135825
135825
|
dbToTsColumnNamesMapGlobal[tableName] = dbToTsColumnNamesMap;
|
|
135826
135826
|
return dbToTsColumnNamesMap;
|
|
@@ -135876,10 +135876,7 @@ const getMySqlInfo = (mysqlSchema, mysqlTables) => {
|
|
|
135876
135876
|
};
|
|
135877
135877
|
for (const table of Object.values(mysqlTables)) {
|
|
135878
135878
|
tableConfig = getTableConfig$1(table);
|
|
135879
|
-
dbToTsColumnNamesMap =
|
|
135880
|
-
for (const [tsCol, col] of Object.entries(tableConfig.columns[0].table)) {
|
|
135881
|
-
dbToTsColumnNamesMap[col.name] = tsCol;
|
|
135882
|
-
}
|
|
135879
|
+
dbToTsColumnNamesMap = getDbToTsColumnNamesMap(table);
|
|
135883
135880
|
const newRelations = tableConfig.foreignKeys.map((fk) => {
|
|
135884
135881
|
const table = dbToTsTableNamesMap[tableConfig.name];
|
|
135885
135882
|
const refTable = dbToTsTableNamesMap[getTableName(fk.reference().foreignTable)];
|
|
@@ -135934,7 +135931,7 @@ const getMySqlInfo = (mysqlSchema, mysqlTables) => {
|
|
|
135934
135931
|
name: dbToTsColumnNamesMap[column.name],
|
|
135935
135932
|
columnType: column.getSQLType(),
|
|
135936
135933
|
typeParams: getTypeParams(column.getSQLType()),
|
|
135937
|
-
dataType: column.dataType,
|
|
135934
|
+
dataType: column.dataType.split(' ')[0],
|
|
135938
135935
|
hasDefault: column.hasDefault,
|
|
135939
135936
|
default: column.default,
|
|
135940
135937
|
enumValues: column.enumValues,
|
|
@@ -136005,8 +136002,9 @@ const getSqliteInfo = (sqliteSchema, sqliteTables) => {
|
|
|
136005
136002
|
return dbToTsColumnNamesMap;
|
|
136006
136003
|
}
|
|
136007
136004
|
const tableConfig = getTableConfig$2(table);
|
|
136008
|
-
for (const [tsCol, col] of Object.entries(tableConfig.columns[0]
|
|
136009
|
-
|
|
136005
|
+
for (const [tsCol, col] of Object.entries(getColumnTable(tableConfig.columns[0]))) {
|
|
136006
|
+
if (is(col, Column))
|
|
136007
|
+
dbToTsColumnNamesMap[col.name] = tsCol;
|
|
136010
136008
|
}
|
|
136011
136009
|
dbToTsColumnNamesMapGlobal[tableName] = dbToTsColumnNamesMap;
|
|
136012
136010
|
return dbToTsColumnNamesMap;
|
|
@@ -136061,10 +136059,7 @@ const getSqliteInfo = (sqliteSchema, sqliteTables) => {
|
|
|
136061
136059
|
};
|
|
136062
136060
|
for (const table of Object.values(sqliteTables)) {
|
|
136063
136061
|
tableConfig = getTableConfig$2(table);
|
|
136064
|
-
dbToTsColumnNamesMap =
|
|
136065
|
-
for (const [tsCol, col] of Object.entries(tableConfig.columns[0].table)) {
|
|
136066
|
-
dbToTsColumnNamesMap[col.name] = tsCol;
|
|
136067
|
-
}
|
|
136062
|
+
dbToTsColumnNamesMap = getDbToTsColumnNamesMap(table);
|
|
136068
136063
|
const newRelations = tableConfig.foreignKeys.map((fk) => {
|
|
136069
136064
|
const table = dbToTsTableNamesMap[tableConfig.name];
|
|
136070
136065
|
const refTable = dbToTsTableNamesMap[getTableName(fk.reference().foreignTable)];
|
|
@@ -136115,7 +136110,7 @@ const getSqliteInfo = (sqliteSchema, sqliteTables) => {
|
|
|
136115
136110
|
name: dbToTsColumnNamesMap[column.name],
|
|
136116
136111
|
columnType: column.getSQLType(),
|
|
136117
136112
|
typeParams: getTypeParams(column.getSQLType()),
|
|
136118
|
-
dataType: column.dataType,
|
|
136113
|
+
dataType: column.dataType.split(' ')[0],
|
|
136119
136114
|
hasDefault: column.hasDefault,
|
|
136120
136115
|
default: column.default,
|
|
136121
136116
|
enumValues: column.enumValues,
|