fix(database): id is not generated when custom primary key
This commit is contained in:
		
							parent
							
								
									34c9ec123e
								
							
						
					
					
						commit
						1f431dc2d6
					
				@ -7,7 +7,7 @@ import {
 | 
			
		||||
  QueryInterfaceDropTableOptions,
 | 
			
		||||
  SyncOptions,
 | 
			
		||||
  Transactionable,
 | 
			
		||||
  Utils,
 | 
			
		||||
  Utils
 | 
			
		||||
} from 'sequelize';
 | 
			
		||||
import { Database } from './database';
 | 
			
		||||
import { Field, FieldOptions } from './fields';
 | 
			
		||||
@ -200,6 +200,10 @@ export class Collection<
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (this.options.autoGenId !== false && options.primaryKey) {
 | 
			
		||||
      this.model.removeAttribute('id');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this.removeField(name);
 | 
			
		||||
    this.fields.set(name, field);
 | 
			
		||||
    this.emit('field.afterAdd', field);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user