Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Knex = require('knex');
- const Bookshelf = require('bookshelf');
- const knex = Knex({
- client: 'postgresql',
- connection: {
- host: 'localhost',
- port: '5436',
- user: 'test',
- password: 'test',
- database: 'test',
- charset: 'utf8'
- },
- });
- const bookshelf = Bookshelf(knex);
- const Test = bookshelf.Model.extend({
- tableName: 'test',
- hasTimestamps: true
- });
- knex.schema.createTableIfNotExists('test', (table) => {
- table.increments('id').primary();
- table.float('amount');
- table.timestamps();
- }).then(() => {
- new Test({amount: 1234567})
- .save()
- .then((model) => model.fetchAll()
- .then((result) => console.log(result.toJSON())));
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement