1.0.4 โ€ข Published 6 months ago

@enurhadi24/mssql-syncer v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

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:

CommandDescription
set-connection <connStr>Set MSSQL connection string in ADO format
pullPull all procedures/functions from DB into local files
pushPush all local .sql procedures/functions back to database
get-connectionShow currently saved MSSQL connection string

Options

  • --versionโ€ƒShow version number
  • --helpโ€ƒโ€ƒShow 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.MyTable

They 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_SERVER

If the environment variables are not set, no replacements will be made.


๐Ÿงช Example Usage

  1. Set connection:
mssql-syncer set-connection "Server=localhost,1433;Database=argo-tracking;User Id=SA;Password=MyPass@word;Encrypt=false;TrustServerCertificate=true;"
  1. Pull all routines:
mssql-syncer pull
  1. Push all routines:
mssql-syncer push
  1. View saved connection:
mssql-syncer get-connection

๐Ÿ‘จโ€๐Ÿ’ป Author

Created by Endang Nuradi


1.0.4

6 months ago

1.0.3

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago