1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00
Commit Graph

8 Commits

Author SHA1 Message Date
rkac-bw
b38b537ed1
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>
2024-10-09 08:48:19 -06:00
Rui Tomé
f5caecc6d6
[AC-1722] Deprecate "Edit/Delete Assigned Collections" custom permissions (#4604)
* Add SQL script to migrate custom users with specific permissions to User type

Remove 'editAssignedCollections' and 'deleteAssignedCollections' properties from Permissions in OrganizationUser table. Migrate custom users who only have these permissions to the User type.

* Add MySQL migration to migrate custom users with specific permissions to User type

* Add Postgres migration to migrate custom users with specific permissions to User type

* Add Sqlite migration to migrate custom users with specific permissions to User type

* Update AutoFixture usage in tests to resolve creating ILogger mock instances

* Update EF integration tests database contexts to use each respective Migrations assembly. Configure Sqlite instance

* Add RunMigration method to BaseEntityFrameworkRepository

* Add FinalFlexibleCollectionsDataMigrationsTests

* Improve data migration efficiency by using OPENJSON instead of multiple JSON_EXTRACT

* Add batching to the sql data migrations

* Update DbMigrator to run a specific script based on its name

* Update DatabaseDataAttribute to be able to test a specific migration

* Add reference to the migration projects to Infrastructure.IntegrationTest

* Add integration test to test the migration FinalFlexibleCollectionsDataMigrations

* Remove EFIntegration tests and remove RunMigration method from BaseEntityFrameworkRepository

* Add IMigrationTesterService and implementations for SQL and EF migrations

* Add FinalFlexibleCollectionsDataMigrationsTests and remove test from OrganizationUserRepositoryTests

* Update sql data migration script based on performance feedback

* Bump date on EF migration scripts

* Add xmldoc comments to IMigrationTesterService and each implementation

* Bump up the date on the EF migration scripts

* Bump up dates on EF migrations

* Added tests to assert no unwanted changes are made to the permissions json. Refactor tests.

* Revert changes made to DbMigrator and refactor SqlMigrationTesterService to not use it.

* Add method description

* Fix test to assert no changes are made to custom user

* Remove unnecessary COALESCE and SELECT CASE

* Unident lines on SQL script

* Update DatabaseDataAttribute MigrationName property to be nullable

* Fix null reference checks

* Remove unnecessary COALESCE from Postgres script

* Bump dates on migration scripts

* Bump up dates on EF migrations

* Add migration tests for handling null

* Add test for non json values

* Fix test

* Remove migrations

* Recreate EF migrations

* Update Postgres data migration script to check for valid JSON in Permissions column

---------

Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
2024-09-02 11:04:55 +01:00
Michał Chęciński
fd71ed8584
[DEVOPS-1218] Add dryrun mode to MsSqlMigratorUtility (#3795)
* Add dryrun mode to MsSqlMigratorUtility

* Fix

* Update util/MsSqlMigratorUtility/Program.cs

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>

* Update util/MsSqlMigratorUtility/Program.cs

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>

* Update util/MsSqlMigratorUtility/Program.cs

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>

* Fixes

* Fix using

* Format

* Update util/MsSqlMigratorUtility/Program.cs

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>

* Fixes

* Fix after merge

* Fix

* Fix

* Remove unnecessary param name

---------

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
2024-03-25 10:22:02 -04:00
Matt Bishop
743465273c
[PM-6909] Centralize database migration logic (#3910)
* Centralize database migration logic

* Clean up unused usings

* Prizatize

* Remove verbose flag from Docker invocation

* Allow argument passthrough still

Co-authored-by: Michał Chęciński <mchecinski@bitwarden.com>

* Allow DI logger

---------

Co-authored-by: Michał Chęciński <mchecinski@bitwarden.com>
2024-03-22 10:54:13 -04:00
Michał Chęciński
3e90f57797
[DEVOPS-1519] Add transition mode to mssql migrator utility (#3259)
* Add RerunableSqlTableJournal

* Add extension to use rerunable sql table journal

* Use rerunable sql journal

* format

* Enable logging

* FIx

* Disable logging

* Rename to SqlTableJournalExtensions

* Move RerunableSqlTableJournal to Extension class

* Fix usings

* Add rerunable schema

* Format

* Fix typo

* Enable logging in db migrator

* add rerunable column in dbo migrations table migration

* Trying

* Fix journal table name

* Trying to migrate first

* After migration

* Testing

* Add update from rerunable to not rerunable script

* Change name

* Add rerunable option and script folder name

* Add rerunable options and folder

* Fix

* Add transition (aka rerunable) migrations to Setup

* Parse parameters on migrator utility

* Fix sql scripts

* Remove CreateSchemaTableSql as it'll be migrated using migration

* Embed dbScripts_data_migration folder

* Remove testing sql script

* Add optins parsing nuget for msSqlMigratorUtility

* Fix sql journal

* Ran dotnet format

* Comment out index

* ▫️Revert "Comment out index"

This reverts commit df15fa91e0.

* Disable logging

* Add newline

* Rename rerunable to repeatable

* remove repeatable journal

* Remove migration adding the repeatable column in  dbo.Migrations table

* Add using

* Enable log for testing

* Disable logging in the setup

* Remove unused method

* Add migrator constants

* Use constants in yet another place

* Fix

* Add constant

* Fix

* Fix
2023-09-28 16:29:52 +02:00
Michał Chęciński
5e3f4c9bbe
Revert "Revert "[DEVOPS-1215] Build migrator CLI project (#2747)" (#2769)" (#2774)
This reverts commit f8cbd4ef7d.
2023-03-07 14:10:34 +01:00
Michał Chęciński
f8cbd4ef7d
Revert "[DEVOPS-1215] Build migrator CLI project (#2747)" (#2769)
This reverts commit 9cbf254fef.
2023-03-06 18:02:19 +01:00
Michał Chęciński
9cbf254fef
[DEVOPS-1215] Build migrator CLI project (#2747)
* Add migrator cli

* Ran format

* Acc build workflow

* Change paths in push and pr triggers

* Add build migrator cli to build workflow

* Remove build migrator cli workflow

* Add different levels of logs for verbose

* Rename migratorCLI to MsSqlMigratorUtility

* Add MsSqlMigratorUtility to solution file

* Remove the clean command

* Fix name and path in build workflow

* Add retry logic to DbMigrator instead of invocation

* Add migrator with retry mechanism as a new method

* Log the migration start log to migrate database method

* Fix name in build

* Fix cli leftovers

* Fix exception var name

* String interpolation

* Remove redundant check for number

* Remove CommandDotNet

* dotnet format

* Remove CommandDotNet from packages lock

* Remove all cli

* Trying to remove usings to see if this fixes linter

* Add usings back again - uild is failing

* Remove implicit usings

* Trying to fix linter issues

* Trying to fix linter
2023-03-06 15:39:30 +01:00