{"id":13686733,"url":"https://github.com/fxjs-modules/orm-plugin-migration","last_synced_at":"2026-06-11T06:31:05.297Z","repository":{"id":122982933,"uuid":"162907069","full_name":"fxjs-modules/orm-plugin-migration","owner":"fxjs-modules","description":"migration plugin for @fxjs/orm","archived":false,"fork":false,"pushed_at":"2019-04-02T17:59:20.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-04T15:43:05.588Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fxjs-modules.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-12-23T16:31:39.000Z","updated_at":"2019-04-02T17:59:21.000Z","dependencies_parsed_at":"2024-01-14T18:13:46.880Z","dependency_job_id":"894c7889-ff74-4fbb-b136-f2c6eeec09f4","html_url":"https://github.com/fxjs-modules/orm-plugin-migration","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/fxjs-modules/orm-plugin-migration","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxjs-modules%2Form-plugin-migration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxjs-modules%2Form-plugin-migration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxjs-modules%2Form-plugin-migration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxjs-modules%2Form-plugin-migration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fxjs-modules","download_url":"https://codeload.github.com/fxjs-modules/orm-plugin-migration/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxjs-modules%2Form-plugin-migration/sbom","scorecard":{"id":415408,"data":{"date":"2025-08-11","repo":{"name":"github.com/fxjs-modules/orm-plugin-migration","commit":"951062900db0d492a445411530c72223f884e386"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/16 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T23:41:56.069Z","repository_id":122982933,"created_at":"2025-08-18T23:41:56.069Z","updated_at":"2025-08-18T23:41:56.069Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34186384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T15:00:38.990Z","updated_at":"2026-06-11T06:31:05.279Z","avatar_url":"https://github.com/fxjs-modules.png","language":"JavaScript","funding_links":[],"categories":["Packages"],"sub_categories":["Database/Cache"],"readme":"## Migration Plugin for @fxjs/orm\n\n[![NPM version](https://img.shields.io/npm/v/@fxjs/orm-plugin-migration.svg)](https://www.npmjs.org/package/@fxjs/orm-plugin-migration)\n[![Build Status](https://travis-ci.org/fxjs-modules/orm-plugin-migration.svg)](https://travis-ci.org/fxjs-modules/orm-plugin-migration)\n[![Build status](https://ci.appveyor.com/api/projects/status/b0cwv5ashjvl08f8?svg=true)](https://ci.appveyor.com/project/richardo2016/orm-plugin-migration)\n\n## Install\n\n```sh\nnpm install @fxjs/orm-plugin-migration\n```\n\n# @fxjs/orm-plugin-migration\n\nMigrations using [@fxjs/orm](https://github.com/fxjs-modules/orm-plugin-migration) model DSL leveraging Visionmedia's node-migrate.\n\n## Installation\n\n```\nnpm install @fxjs/orm-plugin-migration\n```\n\n## Usage\n\nThe example below uses MySQL. Locomote uses @fxjs/orm-plugin-migration with Postgres. Testing was also done with SQLite3, though some driver issues were encountered.\n\nBuild a connection \u0026 construct the @fxjs/orm-plugin-migration Task object:\n\n```js\nvar orm         = require('@fxjs/orm');\nvar MigrateTask = require('@fxjs/orm-plugin-migration');\n\norm.connect(connectionString, function (err, connection) {\n  if (err) throw err;\n  var task = new MigrateTask(connection.driver);\n});\n```\n\nThe Task constructor function can support options allowing for a custom migrations directory and/or coffeescript support (see 'Usage - opts' below).\n\nA Task object offers three operations - *generate*, *up* and *down*.\n\n## Usage - generate\n\n```\n\u003e task.generate('create-users', function(err, result){});\n\u003e   create : @fxjs/orm-plugin-migration/migrations/001-create-users.js\n```\n\nThe 'migrations' folder is the default but can be overridden in the opts argument (see 'Usage - opts' below).\n\nA skeleton migration file now exists and can be populated with the [ORM2 DSL](https://github.com/fxjs-modules/sql-ddl-sync#example).\n\nA simple example, taken from the tests:\n\n```js\nexports.up = function (next) {\n  this.createTable('test_table', {\n    id     : { type : \"serial\", key: true }, // auto increment\n    name   : { type : \"text\", required: true }\n  }, next);\n};\n\nexports.down = function (next){\n  this.dropTable('test_table', next);\n};\n```\n\nYou can also write Promise-based migrations, same example, but with no callbacks specified:\n\n\n```js\nexports.up = function () {\n  return this.createTable('test_table', {\n    id     : { type : \"serial\", key: true }, // auto increment\n    name   : { type : \"text\", required: true }\n  });\n};\n\nexports.down = function () {\n  return this.dropTable('test_table');\n};\n```\nBoth `createTable` and `dropTable`, along with other [MigrationDSL methods](src/migration-dsl.ts) return promises if callback is\nnot specified. Look [here](examples/migrations) for more examples.\n\nAnother example for adding or dropping a column:\n\n```js\nexports.up = function(next){\n  this.addColumn('agency', { preferredProvider: {type: \"text\", defaultValue: '1G', required: true} }, next);\n}\n\nexports.down = function(next){\n  this.dropColumn('agency', 'preferredProvider', next);\n}\n```\n\nAn example of adding an index:\n\n```js\nexports.up = function (next) {\n  this.addIndex('agency_email_idx', {\n    table: 'agency',\n    columns: ['email'],\n    unique: true\n  }, next);\n};\n\nexports.down = function (next) {\n  this.dropIndex('agency_email_idx', 'agency', next);\n};\n```\n\nThere are no built-in operations for inserting, updating, or deleting row data contained in tables. The ```execQuery``` operation, which can be used to execute any custom queries, can however be used to perform such actions:\n\n```js\nexports.up = function (next) {\n  this.execQuery('INSERT INTO agency (email) VALUES (?)', ['info@example.com'], next);\n};\n\nexports.down = function (next) {\n  this.execQuery('DELETE FROM agency WHERE email = ?', ['info@example.com'], next);\n};\n```\n\nThe full list of operations available through ```this```:\n\n* createTable\n* dropTable\n* addColumn\n* dropColumn\n* addIndex\n* dropIndex\n* addPrimaryKey\n* dropPrimaryKey\n* addForeignKey\n* dropForeignKey\n* execQuery\n\nThese operations are depicted in the examples folder.\n\nWe would like to add modifyColumn functionality in the future.\n\n## Usage - up\n```\n\u003e task.up(function(e,r){});\n\u003e   up : migrations/001-create-users.js\n  migration : complete\n```\n\nAlternatively, when there are many migrations, a filename can be specified:\n\n```\n\u003e task.generate('create-servers', function(err, result){});\n\u003e   create : /Users/nicholasf/code/locomote/node-@fxjs/orm-plugin-migration/migrations/002-create-servers.js\n\n\u003e task.up('001-create-users.js', function(e,r){})\n\u003e   up : migrations/001-create-users.js\n  migration : complete\n```\n\nThis means 'run up to this migration then execute its up function, then stop.'\n\n## Usage - down\n\n```\n\u003e task.down(function(e,r){});\n\u003e   down : migrations/001-create-users.js\n  migration : complete\n```\n\nThis means 'rollback the last migration'.\n\nIf there are many migrations to rollback a limit can be specified.\n\n```\n\u003e task.down('001-create-users.js', function(e,r){});\n\u003e   down : migrations/001-create-users.js\n  migration : complete\n```\n\nThis means 'rollback all migrations including 001-create-users.js'\n\n## Usage - the orm_migrations table\n\nMigrate-orm2 maintains an internal orm_migrations table which allows it to run from previous state.\n\nThe table contains a list of migrations applied to the database. By comparing these and the migration files, we can decide on which migrations to run.\n\n```\nmysql\u003e select * from orm_migrations;\n+---------------------+\n| migration           |\n+---------------------+\n| 001-create-users.js |\n+---------------------+\n1 rows in set (0.00 sec)\n```\n\n## Usage - opts\n\nThe Task object can be modified to work from a different directory or to generate and cooperate with coffee-script migrations.\n\n```\nvar task = new Task(connection, {dir: 'data/migrations', coffee: true});\n```\n\n## Running Tests\n\nPlease note - running all of the tests together can produce database connection pooling problems. We are currently considering these.\n\nTests work in isolation and when the database is tuned for a greater amount of database connections.\n\nCreate `test/config.js` (see `test/config.example.js` for instructions)\n\n```bash\nnpm test\n```\nThis will run the tests against all configurations inside `config.js`.\nTo run against a single config:\n```bash\nORM_PROTOCOL=mysql node test/run\n# OR\nORM_PROTOCOL=mysql mocha test/integration\n```\n\n## Guideline to Contributing\n\nContributions are welcome. If you want to discuss or request a feature, please open an issue.\n\nWe will ask for test coverage of Pull Requests for most issues. Please see the current testing strategy in test/integration.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffxjs-modules%2Form-plugin-migration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffxjs-modules%2Form-plugin-migration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffxjs-modules%2Form-plugin-migration/lists"}