forked from ddrilling/AsbCloudServer
551c60c4ff
Rename some fields in DB.permission.
68 lines
2.4 KiB
C#
68 lines
2.4 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace AsbCloudDb.Migrations
|
|
{
|
|
public partial class Rename_Permissions_fields : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_t_permission_t_permission_info_id_permission",
|
|
table: "t_permission");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "permission_value",
|
|
table: "t_permission",
|
|
newName: "value");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "id_permission",
|
|
table: "t_permission",
|
|
newName: "id_permission_info");
|
|
|
|
migrationBuilder.RenameIndex(
|
|
name: "IX_t_permission_id_permission",
|
|
table: "t_permission",
|
|
newName: "IX_t_permission_id_permission_info");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_t_permission_t_permission_info_id_permission_info",
|
|
table: "t_permission",
|
|
column: "id_permission_info",
|
|
principalTable: "t_permission_info",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_t_permission_t_permission_info_id_permission_info",
|
|
table: "t_permission");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "value",
|
|
table: "t_permission",
|
|
newName: "permission_value");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "id_permission_info",
|
|
table: "t_permission",
|
|
newName: "id_permission");
|
|
|
|
migrationBuilder.RenameIndex(
|
|
name: "IX_t_permission_id_permission_info",
|
|
table: "t_permission",
|
|
newName: "IX_t_permission_id_permission");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_t_permission_t_permission_info_id_permission",
|
|
table: "t_permission",
|
|
column: "id_permission",
|
|
principalTable: "t_permission_info",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|