File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -626,23 +626,12 @@ class QueryBuilder {
626626 */
627627 toImplementation ( model ) {
628628 const options = { ...this . options } ;
629- const hasColumns = options . attributes . some ( ( attribute ) => typeof attribute === 'string' ) ;
629+ const hasExplicitColumns = options . attributes . some ( ( attribute ) => typeof attribute === 'string' ) ;
630630
631631 if ( ! this . _selectOnly ) {
632- if ( ! hasColumns ) {
633- this . setModel ( model ) ;
634- const attributes = Object . keys ( this . model . rawAttributes ) ;
635- options . attributes = options . attributes . concat ( attributes ) ;
636- }
637- }
638-
639- const primaryKey = model . primaryKeyAttribute ;
640-
641- if ( primaryKey ) {
642- const alreadyOrdered = options . order ?. some ( ( [ column ] ) => column === primaryKey ) ;
643-
644- if ( ! alreadyOrdered ) {
645- this . orderBy ( primaryKey , 'ASC' ) ;
632+ if ( ! hasExplicitColumns ) {
633+ // Convert to object syntax — Sequelize will include all model columns by default
634+ options . attributes = { include : options . attributes } ;
646635 }
647636 }
648637
You can’t perform that action at this time.
0 commit comments