{"_id":"@2amtech/sql-migration-tool","_rev":"2-c1f91e5663e20c44e04971428cab0641","name":"@2amtech/sql-migration-tool","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@2amtech/sql-migration-tool","version":"1.0.0","keywords":["sql","migration","database","mysql","postgres","mssql","cli","migrations"],"author":{"name":"Aleksandar Panic"},"license":"MIT","_id":"@2amtech/sql-migration-tool@1.0.0","maintainers":[{"name":"2amtech","email":"accounts@2am.tech"}],"contributors":[{"name":"Borisa Eric"},{"name":"Juanes Heras"},{"name":"Ermin Hasic"},{"name":"Mohamed Hosny"},{"name":"Dmytro Zasiadko"}],"homepage":"https://2am.tech","bin":{"2am-smt":"dist/cli/index.js"},"dist":{"shasum":"efaae96f27249aeaca11024a3a2ee15d8ba6c98a","tarball":"https://registry.npmjs.org/@2amtech/sql-migration-tool/-/sql-migration-tool-1.0.0.tgz","fileCount":231,"integrity":"sha512-YbrmFbNflKetM3MH1pvMVKSRoa5jc/VZ+2eVVWAXQV5Ia9V7HuOX0RjKsynaaZ9Ag679Zr1oeOjxImcnItinwg==","signatures":[{"sig":"MEUCIQCjO2fkqpIzaF9VlDEVeLNCFPjtW8g0aFPX8rifXnsE0QIgecMkkXPCc5auW7CZ/zC9zrJ004VoBVqKweVwmQPWNtA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":266950},"main":"./dist/index.js","type":"commonjs","types":"./dist/index.d.ts","engines":{"node":">=22.9.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"./lib/*":{"types":"./dist/lib/*.d.ts","import":"./dist/lib/*.js","require":"./dist/lib/*.js"}},"gitHead":"f8ce7e1d4551202117df65162af33143d24ed362","scripts":{"cli":"node dist/cli/index.js","test":"echo \"Error: no test specified\" && exit 1","build":"tsc","clean":"rm -rf dist","prebuild":"npm run clean","prepublishOnly":"npm run build"},"_npmUser":{"name":"2amtech","email":"accounts@2am.tech"},"_npmVersion":"11.6.2","description":"SQL Migration Tool by 2am.tech - A comprehensive database migration management library and CLI","directories":{},"_nodeVersion":"24.11.1","dependencies":{"zod":"^3.24.2","mssql":"^12.1.1","mysql":"^2.18.1","dotenv":"^17.2.3","js-yaml":"^4.1.1","commander":"^14.0.2","postgrejs":"^2.22.7","@aws-sdk/client-secrets-manager":"^3.744.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.7.3","@types/node":"^22.13.1","@types/mssql":"^9.1.7","@types/mysql":"^2.15.26","@types/js-yaml":"^4.0.9"},"_npmOperationalInternal":{"tmp":"tmp/sql-migration-tool_1.0.0_1765186595849_0.9477640105387874","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@2amtech/sql-migration-tool","version":"1.0.1","description":"SQL Migration Tool by 2am.tech - A comprehensive database migration management library and CLI","license":"MIT","author":{"name":"Aleksandar Panic"},"contributors":[{"name":"Borisa Eric"},{"name":"Juanes Heras"},{"name":"Ermin Hasic"},{"name":"Mohamed Hosny"},{"name":"Dmytro Zasiadko"}],"homepage":"https://2am.tech","type":"commonjs","main":"./dist/index.js","types":"./dist/index.d.ts","bin":{"2am-smt":"dist/cli/index.js"},"exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js","import":"./dist/index.js"},"./lib/*":{"types":"./dist/lib/*.d.ts","require":"./dist/lib/*.js","import":"./dist/lib/*.js"}},"scripts":{"build":"tsc","cli":"node dist/cli/index.js","clean":"rm -rf dist","prebuild":"npm run clean","prepublishOnly":"npm run build","test":"echo \"Error: no test specified\" && exit 1"},"keywords":["sql","migration","database","mysql","postgres","mssql","cli","migrations"],"dependencies":{"@aws-sdk/client-secrets-manager":"^3.744.0","commander":"^14.0.2","dotenv":"^17.2.3","js-yaml":"^4.1.1","mssql":"^12.1.1","mysql":"^2.18.1","postgrejs":"^2.22.7","zod":"^3.24.2"},"devDependencies":{"@types/js-yaml":"^4.0.9","@types/mssql":"^9.1.7","@types/mysql":"^2.15.26","@types/node":"^22.13.1","typescript":"^5.7.3"},"engines":{"node":">=22.9.0"},"publishConfig":{"access":"public"},"gitHead":"f8ce7e1d4551202117df65162af33143d24ed362","_id":"@2amtech/sql-migration-tool@1.0.1","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-QHvSUrcxLlAfhi29LLo33ugzEOYhr8o5GMR+3WQudg8F3A61K/y/W30T+USCEVHIgnz7WLP1ghh0TAkl+Xx6Og==","shasum":"d5479cc85f40c2dc4b38b30a3e2b7eefd20af90c","tarball":"https://registry.npmjs.org/@2amtech/sql-migration-tool/-/sql-migration-tool-1.0.1.tgz","fileCount":231,"unpackedSize":269621,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD6DNRA29NHzUrg8UpRZ/rh31lFDpkn+C9gtScbp7904wIhAMb5hA7mewk6pp3UEu42jsm+VZ8JOufAU9bJ3NAKyPgB"}]},"_npmUser":{"name":"2amtech","email":"accounts@2am.tech"},"directories":{},"maintainers":[{"name":"2amtech","email":"accounts@2am.tech"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sql-migration-tool_1.0.1_1765188770249_0.8941737687823923"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-08T09:36:35.728Z","modified":"2025-12-08T10:12:50.907Z","1.0.0":"2025-12-08T09:36:35.995Z","1.0.1":"2025-12-08T10:12:50.402Z"},"author":{"name":"Aleksandar Panic"},"license":"MIT","homepage":"https://2am.tech","keywords":["sql","migration","database","mysql","postgres","mssql","cli","migrations"],"description":"SQL Migration Tool by 2am.tech - A comprehensive database migration management library and CLI","contributors":[{"name":"Borisa Eric"},{"name":"Juanes Heras"},{"name":"Ermin Hasic"},{"name":"Mohamed Hosny"},{"name":"Dmytro Zasiadko"}],"maintainers":[{"name":"2amtech","email":"accounts@2am.tech"}],"readme":"# @2amtech/sql-migration-tool\n\nA comprehensive database migration management library and CLI tool supporting MySQL, PostgreSQL, and MS SQL Server.\n\nFeatures:\n* Migrations are represented as `.sql` files allowing pure SQL scripts for both applying and rolling back changes supported by this tool and all other native desktop applications.\n* Multiple environments. Use one project to deploy to multiple environments like staging or production.\n* Dynamic replacements. Perform a string replace on pieces in the SQL file dependent on the selected environments allowing for targeting different tables or columns or inserting different data based on the selected environment.\n* Different credential sources. Avoid storing credentials in the code. Get credentials from `.env` files or AWS Secrets Manager.\n* Scripts support. Run various SQL scripts as `.sql` files with dynamic replacements applied.\n* Suitable for CI/CD. You can migrate to the latest or a specific migration in your pipeline during deployment.\n\n## Build\n\nThe package is built using TypeScript:\n\n```bash\nnpm run build\n```\n\n## Global CLI Usage\n\nInstall globally:\n\n```bash\nnpm install -g @2amtech/sql-migration-tool\n```\n\n### Commands\n\n**Note:** `<env>` refers to an environment name defined in your `configuration.yml` file (e.g., `local`, `dev`, `staging`, `production`). Each environment contains specific database connection settings.\n\n#### `init`\n\nInitialize a new project with a `configuration.yml` file.\n\n```bash\n2am-smt init [options]\n```\n\n**Options:**\n\n- `-d, --dir <directory>` - Absolute path to the directory where new project should be initialized (defaults to current directory)\n\nCreates a new project configuration file with default settings for MySQL database.\n\n#### `connection:test`\n\nTest the database connection for a specific environment.\n\n```bash\n2am-smt connection:test <environment> [options]\n```\n\n**Options:**\n\n- `-p, --project <projectConfig>` - Absolute path to the project config file (defaults to `./configuration.yml`)\n\nValidates database credentials and connectivity for the specified environment.\n\n#### `migrate:new`\n\nCreate a new migration file.\n\n```bash\n2am-smt migrate:new <migrationName> [options]\n```\n\n**Options:**\n\n- `-p, --project <projectConfig>` - Absolute path to the project config file (defaults to `./configuration.yml`)\n\nGenerates a timestamped migration file with up/down query templates in the migrations directory.\n\n#### `migrate:to`\n\nMigrate database to a specific migration state.\n\n```bash\n2am-smt migrate:to <env> [migrationName] [options]\n```\n\n**Options:**\n\n- `-p, --project <projectConfig>` - Absolute path to the project config file (defaults to `./configuration.yml`)\n- `-a, --auto-apply` - Automatically apply the migrations without confirmation\n- `-c, --count <count>` - Number of migrations to apply (positive) or rollback (negative)\n\nIf no migration name is provided, all pending migrations will be applied.\n\n#### `status`\n\nCheck database migration status.\n\n```bash\n2am-smt status <env> [options]\n```\n\n**Options:**\n\n- `-p, --project <projectConfig>` - Absolute path to the project config file (defaults to `./configuration.yml`)\n- `-l, --list-migrations` - List applied migrations\n\nShows the last applied migration and optionally lists all migrations that have been applied.\n\n#### `script:new`\n\nCreate a new script file.\n\n```bash\n2am-smt script:new <scriptName> [options]\n```\n\n**Options:**\n\n- `-p, --project <projectConfig>` - Absolute path to the project config file (defaults to `./configuration.yml`)\n\nGenerates a script file template in the scripts directory for one-time or repeatable SQL operations.\n\n#### `script:run`\n\nExecute a script against the database.\n\n```bash\n2am-smt script:run <env> <scriptName> [options]\n```\n\n**Options:**\n\n- `-p, --project <projectConfig>` - Absolute path to the project config file (defaults to `./configuration.yml`)\n\nRuns the specified script file against the database in the given environment.\n\n## License\n\nCopyright 2025 2am\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","readmeFilename":"README.md"}