Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

knex-schema

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knex-schema

Knex schema utility.

  • 2.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
41
decreased by-31.67%
Maintainers
3
Weekly downloads
 
Created
Source

knex-schema

Build Status Dependency Status devDependency Status Coverage Status

Knex sync utility.

Install

npm install knex-schema

Usage

var database = require('knex').initialize({ client: 'pg' });
var Manager = require('knex-schema');
var manager = new Manager(database);
var articles = {
  tableName: 'articles',
  build: function (table) {
    table.increments('id').primary();
    table.string('title');
  },
  populate: function (database) {
    return db.knex('articles').insert([
      { title: 'First article' }
    ]);
  }
};
manager.sync([articles]); // Create / Update tables articles.
manager.populate([articles]); // Populate table articles.
manager.reset([articles]); // Remove all data from articles.
manager.drop([articles]); // Drop table articles.

knexSchema(database)

Create a new manager.

var manager = require('knex-schema')(database);

manager.sync(schemas)

Create and update tables specified in schemas.

manager.sync([articles]);

manager.populate(schemas)

Populate tables specified in schemas.

manager.populate([articles]);

manager.reset(schemas)

Remove all rows in tables specified in schemas.

manager.reset([articles]);

manager.drop(schemas)

Drop tables specified in schemas.

manager.drop([articles]);

License

MIT

Keywords

FAQs

Package last updated on 04 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc