title: sqlite3_step failure: NOT NULL constraint failed
body: <p>I am new to ionic 1. I have tested my app in browser and it works fine. I have used sqlite. I have a form. When I left one text input field empty the data is added to the database table. That's exactly what I want. But, it does not work in device. Whenever I left one field empty it shows the below error:</p>
  
  <pre><code>Object {message: "sqlite3_step failure: NOT NULL constraint failed: items.barcode", code: 6}
  </code></pre>
  
  <p>Here's my code snippet:</p>
  
  <pre><code>if ($scope.item.itemname &amp;&amp; $scope.item.soldby &amp;&amp; $scope.item.price) {
                          var query = "INSERT into items (itemname,category,soldby,price,sku,barcode) VALUES(?,?,?,?,?,?)";
  
                          $cordovaSQLite.execute(db, query, [$scope.item.itemname, $scope.item.category, $scope.item.soldby, $scope.item.price, $scope.item.sku, $scope.item.barcode,])
                              .then(function (result) {
                                  console.log($scope.item.itemname);
                                  console.log($scope.item.category);
                                  console.log($scope.item.soldby);
                                  console.log($scope.item.price);
                                  console.log($scope.item.sku);
                                  console.log("Printing barcode");
                                  console.log($scope.item.barcode);
                                  console.log($scope.item.total);
  
                                  //ITEM ADDED SUCCESS POPUP STARTS                
  
  
  
  
                                  //ITEM ADDED SUCCESS POPUP ENDS  
  
  
                              }, function (error) {
                                  console.log(error);
  
                              });
  
                          // $scope.item = {
                          //     itemname: $scope.item.itemname,
                          // };
                          $state.go('menu.allItems');
                      } 
  </code></pre>
  
  <p>And here is the code where I created the table:</p>
  
  <pre><code>$cordovaSQLite.execute(db, "CREATE TABLE IF NOT EXISTS items (id integer primary key AUTOINCREMENT,itemname text ,category text ,soldby text ,price REAL ,quantity REAL ,sku integer ,barcode text,timestamp DATE DEFAULT (datetime('now','localtime')),cashier text,total REAL,receitnumber integer,grandtotal REAL)");
  </code></pre>