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.
153 lines
6.6 KiB
153 lines
6.6 KiB
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class migV1 : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Alumni",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "TEXT", nullable: false),
|
|
FirstName = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
|
|
LastName = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
|
Email = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
|
EntryYear = table.Column<string>(type: "TEXT", nullable: false),
|
|
Password = table.Column<string>(type: "TEXT", nullable: false),
|
|
Role = table.Column<string>(type: "TEXT", nullable: false),
|
|
Linkedin = table.Column<string>(type: "TEXT", nullable: true),
|
|
Github = table.Column<string>(type: "TEXT", nullable: true),
|
|
WebSite = table.Column<string>(type: "TEXT", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Alumni", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Events",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "TEXT", nullable: false),
|
|
Title = table.Column<string>(type: "TEXT", maxLength: 128, nullable: false),
|
|
Description = table.Column<string>(type: "TEXT", maxLength: 512, nullable: false),
|
|
Date = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
nbPlaces = table.Column<int>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Events", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Experiences",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "TEXT", nullable: false),
|
|
Title = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
|
|
StartDate = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
EndDate = table.Column<DateTime>(type: "TEXT", nullable: true),
|
|
CompanyName = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
|
|
IsCurrent = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
AlumniId = table.Column<string>(type: "TEXT", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Experiences", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Experiences_Alumni_AlumniId",
|
|
column: x => x.AlumniId,
|
|
principalTable: "Alumni",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Formations",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "TEXT", nullable: false),
|
|
SchoolName = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
|
|
Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
|
|
StartDate = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
EndDate = table.Column<DateTime>(type: "TEXT", nullable: true),
|
|
IsCurrent = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
AlumniId = table.Column<string>(type: "TEXT", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Formations", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Formations_Alumni_AlumniId",
|
|
column: x => x.AlumniId,
|
|
principalTable: "Alumni",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AlumniEntityEventEntity",
|
|
columns: table => new
|
|
{
|
|
EventsId = table.Column<string>(type: "TEXT", nullable: false),
|
|
ParticipantsId = table.Column<string>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AlumniEntityEventEntity", x => new { x.EventsId, x.ParticipantsId });
|
|
table.ForeignKey(
|
|
name: "FK_AlumniEntityEventEntity_Alumni_ParticipantsId",
|
|
column: x => x.ParticipantsId,
|
|
principalTable: "Alumni",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_AlumniEntityEventEntity_Events_EventsId",
|
|
column: x => x.EventsId,
|
|
principalTable: "Events",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AlumniEntityEventEntity_ParticipantsId",
|
|
table: "AlumniEntityEventEntity",
|
|
column: "ParticipantsId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Experiences_AlumniId",
|
|
table: "Experiences",
|
|
column: "AlumniId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Formations_AlumniId",
|
|
table: "Formations",
|
|
column: "AlumniId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AlumniEntityEventEntity");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Experiences");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Formations");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Events");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Alumni");
|
|
}
|
|
}
|
|
}
|