Updated mssql driver for db-migrate
npm install db-migrate-mssql
Example database.json file
{
"defaultEnv": "local",
"local": {
"driver": "mssql",
"user": {"ENV": "DATABASE_USER"},
"password": {"ENV": "DATABASE_PASSWORD"},
"host": {"ENV": "DATABASE_HOST"},
"database": {"ENV": "DATABASE_NAME"}
}
}
In case of Error got unwanted exception: Failed to connect to host:1433 - self signed certificate
set trustServerCertificate
option to true
{
"defaultEnv": "local",
"local": {
"driver": "mssql",
"user": {"ENV": "DATABASE_USER"},
"password": {"ENV": "DATABASE_PASSWORD"},
"host": {"ENV": "DATABASE_HOST"},
"database": {"ENV": "DATABASE_NAME"},
"options": {
"trustServerCertificate": true
}
}
}
Error got unwanted exception: ENOENT: no such file or directory, scandir '/migrations'
Migrations folder is not created by default, you need to do it manually
In case of sql-file
output do not use GO
as query ending, use ;
instead
If migrations execution freeze try to avoid doing it inside transaction with --non-transactional
option