using System; using Microsoft.EntityFrameworkCore.Migrations; namespace UserService.DatabaseLayer.Migrations { public partial class InitialCreate : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Node", columns: table => new { Id = table.Column(nullable: false), CommonName = table.Column(nullable: false), Description = table.Column(nullable: true), ParentId = table.Column(nullable: true), Discriminator = table.Column(nullable: false), FirstName = table.Column(nullable: true), LastName = table.Column(nullable: true), IsActive = table.Column(nullable: true), EMail = table.Column(nullable: true), ManagerId = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Node", x => x.Id); table.ForeignKey( name: "FK_Node_Node_ParentId", column: x => x.ParentId, principalTable: "Node", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_Node_Node_ManagerId", column: x => x.ManagerId, principalTable: "Node", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "UserMembers", columns: table => new { MemberId = table.Column(nullable: false), AttachedMemberId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserMembers", x => new { x.MemberId, x.AttachedMemberId }); table.ForeignKey( name: "FK_UserMembers_Node_AttachedMemberId", column: x => x.AttachedMemberId, principalTable: "Node", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_UserMembers_Node_MemberId", column: x => x.MemberId, principalTable: "Node", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.InsertData( table: "Node", columns: new[] { "Id", "CommonName", "Description", "Discriminator", "ParentId", "ManagerId" }, values: new object[] { new Guid("c2366c9c-e79a-45c8-933c-40d0301b2551"), "Users", null, "OrganizationUnit", null, null }); migrationBuilder.InsertData( table: "Node", columns: new[] { "Id", "CommonName", "Description", "Discriminator", "ParentId", "ManagerId" }, values: new object[] { new Guid("c94f4749-b7c7-418d-8c10-bc4253c4b913"), "Groups", null, "OrganizationUnit", null, null }); migrationBuilder.InsertData( table: "Node", columns: new[] { "Id", "CommonName", "Description", "Discriminator", "ParentId", "ManagerId" }, values: new object[] { new Guid("c743fff4-9bdf-45a4-b4c9-391f6fc46433"), "Germany", null, "OrganizationUnit", new Guid("c2366c9c-e79a-45c8-933c-40d0301b2551"), null }); migrationBuilder.InsertData( table: "Node", columns: new[] { "Id", "CommonName", "Description", "Discriminator", "ParentId", "ManagerId" }, values: new object[] { new Guid("cecbf557-59cc-475c-b136-02da39aa4911"), "USA", null, "OrganizationUnit", new Guid("c2366c9c-e79a-45c8-933c-40d0301b2551"), null }); migrationBuilder.InsertData( table: "Node", columns: new[] { "Id", "CommonName", "Description", "Discriminator", "ParentId", "ManagerId" }, values: new object[] { new Guid("97ad8c82-c5ea-4de1-a474-bf25418a9533"), "France", null, "OrganizationUnit", new Guid("c2366c9c-e79a-45c8-933c-40d0301b2551"), null }); migrationBuilder.InsertData( table: "Node", columns: new[] { "Id", "CommonName", "Description", "Discriminator", "ParentId", "EMail", "FirstName", "IsActive", "LastName" }, values: new object[] { new Guid("fd9f5d95-0898-47d4-8d25-6956077ba269"), "holger", null, "User", new Guid("c2366c9c-e79a-45c8-933c-40d0301b2551"), null, null, true, null }); migrationBuilder.InsertData( table: "Node", columns: new[] { "Id", "CommonName", "Description", "Discriminator", "ParentId" }, values: new object[] { new Guid("a830a548-8b92-4a95-aa8e-c71ae814c6a3"), "Global Admin", null, "SecurityGroup", new Guid("c94f4749-b7c7-418d-8c10-bc4253c4b913") }); migrationBuilder.InsertData( table: "Node", columns: new[] { "Id", "CommonName", "Description", "Discriminator", "ParentId", "ManagerId" }, values: new object[] { new Guid("89e1d70e-da3d-4cc9-81f1-a2fa76a6d33b"), "Arizona", null, "OrganizationUnit", new Guid("cecbf557-59cc-475c-b136-02da39aa4911"), null }); migrationBuilder.InsertData( table: "UserMembers", columns: new[] { "MemberId", "AttachedMemberId" }, values: new object[] { new Guid("a830a548-8b92-4a95-aa8e-c71ae814c6a3"), new Guid("fd9f5d95-0898-47d4-8d25-6956077ba269") }); migrationBuilder.CreateIndex( name: "IX_Node_ParentId", table: "Node", column: "ParentId"); migrationBuilder.CreateIndex( name: "IX_Node_ManagerId", table: "Node", column: "ManagerId"); migrationBuilder.CreateIndex( name: "IX_UserMembers_AttachedMemberId", table: "UserMembers", column: "AttachedMemberId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "UserMembers"); migrationBuilder.DropTable( name: "Node"); } } }