using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace UserManagement.API.Migrations { /// public partial class Initial : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Roles", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ROLE = table.Column(type: "nvarchar(max)", nullable: false), CREATION_DATE = table.Column(type: "datetime", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Roles", x => x.ID); }); migrationBuilder.CreateTable( name: "Users", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), USER_NAME = table.Column(type: "nvarchar(max)", nullable: false), FIRST_NAME = table.Column(type: "nvarchar(max)", nullable: false), LAST_NAME = table.Column(type: "nvarchar(max)", nullable: false), PASSWORD = table.Column(type: "nvarchar(max)", nullable: false), ROLE_ID = table.Column(type: "int", nullable: false), ROLE = table.Column(type: "int", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Users", x => x.ID); table.ForeignKey( name: "FK_Users_Roles_ROLE_ID", column: x => x.ROLE_ID, principalTable: "Roles", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Users_ROLE_ID", table: "Users", column: "ROLE_ID"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Users"); migrationBuilder.DropTable( name: "Roles"); } } }