File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2124,3 +2124,29 @@ test('add not null to column with default', async () => {
21242124 expect ( st3 ) . toStrictEqual ( expectedSt3 ) ;
21252125 expect ( pst3 ) . toStrictEqual ( expectedSt3 ) ;
21262126} ) ;
2127+
2128+ // https://github.com/drizzle-team/drizzle-orm/issues/5125
2129+ test ( 'case - #5125' , async ( ) => {
2130+ const students = mysqlTable ( 'student' , {
2131+ id : int ( ) . primaryKey ( ) . autoincrement ( ) ,
2132+ } ) ;
2133+
2134+ const courses = mysqlTable ( 'course' , {
2135+ id : int ( ) . primaryKey ( ) . autoincrement ( ) ,
2136+ } ) ;
2137+
2138+ const studentCourse = mysqlTable ( 'student_course' , {
2139+ studentId : int ( ) . notNull ( ) . references ( ( ) => students . id ) , // FK relies on PK index by default in MySQL
2140+ courseId : int ( ) . notNull ( ) . references ( ( ) => courses . id ) ,
2141+ } , ( table ) => [
2142+ primaryKey ( { columns : [ table . studentId , table . courseId ] } ) ,
2143+ ] ) ;
2144+
2145+ const to = {
2146+ students,
2147+ courses,
2148+ studentCourse,
2149+ } ;
2150+
2151+ await push ( { db, to } ) ;
2152+ } ) ;
You can’t perform that action at this time.
0 commit comments