@enurhadi24/mssql-syncer
v1.0.4
Published
Sync MSSQL stored procedures and functions with local files
Downloads
29
Maintainers
Readme
MSSQL Syncer
Sync your stored procedures & functions from SQL Server to files and vice versa.
📦 Installation
npm install -g @enurhadi24/mssql-syncer⚙️ CLI Commands
mssql-syncer <command>Available Commands:
| Command | Description |
| -------------------------- | ----------------------------------------------------------- |
| set-connection <connStr> | Set MSSQL connection string in ADO format |
| pull | Pull all procedures/functions from DB into local files |
| push | Push all local .sql procedures/functions back to database |
| get-connection | Show currently saved MSSQL connection string |
Options
--versionShow version number--helpShow help info
📁 Output Folder Structure
After running pull, your SQL files will be saved in the following structure:
sql/
├── procedures/
│ └── your_procedure.sql
└── functions/
└── your_function.sql🌐 Optional: Use Environment Variables
If your procedures or functions reference hardcoded database names or linked servers like:
SELECT * FROM [db-prod].dbo.MyTableThey will be dynamically replaced during pull and push using values from a .env file.
Example .env file:
MSSQL_SYNCER_DB_NAME=DUMMY_DB
MSSQL_SYNCER_DB_LINK_SERVER=DUMMY_LINK_SERVERIf the environment variables are not set, no replacements will be made.
🧪 Example Usage
- Set connection:
mssql-syncer set-connection "Server=localhost,1433;Database=argo-tracking;User Id=SA;Password=MyPass@word;Encrypt=false;TrustServerCertificate=true;"- Pull all routines:
mssql-syncer pull- Push all routines:
mssql-syncer push- View saved connection:
mssql-syncer get-connection👨💻 Author
Created by Endang Nuradi
