using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace API.Data.Migrations { public partial class SeriesRelations : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "SeriesRelation", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), RelationKind = table.Column(type: "INTEGER", nullable: false), TargetSeriesId = table.Column(type: "INTEGER", nullable: false), SeriesId = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SeriesRelation", x => x.Id); table.ForeignKey( name: "FK_SeriesRelation_Series_SeriesId", column: x => x.SeriesId, principalTable: "Series", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_SeriesRelation_Series_TargetSeriesId", column: x => x.TargetSeriesId, principalTable: "Series", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_SeriesRelation_SeriesId", table: "SeriesRelation", column: "SeriesId"); migrationBuilder.CreateIndex( name: "IX_SeriesRelation_TargetSeriesId", table: "SeriesRelation", column: "TargetSeriesId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "SeriesRelation"); } } }