88 createOne ,
99 getTableColumns ,
1010 is ,
11- isTable ,
1211 Table ,
1312 Column
1413} from 'drizzle-orm' ;
@@ -25,18 +24,21 @@ import {
2524 PgEnum ,
2625 PrimaryKey as PgPrimaryKey ,
2726 UniqueConstraint as PgUniqueConstraint ,
28- isPgEnum
27+ isPgEnum ,
28+ PgTable
2929} from 'drizzle-orm/pg-core' ;
3030import {
3131 ForeignKey as MySqlForeignKey ,
3232 Index as MySqlIndex ,
3333 PrimaryKey as MySqlPrimaryKey ,
34+ MySqlTable ,
3435 UniqueConstraint as MySqlUniqueConstraint
3536} from 'drizzle-orm/mysql-core' ;
3637import {
3738 ForeignKey as SQLiteForeignKey ,
3839 Index as SQLiteIndex ,
3940 PrimaryKey as SQLitePrimaryKey ,
41+ SQLiteTable ,
4042 UniqueConstraint as SQLiteUniqueConstraint
4143} from 'drizzle-orm/sqlite-core' ;
4244import { writeFileSync } from 'fs' ;
@@ -175,7 +177,7 @@ export abstract class BaseGenerator<
175177
176178 if ( is ( index , PgIndex ) || is ( index , MySqlIndex ) || is ( index , SQLiteIndex ) ) {
177179 const configColumns = index . config . columns . flatMap ( ( entry ) =>
178- is ( entry , SQL ) ? entry . queryChunks . filter ( ( v ) => is ( v , Column ) ) : entry
180+ is ( entry , SQL ) ? entry . queryChunks . filter ( ( v ) => is ( v , Column ) ) : ( entry as Column )
179181 ) ;
180182
181183 const idxColumns = wrapColumns (
@@ -323,7 +325,7 @@ export abstract class BaseGenerator<
323325
324326 if ( isPgEnum ( value ) ) {
325327 generatedEnums . push ( this . generateEnum ( value ) ) ;
326- } else if ( isTable ( value ) ) {
328+ } else if ( is ( value , PgTable ) || is ( value , MySqlTable ) || is ( value , SQLiteTable ) ) {
327329 generatedTables . push ( this . generateTable ( value as unknown as AnyTable ) ) ;
328330 } else if ( is ( value , Relations ) ) {
329331 relations . push ( value ) ;
0 commit comments