1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 08:32:50 -05:00

Store migrations in a migrations db (#1992)

* Store migrations in a migrations db

Added the -p flag to run_migrations for pipeline to run from
environment variables

Created meta-migrations script to pre-populate migrations_vault_dev
tables with run migrations for those already using the last_migrations
file

* Update dev/helpers/mssql/migrate_migrations.sh

Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>

* Update dev/helpers/mssql/run_migrations.sh

Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>

* Remove last_migration file creation

Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>
This commit is contained in:
Matt Gibson
2022-05-16 13:16:34 -04:00
committed by GitHub
parent 53241f16e0
commit 47b1e5317c
3 changed files with 138 additions and 39 deletions

View File

@ -0,0 +1,23 @@
#!/usr/bin/env pwsh
# This script need only be run once
#
# This is a migration script for updating recording the last migration run
# in a file to recording migrations in a database table. It will create a
# migrations_vault table and store all of the previously run migrations as
# indicated by a last_migrations file. It will then delete this file.
# Due to azure-edge-sql not containing the mssql-tools on ARM, we manually use
# the mssql-tools container which runs under x86_64. We should monitor this
# in the future and investigate if we can migrate back.
# docker-compose --profile mssql exec mssql bash /mnt/helpers/run_migrations.sh @args
docker run `
-v "$(pwd)/helpers/mssql:/mnt/helpers" `
-v "$(pwd)/../util/Migrator:/mnt/migrator/" `
-v "$(pwd)/.data/mssql:/mnt/data" `
--env-file .env `
--network=bitwardenserver_default `
--rm `
-it `
mcr.microsoft.com/mssql-tools `
/mnt/helpers/migrate_migrations.sh @args