using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CSR.Infrastructure.Migrations { /// public partial class InitialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Roles", columns: table => new { RoleId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), RoleName = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Roles", x => x.RoleId); }); migrationBuilder.CreateTable( name: "Users", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Username = table.Column(type: "TEXT", nullable: false), Email = table.Column(type: "TEXT", nullable: false), Password = table.Column(type: "TEXT", nullable: false), RoleId = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Users", x => x.Id); table.ForeignKey( name: "FK_Users_Roles_RoleId", column: x => x.RoleId, principalTable: "Roles", principalColumn: "RoleId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Roles_RoleName", table: "Roles", column: "RoleName", unique: true); migrationBuilder.CreateIndex( name: "IX_Users_RoleId", table: "Users", column: "RoleId"); migrationBuilder.CreateIndex( name: "IX_Users_Username", table: "Users", column: "Username", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Users"); migrationBuilder.DropTable( name: "Roles"); } } }