1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

Add variable for production migration transaction level (#4702)

* Addd variable for production migration transaction level

* Added variable for production migration transaction level with default value

* Clean up comments

* Removed uneeded directive

* Changed time format for timeout on migration

* white space formatting

* white space formatting again

* white space formatting once again

* white space formatting once again

* clean up

* CHnaged to builder.WithoutTransaction()

* Changed to optyion flag from n to nt for notransaction

* Changed to optyion flag from n to no-transaction for  without transaction

* Change desription of option

---------

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
This commit is contained in:
rkac-bw
2024-10-09 08:48:19 -06:00
committed by GitHub
parent 58c6f09629
commit b38b537ed1
2 changed files with 27 additions and 11 deletions

View File

@ -17,13 +17,15 @@ internal class Program
[Option('f', "folder", Description = "Folder name of database scripts")]
string folderName = MigratorConstants.DefaultMigrationsFolderName,
[Option('d', "dry-run", Description = "Print the scripts that will be applied without actually executing them")]
bool dryRun = false
) => MigrateDatabase(databaseConnectionString, repeatable, folderName, dryRun);
bool dryRun = false,
[Option("no-transaction", Description = "Run without adding transaction per script or all scripts")]
bool noTransactionMigration = false
) => MigrateDatabase(databaseConnectionString, repeatable, folderName, dryRun, noTransactionMigration);
private static bool MigrateDatabase(string databaseConnectionString,
bool repeatable = false, string folderName = "", bool dryRun = false)
bool repeatable = false, string folderName = "", bool dryRun = false, bool noTransactionMigration = false)
{
var migrator = new DbMigrator(databaseConnectionString);
var migrator = new DbMigrator(databaseConnectionString, noTransactionMigration: noTransactionMigration);
bool success;
if (!string.IsNullOrWhiteSpace(folderName))
{