using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; namespace GreenTree.Maschinenbestellungen.Domain.Migrations { public partial class InitialCreate : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Policies", columns: table => new { Name = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Policies", x => x.Name); }); migrationBuilder.CreateTable( name: "Users", columns: table => new { Id = table.Column(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Accountname = table.Column(nullable: false), Forename = table.Column(nullable: false), Lastname = table.Column(nullable: false), MailAddress = table.Column(nullable: false), Password = table.Column(nullable: false), Birthdate = table.Column(nullable: true), Activated = table.Column(nullable: false, defaultValue: true) }, constraints: table => { table.PrimaryKey("PK_Users", x => x.Id); }); migrationBuilder.CreateTable( name: "UserPolicies", columns: table => new { PolicyName = table.Column(nullable: false), UserId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserPolicies", x => new { x.UserId, x.PolicyName }); table.ForeignKey( name: "FK_UserPolicies_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Policies"); migrationBuilder.DropTable( name: "UserPolicies"); migrationBuilder.DropTable( name: "Users"); } } }