Database updates
This commit is contained in:
148
FoodsharingSiegen.Server/Migrations/20220124091416_Init.cs
Normal file
148
FoodsharingSiegen.Server/Migrations/20220124091416_Init.cs
Normal file
@@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FoodsharingSiegen.Server.Migrations
|
||||
{
|
||||
public partial class Init : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Prospects",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
FsId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
ProgressId = table.Column<Guid>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Prospects", x => x.Id);
|
||||
table.UniqueConstraint("AK_Prospects_ProgressId", x => x.ProgressId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Mail = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Type = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Verified = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Created = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Users", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "InteractionProcesses",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
EinAb1Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
EinAb2Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
EinAb3Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
WelcomeId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
VerifyId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
PassId = table.Column<Guid>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_InteractionProcesses", x => x.Id);
|
||||
table.UniqueConstraint("AK_InteractionProcesses_EinAb1Id", x => x.EinAb1Id);
|
||||
table.UniqueConstraint("AK_InteractionProcesses_EinAb2Id", x => x.EinAb2Id);
|
||||
table.UniqueConstraint("AK_InteractionProcesses_EinAb3Id", x => x.EinAb3Id);
|
||||
table.UniqueConstraint("AK_InteractionProcesses_PassId", x => x.PassId);
|
||||
table.UniqueConstraint("AK_InteractionProcesses_VerifyId", x => x.VerifyId);
|
||||
table.UniqueConstraint("AK_InteractionProcesses_WelcomeId", x => x.WelcomeId);
|
||||
table.ForeignKey(
|
||||
name: "FK_InteractionProcesses_Prospects_Id",
|
||||
column: x => x.Id,
|
||||
principalTable: "Prospects",
|
||||
principalColumn: "ProgressId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "InteractionDates",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Date = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
UserId = table.Column<Guid>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_InteractionDates", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_InteractionDates_InteractionProcesses_Id",
|
||||
column: x => x.Id,
|
||||
principalTable: "InteractionProcesses",
|
||||
principalColumn: "EinAb1Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_InteractionDates_InteractionProcesses_Id1",
|
||||
column: x => x.Id,
|
||||
principalTable: "InteractionProcesses",
|
||||
principalColumn: "EinAb2Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_InteractionDates_InteractionProcesses_Id2",
|
||||
column: x => x.Id,
|
||||
principalTable: "InteractionProcesses",
|
||||
principalColumn: "EinAb3Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_InteractionDates_InteractionProcesses_Id3",
|
||||
column: x => x.Id,
|
||||
principalTable: "InteractionProcesses",
|
||||
principalColumn: "PassId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_InteractionDates_InteractionProcesses_Id4",
|
||||
column: x => x.Id,
|
||||
principalTable: "InteractionProcesses",
|
||||
principalColumn: "VerifyId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_InteractionDates_InteractionProcesses_Id5",
|
||||
column: x => x.Id,
|
||||
principalTable: "InteractionProcesses",
|
||||
principalColumn: "WelcomeId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_InteractionDates_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InteractionDates_UserId",
|
||||
table: "InteractionDates",
|
||||
column: "UserId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "InteractionDates");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "InteractionProcesses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Prospects");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user