Socket
Socket
Sign inDemoInstall

sql-migrations

Package Overview
Dependencies
48
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sql-migrations

raw SQL migrations library for Node.js


Version published
Weekly downloads
371
decreased by-9.73%
Maintainers
1
Install size
649 kB
Created
Weekly downloads
 

Readme

Source

node-sql-migrations

raw SQL migrations for node

Example

In your project

// migrate.js
var path = require('path');

require('sql-migrations').run({
    basedir: __dirname,
    migrationsDir: path.resolve(__dirname, 'migrations'),
    user: 'dabramov',
    host: 'localhost',
    password: 'password',
    db: 'sql_migrations',
    port: 5432
});

CLI

run node ./migrate.js with arguments


node ./migrate create migration_name

will create two migration files (up and down)

./migrations/1415860098827_up_migration_name.sql
./migrations/1415860098827_down_migration_name.sql

node ./migrate migrate

will run all pending migrations


node ./migrate.js rollback

will rollback the last migration if there is one

Migration files

write raw sql in your migrations example

-- ./migrations/1415860098827_up_migration_name.sql
create table "test_table" (id bigint, name varchar(255));

-- ./migrations/1415860098827_down_migration_name.sql
drop table "test_table";

Keywords

FAQs

Last updated on 12 Feb 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc