1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BackendPIA.Migrations
{
/// <inheritdoc />
public partial class FixUserAccountIdColumn : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Tickets_AspNetUsers_OwnerId",
table: "Tickets");
migrationBuilder.DropIndex(
name: "IX_Tickets_OwnerId",
table: "Tickets");
migrationBuilder.DropColumn(
name: "OwnerId",
table: "Tickets");
migrationBuilder.AlterColumn<string>(
name: "UserAccountId",
table: "Tickets",
type: "text",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint");
migrationBuilder.CreateIndex(
name: "IX_Tickets_UserAccountId",
table: "Tickets",
column: "UserAccountId");
migrationBuilder.AddForeignKey(
name: "FK_Tickets_AspNetUsers_UserAccountId",
table: "Tickets",
column: "UserAccountId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Tickets_AspNetUsers_UserAccountId",
table: "Tickets");
migrationBuilder.DropIndex(
name: "IX_Tickets_UserAccountId",
table: "Tickets");
migrationBuilder.AlterColumn<long>(
name: "UserAccountId",
table: "Tickets",
type: "bigint",
nullable: false,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AddColumn<string>(
name: "OwnerId",
table: "Tickets",
type: "text",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Tickets_OwnerId",
table: "Tickets",
column: "OwnerId");
migrationBuilder.AddForeignKey(
name: "FK_Tickets_AspNetUsers_OwnerId",
table: "Tickets",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id");
}
}
}
|