
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
PostgreSQL migration tool on Node.js.
Table schema:
Files:
{name}.do.sql
— migration file{name}.undo.sql
— undo migration fileorder
— file with ordered migrations names.Inspect data exapmle:
{
"table": {
"initial": {
"name": "initial",
"do_hash": "870f2713310e990bd8ed4951fb9560fb8591def24a324abea0d8fd010940752a",
"do_sql": "CREATE TABLE test (\n key varchar(255) UNIQUE,\n value text\n);\n",
"undo_hash": "5111d07169d0ba3c9f4c861fa6076c786f86469e298450c641c3e70ea21df8f6",
"undo_sql": "DROP TABLE test;\n",
"exec_date": "2017-05-10T15:33:40.485Z"
},
"test_name": {
"name": "test_name",
"do_hash": "bb8d5549c23390eeef2293dc3366e6e97f33102d9326e42af8ee80ec1afba988",
"do_sql": "ALTER TABLE test ADD COLUMN is_json boolean NOT NULL DEFAULT false;\n\nCREATE TABLE test2 (\n key varchar(255) UNIQUE,\n value text\n);\n",
"undo_hash": "0fcb0be684de7480b38486d654c8e89a4a23233dafe6a9bae20ce860c1d78fac",
"undo_sql": "ALTER TABLE test DROP COLUMN IF EXISTS is_json;\n\nDROP TABLE test2;\nDROP TABLE _test2;\n",
"exec_date": "2017-05-10T15:34:17.961Z"
}
},
"files": {
"initial": {
"do_sql": "CREATE TABLE test (\n key varchar(255) UNIQUE,\n value text\n);\n",
"undo_sql": "DROP TABLE test;\n",
"do_hash": "870f2713310e990bd8ed4951fb9560fb8591def24a324abea0d8fd010940752a",
"undo_hash": "5111d07169d0ba3c9f4c861fa6076c786f86469e298450c641c3e70ea21df8f6"
},
"test_name": {
"do_sql": "ALTER TABLE test ADD COLUMN is_json boolean NOT NULL DEFAULT false;\n\nCREATE TABLE test2 (\n key varchar(255) UNIQUE,\n value text\n);\n",
"undo_sql": "ALTER TABLE test DROP COLUMN IF EXISTS is_json;\n\nDROP TABLE test2;\nDROP TABLE _test2;\n",
"do_hash": "bb8d5549c23390eeef2293dc3366e6e97f33102d9326e42af8ee80ec1afba988",
"undo_hash": "0fcb0be684de7480b38486d654c8e89a4a23233dafe6a9bae20ce860c1d78fac"
}
},
"map": [
{
"name": "initial",
"state": "executed"
}, {
"name": "test_name",
"state": "executed"
}
]
}
Migrations order list by names. Example:
name1
name2
name3
Initiated cursor:
~inited~
Use it if you integrating migrator in an existing project. Migrations before this cursor will not be executed if that not in table schema and just added to it. Can be placed on any line.
Shrinking cursor:
~shrink~~
Use it if you want to remove very old migrations files from your project. Migrations before this cursor will be ignored and you can remove migrations files and names in order list. Can be placed on any line.
Clone repo and run npm install
or use Docker.
Globaly:
$ do-migrate <args> [command] [params]
Localy:
$ $(npm bin)/do-migrate -- <args> [command] [params]
Commands:
Options:
Migrator = require('do-migrate')
migrator = new Migrator options
migrator.migrate()
Options:
Methods:
Inspect data structure:
sha256
, undo_hash sha256
, exec_date)sha256
, undo_hash sha256
, exec_date)States:
Dockerfile:
FROM nim579/do-migrate
ADD ./migrations /migrator/migrations
ADD ./env.json /migrator/env.json # Optional env variables map file
CMD [ "interactive" ] # Optional command and args for CLI
Command:
$ docker run --name migrator -d -e ... nim579/do-migrate
Command:
$ docker run --name migrator -it -e ... nim579/do-migrate interactive
Compose:
version: "2"
services:
migrator:
image: app-migrator
build:
context: .
dockerfile: Dockerfile
environment:
MIGRATOR_DB_HOST=localhost
MIGRATOR_DB_PORT=5432
MIGRATOR_DB_USER=postgres
MIGRATOR_DB_PASSWORD=admin
MIGRATOR_DB_DATABASE=test
Command:
$ docker run --name migrator -d -e ... --volume ./migrations:/migrator/migrations nim579/do-migrate
Command for interactive:
$ docker run --name migrator -it -e ... --volume ./migrations:/migrator/migrations nim579/do-migrate interactive
Compose:
version: "2"
services:
migrator:
image: nim579/do-migrate
environment:
MIGRATOR_DB_HOST=localhost
MIGRATOR_DB_PORT=5432
MIGRATOR_DB_USER=postgres
MIGRATOR_DB_PASSWORD=admin
MIGRATOR_DB_DATABASE=test
volume:
- ./migrations:/migrator/migrations:ro
FAQs
PostgreSQL migrator
The npm package do-migrate receives a total of 0 weekly downloads. As such, do-migrate popularity was classified as not popular.
We found that do-migrate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.