using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Data.Migrations { /// public partial class InitialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Events", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", maxLength: 128, nullable: false), ShortName = table.Column(type: "TEXT", nullable: true), EventFormat = table.Column(type: "INTEGER", nullable: false), MinTeamSize = table.Column(type: "INTEGER", nullable: false), MaxTeamSize = table.Column(type: "INTEGER", nullable: false), SemifinalistActivity = table.Column(type: "TEXT", nullable: true), Notes = table.Column(type: "TEXT", nullable: true), MaxTeamCountState = table.Column(type: "INTEGER", nullable: false), RegionalEvent = table.Column(type: "INTEGER", nullable: false), RegionalPresubmit = table.Column(type: "INTEGER", nullable: false), StatePresubmission = table.Column(type: "INTEGER", nullable: false), StatePretesting = table.Column(type: "INTEGER", nullable: false), StatePreliminaryRound = table.Column(type: "INTEGER", nullable: false), Documentation = table.Column(type: "TEXT", nullable: true), Eligibility = table.Column(type: "TEXT", nullable: false), Theme = table.Column(type: "TEXT", nullable: true), Description = table.Column(type: "TEXT", nullable: true), LevelOfEffort = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Events", x => x.Id); }); migrationBuilder.CreateTable( name: "Students", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Students", x => x.Id); }); migrationBuilder.CreateTable( name: "Teams", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), CaptainId = table.Column(type: "INTEGER", nullable: true), TeamNumber = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Teams", x => x.Id); table.ForeignKey( name: "FK_Teams_Students_CaptainId", column: x => x.CaptainId, principalTable: "Students", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "StudentTeam", columns: table => new { StudentsId = table.Column(type: "INTEGER", nullable: false), TeamsId = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_StudentTeam", x => new { x.StudentsId, x.TeamsId }); table.ForeignKey( name: "FK_StudentTeam_Students_StudentsId", column: x => x.StudentsId, principalTable: "Students", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_StudentTeam_Teams_TeamsId", column: x => x.TeamsId, principalTable: "Teams", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Events_Name", table: "Events", column: "Name"); migrationBuilder.CreateIndex( name: "IX_StudentTeam_TeamsId", table: "StudentTeam", column: "TeamsId"); migrationBuilder.CreateIndex( name: "IX_Teams_CaptainId", table: "Teams", column: "CaptainId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Events"); migrationBuilder.DropTable( name: "StudentTeam"); migrationBuilder.DropTable( name: "Teams"); migrationBuilder.DropTable( name: "Students"); } } }