using System; using Microsoft.Data.Entity.Migrations; namespace Yavsc.Migrations { public partial class command : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim_IdentityRole_RoleId", table: "AspNetRoleClaims"); migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim_ApplicationUser_UserId", table: "AspNetUserClaims"); migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin_ApplicationUser_UserId", table: "AspNetUserLogins"); migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_IdentityRole_RoleId", table: "AspNetUserRoles"); migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_ApplicationUser_UserId", table: "AspNetUserRoles"); migrationBuilder.DropForeignKey(name: "FK_AccountBalance_AccountHistory_HistoryId", table: "AccountBalance"); migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance"); migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog"); migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember"); migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember"); migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command"); migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_PerformerId", table: "Command"); migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile"); migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile"); migrationBuilder.DropTable("SimpleBookQuery"); migrationBuilder.CreateTable( name: "Query", columns: table => new { Id = table.Column(nullable: false) .Annotation("Npgsql:Serial", true), ClientId = table.Column(nullable: false), EventDate = table.Column(nullable: false), Final = table.Column(nullable: true), LocationId = table.Column(nullable: false), PerformerId = table.Column(nullable: false), Previsional = table.Column(nullable: true), ValidationDate = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Query", x => x.Id); table.ForeignKey( name: "FK_Query_ApplicationUser_ClientId", column: x => x.ClientId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Query_Location_LocationId", column: x => x.LocationId, principalTable: "Location", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Query_ApplicationUser_PerformerId", column: x => x.PerformerId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.AlterColumn( name: "ValidationDate", table: "Command", nullable: true); migrationBuilder.AddColumn( name: "Final", table: "Command", nullable: true); migrationBuilder.AddColumn( name: "Previsional", table: "Command", nullable: true); migrationBuilder.AddForeignKey( name: "FK_IdentityRoleClaim_IdentityRole_RoleId", table: "AspNetRoleClaims", column: "RoleId", principalTable: "AspNetRoles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_IdentityUserClaim_ApplicationUser_UserId", table: "AspNetUserClaims", column: "UserId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_IdentityUserLogin_ApplicationUser_UserId", table: "AspNetUserLogins", column: "UserId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_IdentityUserRole_IdentityRole_RoleId", table: "AspNetUserRoles", column: "RoleId", principalTable: "AspNetRoles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_IdentityUserRole_ApplicationUser_UserId", table: "AspNetUserRoles", column: "UserId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_AccountBalance_AccountHistory_HistoryId", table: "AccountBalance", column: "HistoryId", principalTable: "AccountHistory", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance", column: "UserId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog", column: "AuthorId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_CircleMember_Circle_CircleId", table: "CircleMember", column: "CircleId", principalTable: "Circle", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember", column: "MemberId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_Command_ApplicationUser_ClientId", table: "Command", column: "ClientId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_Command_ApplicationUser_PerformerId", table: "Command", column: "PerformerId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile", column: "ActivityCode", principalTable: "Activity", principalColumn: "Code", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile", column: "PerfomerId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim_IdentityRole_RoleId", table: "AspNetRoleClaims"); migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim_ApplicationUser_UserId", table: "AspNetUserClaims"); migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin_ApplicationUser_UserId", table: "AspNetUserLogins"); migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_IdentityRole_RoleId", table: "AspNetUserRoles"); migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_ApplicationUser_UserId", table: "AspNetUserRoles"); migrationBuilder.DropForeignKey(name: "FK_AccountBalance_AccountHistory_HistoryId", table: "AccountBalance"); migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance"); migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog"); migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember"); migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember"); migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command"); migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_PerformerId", table: "Command"); migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile"); migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile"); migrationBuilder.DropColumn(name: "Final", table: "Command"); migrationBuilder.DropColumn(name: "Previsional", table: "Command"); migrationBuilder.DropTable("Query"); migrationBuilder.CreateTable( name: "SimpleBookQuery", columns: table => new { Id = table.Column(nullable: false) .Annotation("Npgsql:Serial", true), ClientId = table.Column(nullable: false), EventDate = table.Column(nullable: false), LocationId = table.Column(nullable: false), PerformerId = table.Column(nullable: false), ValidationDate = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_SimpleBookQuery", x => x.Id); table.ForeignKey( name: "FK_SimpleBookQuery_ApplicationUser_ClientId", column: x => x.ClientId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_SimpleBookQuery_Location_LocationId", column: x => x.LocationId, principalTable: "Location", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_SimpleBookQuery_ApplicationUser_PerformerId", column: x => x.PerformerId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.AlterColumn( name: "ValidationDate", table: "Command", nullable: false); migrationBuilder.AddForeignKey( name: "FK_IdentityRoleClaim_IdentityRole_RoleId", table: "AspNetRoleClaims", column: "RoleId", principalTable: "AspNetRoles", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_IdentityUserClaim_ApplicationUser_UserId", table: "AspNetUserClaims", column: "UserId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_IdentityUserLogin_ApplicationUser_UserId", table: "AspNetUserLogins", column: "UserId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_IdentityUserRole_IdentityRole_RoleId", table: "AspNetUserRoles", column: "RoleId", principalTable: "AspNetRoles", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_IdentityUserRole_ApplicationUser_UserId", table: "AspNetUserRoles", column: "UserId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_AccountBalance_AccountHistory_HistoryId", table: "AccountBalance", column: "HistoryId", principalTable: "AccountHistory", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance", column: "UserId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog", column: "AuthorId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_CircleMember_Circle_CircleId", table: "CircleMember", column: "CircleId", principalTable: "Circle", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember", column: "MemberId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_Command_ApplicationUser_ClientId", table: "Command", column: "ClientId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_Command_ApplicationUser_PerformerId", table: "Command", column: "PerformerId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile", column: "ActivityCode", principalTable: "Activity", principalColumn: "Code", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile", column: "PerfomerId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); } } }