wip
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Socialize.Api.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddApprovalWorkflowRuntime : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "WorkflowInstanceId",
|
||||
table: "ApprovalRequests",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "WorkflowStepRequiredApproverCount",
|
||||
table: "ApprovalRequests",
|
||||
type: "integer",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "WorkflowStepSortOrder",
|
||||
table: "ApprovalRequests",
|
||||
type: "integer",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "WorkflowStepTargetType",
|
||||
table: "ApprovalRequests",
|
||||
type: "character varying(32)",
|
||||
maxLength: 32,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "WorkflowStepTargetValue",
|
||||
table: "ApprovalRequests",
|
||||
type: "character varying(128)",
|
||||
maxLength: 128,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ApprovalWorkflowInstances",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
WorkspaceId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ContentItemId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
State = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||
ApprovalMode = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||
StartedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
|
||||
CompletedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ApprovalWorkflowInstances", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ApprovalRequests_WorkflowInstanceId",
|
||||
table: "ApprovalRequests",
|
||||
column: "WorkflowInstanceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ApprovalWorkflowInstances_ContentItemId",
|
||||
table: "ApprovalWorkflowInstances",
|
||||
column: "ContentItemId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ApprovalWorkflowInstances_ContentItemId_State",
|
||||
table: "ApprovalWorkflowInstances",
|
||||
columns: new[] { "ContentItemId", "State" },
|
||||
unique: true,
|
||||
filter: "\"State\" = 'Pending'");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ApprovalWorkflowInstances_WorkspaceId",
|
||||
table: "ApprovalWorkflowInstances",
|
||||
column: "WorkspaceId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ApprovalWorkflowInstances");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ApprovalRequests_WorkflowInstanceId",
|
||||
table: "ApprovalRequests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WorkflowInstanceId",
|
||||
table: "ApprovalRequests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WorkflowStepRequiredApproverCount",
|
||||
table: "ApprovalRequests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WorkflowStepSortOrder",
|
||||
table: "ApprovalRequests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WorkflowStepTargetType",
|
||||
table: "ApprovalRequests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WorkflowStepTargetValue",
|
||||
table: "ApprovalRequests");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user