mirror of
https://github.com/bitwarden/server.git
synced 2025-07-18 16:11:28 -05:00
Merge branch 'main' into add-docker-arm64-builds
This commit is contained in:
@ -1,18 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Migrator\Migrator.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommandDotNet" Version="7.0.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Migrator\Migrator.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommandDotNet" Version="7.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -9,7 +9,7 @@ internal class Program
|
||||
}
|
||||
|
||||
[DefaultCommand]
|
||||
public void Execute(
|
||||
public int Execute(
|
||||
[Operand(Description = "Database connection string")]
|
||||
string databaseConnectionString,
|
||||
[Option('r', "repeatable", Description = "Mark scripts as repeatable")]
|
||||
@ -17,17 +17,23 @@ 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
|
||||
)
|
||||
{
|
||||
return MigrateDatabase(databaseConnectionString, repeatable, folderName, dryRun, noTransactionMigration) ? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
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))
|
||||
{
|
||||
success = migrator.MigrateMsSqlDatabaseWithRetries(true, repeatable, folderName, dryRun);
|
||||
success = migrator.MigrateMsSqlDatabaseWithRetries(true, repeatable, folderName, dryRun: dryRun);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user