You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
5.5 KiB
114 lines
5.5 KiB
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace X1.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddTestScenarioTables : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "tb_testscenarios",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
|
ScenarioCode = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
|
ScenarioName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
|
|
Type = table.Column<string>(type: "text", nullable: false),
|
|
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
|
|
IsEnabled = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true),
|
|
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
CreatedBy = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
|
UpdatedBy = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_tb_testscenarios", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "tb_scenariotestcases",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
|
ScenarioId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
|
TestCaseFlowId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
|
IsEnabled = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true),
|
|
ExecutionOrder = table.Column<int>(type: "integer", nullable: false, defaultValue: 0),
|
|
LoopCount = table.Column<int>(type: "integer", nullable: false, defaultValue: 1),
|
|
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
CreatedBy = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
|
UpdatedBy = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_tb_scenariotestcases", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_tb_scenariotestcases_tb_testcaseflow_TestCaseFlowId",
|
|
column: x => x.TestCaseFlowId,
|
|
principalTable: "tb_testcaseflow",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_tb_scenariotestcases_tb_testscenarios_ScenarioId",
|
|
column: x => x.ScenarioId,
|
|
principalTable: "tb_testscenarios",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_tb_scenariotestcases_ScenarioId",
|
|
table: "tb_scenariotestcases",
|
|
column: "ScenarioId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_tb_scenariotestcases_ScenarioId_ExecutionOrder",
|
|
table: "tb_scenariotestcases",
|
|
columns: new[] { "ScenarioId", "ExecutionOrder" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_tb_scenariotestcases_ScenarioId_TestCaseFlowId",
|
|
table: "tb_scenariotestcases",
|
|
columns: new[] { "ScenarioId", "TestCaseFlowId" },
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_tb_scenariotestcases_TestCaseFlowId",
|
|
table: "tb_scenariotestcases",
|
|
column: "TestCaseFlowId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_tb_testscenarios_IsEnabled",
|
|
table: "tb_testscenarios",
|
|
column: "IsEnabled");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_tb_testscenarios_ScenarioCode",
|
|
table: "tb_testscenarios",
|
|
column: "ScenarioCode",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_tb_testscenarios_Type",
|
|
table: "tb_testscenarios",
|
|
column: "Type");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "tb_scenariotestcases");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "tb_testscenarios");
|
|
}
|
|
}
|
|
}
|
|
|