1
0
mirror of https://github.com/bitwarden/server.git synced 2025-01-02 18:47:44 +01:00

Fix initial database creation in run_migrations.sh (#2009)

This commit is contained in:
Thomas Avery 2022-05-23 11:35:39 -05:00 committed by GitHub
parent 719abc7e61
commit dded4e7780
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,11 +36,16 @@ END;
IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'migrations_$DATABASE') IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'migrations_$DATABASE')
BEGIN BEGIN
CREATE DATABASE migrations_$DATABASE; CREATE DATABASE migrations_$DATABASE;
CREATE TABLE [migrations_$DATABASE].[dbo].[migrations] ( END;
GO
IF OBJECT_ID('[migrations_$DATABASE].[dbo].[migrations]') IS NULL
BEGIN
CREATE TABLE [migrations_$DATABASE].[dbo].[migrations] (
[Id] INT IDENTITY(1,1) PRIMARY KEY, [Id] INT IDENTITY(1,1) PRIMARY KEY,
[Filename] NVARCHAR(MAX) NOT NULL, [Filename] NVARCHAR(MAX) NOT NULL,
[CreationDate] DATETIME2 (7) NULL, [CreationDate] DATETIME2 (7) NULL,
); );
END;" END;"
/opt/mssql-tools/bin/sqlcmd -S $SERVER -d master -U $USER -P $PASSWD -I -Q "$QUERY" /opt/mssql-tools/bin/sqlcmd -S $SERVER -d master -U $USER -P $PASSWD -I -Q "$QUERY"