node.js - How to specify float precision in knex schema ? -


i'm having trouble defining float precision in knex schema, want float(10,6) in order store lat/long location. here's how im trying declare :

lat: {type: 'float(10,6)', nullable: false}, 

it fails @ migrate because of (10,6), how right way ?

i don't know json approach since use schema builder one.

it looks (example geostuff table id, lat , lng columns):

var knex = require('knex')({client:'sqlite3',connection:{filename: 'sample.sqlite3'}});  knex.schema.createtable('geostuff', function(table) {   table.increments('id').primary();   table.float('lat', 14, 10).notnullable();   table.float('lng', 14, 10).notnullable(); }).then(function() {   console.dir('table created'); }).catch(function(err) {   console.log('table not created');   console.dir(err); }); 

note precision specifiers not supported. postgresql supports float(precision), sqlite3 (from example), doesn't (better yet: not care). fortunately knex.js hides idiosyncrasies.


Comments