mirror of
https://github.com/bitwarden/server
synced 2026-01-02 08:33:48 +00:00
PM-23030 adding migration script (#6009)
* PM-23030 adding migration script * PM-23030 fixing store procedure sql file * PM-23030 fixing syntax error * PM-23030 fixing migration * PM-23030 fixing sql script * PM-23030 fixing migration order * PM_23030 fixing migrations * PM-23030 fixing migration script validation error * PM-23030 fixing migration * PM-23030 trying to fix validation error * PM-23030 fixing migration script * PM-23030 updating sql scripts to change data type * PM-23030 adding report key to organization application * PM-23030 adding report key migration scripts * PM-23030 adding migration scripts * PM-23030 changing key column name
This commit is contained in:
@@ -12,6 +12,7 @@ public class OrganizationApplication : ITableObject<Guid>, IRevisable
|
||||
public string Applications { get; set; } = string.Empty;
|
||||
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
|
||||
public DateTime RevisionDate { get; set; } = DateTime.UtcNow;
|
||||
public string ContentEncryptionKey { get; set; } = string.Empty;
|
||||
|
||||
public void SetNewId()
|
||||
{
|
||||
|
||||
@@ -13,6 +13,8 @@ public class OrganizationReport : ITableObject<Guid>
|
||||
public string ReportData { get; set; } = string.Empty;
|
||||
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public string ContentEncryptionKey { get; set; } = string.Empty;
|
||||
|
||||
public void SetNewId()
|
||||
{
|
||||
Id = CoreHelpers.GenerateComb();
|
||||
|
||||
@@ -3,7 +3,8 @@ CREATE PROCEDURE [dbo].[OrganizationApplication_Create]
|
||||
@OrganizationId UNIQUEIDENTIFIER,
|
||||
@Applications NVARCHAR(MAX),
|
||||
@CreationDate DATETIME2(7),
|
||||
@RevisionDate DATETIME2(7)
|
||||
@RevisionDate DATETIME2(7),
|
||||
@ContentEncryptionKey VARCHAR(MAX)
|
||||
AS
|
||||
SET NOCOUNT ON;
|
||||
|
||||
@@ -13,13 +14,15 @@ AS
|
||||
[OrganizationId],
|
||||
[Applications],
|
||||
[CreationDate],
|
||||
[RevisionDate]
|
||||
[RevisionDate],
|
||||
[ContentEncryptionKey]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
(
|
||||
@Id,
|
||||
@OrganizationId,
|
||||
@Applications,
|
||||
@CreationDate,
|
||||
@RevisionDate
|
||||
);
|
||||
@RevisionDate,
|
||||
@ContentEncryptionKey
|
||||
);
|
||||
|
||||
@@ -3,21 +3,24 @@ CREATE PROCEDURE [dbo].[OrganizationReport_Create]
|
||||
@OrganizationId UNIQUEIDENTIFIER,
|
||||
@Date DATETIME2(7),
|
||||
@ReportData NVARCHAR(MAX),
|
||||
@CreationDate DATETIME2(7)
|
||||
@CreationDate DATETIME2(7),
|
||||
@ContentEncryptionKey VARCHAR(MAX)
|
||||
AS
|
||||
SET NOCOUNT ON;
|
||||
|
||||
INSERT INTO [dbo].[OrganizationReport](
|
||||
INSERT INTO [dbo].[OrganizationReport](
|
||||
[Id],
|
||||
[OrganizationId],
|
||||
[Date],
|
||||
[ReportData],
|
||||
[CreationDate]
|
||||
[CreationDate],
|
||||
[ContentEncryptionKey]
|
||||
)
|
||||
VALUES (
|
||||
VALUES (
|
||||
@Id,
|
||||
@OrganizationId,
|
||||
@Date,
|
||||
@ReportData,
|
||||
@CreationDate
|
||||
@CreationDate,
|
||||
@ContentEncryptionKey
|
||||
);
|
||||
|
||||
@@ -4,9 +4,10 @@ CREATE TABLE [dbo].[OrganizationApplication] (
|
||||
[Applications] NVARCHAR(MAX) NOT NULL,
|
||||
[CreationDate] DATETIME2 (7) NOT NULL,
|
||||
[RevisionDate] DATETIME2 (7) NOT NULL,
|
||||
[ContentEncryptionKey] VARCHAR(MAX) NOT NULL,
|
||||
CONSTRAINT [PK_OrganizationApplication] PRIMARY KEY CLUSTERED ([Id] ASC),
|
||||
CONSTRAINT [FK_OrganizationApplication_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id])
|
||||
);
|
||||
);
|
||||
GO
|
||||
|
||||
CREATE NONCLUSTERED INDEX [IX_OrganizationApplication_OrganizationId]
|
||||
|
||||
@@ -4,9 +4,10 @@ CREATE TABLE [dbo].[OrganizationReport] (
|
||||
[Date] DATETIME2 (7) NOT NULL,
|
||||
[ReportData] NVARCHAR(MAX) NOT NULL,
|
||||
[CreationDate] DATETIME2 (7) NOT NULL,
|
||||
[ContentEncryptionKey] VARCHAR(MAX) NOT NULL,
|
||||
CONSTRAINT [PK_OrganizationReport] PRIMARY KEY CLUSTERED ([Id] ASC),
|
||||
CONSTRAINT [FK_OrganizationReport_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id])
|
||||
);
|
||||
);
|
||||
GO
|
||||
|
||||
CREATE NONCLUSTERED INDEX [IX_OrganizationReport_OrganizationId]
|
||||
|
||||
Reference in New Issue
Block a user