title: How to prevent Sequelize from inserting NULL for primary keys with Postgres
body: <p>I have created a table in postgresql 9</p>
  
  <pre><code>create table stillbirth(id serial primary key, state varchar(100), count int not null, year int not null); 
  </code></pre>
  
  <p>trying to write a sample on node.js with sequelize 1.4.1 version. </p>
  
  <p>mapped the above table as </p>
  
  <pre><code>var StillBirth = sequelize.define('stillbirth',
  { id: {type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
  state: Sequelize.STRING,
  year: Sequelize.INTEGER,
  count: Sequelize.INTEGER
  }, {timestamps: false, freezeTableName: true});
  </code></pre>
  
  <p>now when i try to create a new instance of Stillbirth and save it, i get errors. </p>
  
  <p>/** new instance create code **/</p>
  
  <pre><code>StillBirth
     .build({state: objs[j].state, year: objs[j].year, count: objs[j].count})
     .save()
     .error(function(row){
           console.log('could not save the row ' + JSON.stringify(row));
          })
     .success(function(row){
         console.log('successfully saved ' + JSON.stringify(row));
     })
  </code></pre>
  
  <p>error i get</p>
  
  <p>*Executing: INSERT INTO "stillbirth" ("state","year","count","id") VALUES ('Andhra Pradesh',2004,11,NULL) RETURNING <em>;
  could not save the row {"length":110,"name":"error","severity":"ERROR","code":"23502","file":"execMain.c","line":"1359","routine":"ExecConstraints"}</em></p>
  
  <p>If you look at the sql that its generating, it puts null for the primary key which should ideally be generated by the db. </p>
  
  <p>Can someone help me as to what am i missing here ?</p>