protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_Prize_Shop_ShopId", table: "Prize");
     migrationBuilder.DropForeignKey(name: "FK_Puzzle_Shop_ShopId", table: "Puzzle");
     migrationBuilder.AlterColumn<TimeSpan>(
         name: "Opening2",
         table: "OpeningHours",
         nullable: true);
     migrationBuilder.AlterColumn<TimeSpan>(
         name: "Opening1",
         table: "OpeningHours",
         nullable: true);
     migrationBuilder.AlterColumn<TimeSpan>(
         name: "Closing2",
         table: "OpeningHours",
         nullable: true);
     migrationBuilder.AlterColumn<TimeSpan>(
         name: "Closing1",
         table: "OpeningHours",
         nullable: true);
     migrationBuilder.AddForeignKey(
         name: "FK_Prize_Shop_ShopId",
         table: "Prize",
         column: "ShopId",
         principalTable: "Shop",
         principalColumn: "ID",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_Puzzle_Shop_ShopId",
         table: "Puzzle",
         column: "ShopId",
         principalTable: "Shop",
         principalColumn: "ID",
         onDelete: ReferentialAction.Cascade);
 }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
     migrationBuilder.AlterColumn<string>(
         name: "UserId",
         table: "AspNetUserLogins",
         nullable: false);
     migrationBuilder.AlterColumn<string>(
         name: "UserId",
         table: "AspNetUserClaims",
         nullable: false);
     migrationBuilder.AlterColumn<string>(
         name: "RoleId",
         table: "AspNetRoleClaims",
         nullable: false);
     migrationBuilder.AddColumn<string>(
         name: "Discriminator",
         table: "AspNetRoles",
         nullable: false,
         defaultValue: "");
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
         table: "AspNetRoleClaims",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
         table: "AspNetUserClaims",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
         table: "AspNetUserLogins",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
         table: "AspNetUserRoles",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
         table: "AspNetUserRoles",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
 }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<DateTime>(
                name: "LastUpdated",
                table: "Projects",
                nullable: false,
                defaultValueSql: "GetDate()");

            migrationBuilder.AddColumn<DateTime>(
                name: "LastUpdated",
                table: "Products",
                nullable: false,
                defaultValueSql: "GetDate()");

            migrationBuilder.AlterColumn<DateTime>(
                name: "LastUpdated",
                table: "WorkItems",
                nullable: false,
                defaultValueSql: "GetDate()");

            migrationBuilder.AlterColumn<DateTime>(
                name: "LastUpdated",
                table: "ProductCategories",
                nullable: false,
                defaultValueSql: "GetDate()");
        }
 protected override void Down(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.AlterColumn<bool>(
         name: "IsRecurring",
         schema: "dbo",
         table: "Events",
         isNullable: false,
         defaultValue: false);
     migrationBuilder.AlterColumn<int>(
         name: "ContactId",
         schema: "dbo",
         table: "Events",
         isNullable: true);
     migrationBuilder.AddColumn<int>(
         name: "ContactId1",
         schema: "dbo",
         table: "Events",
         isNullable: false,
         defaultValue: 0);
     migrationBuilder.AddForeignKey(
         name: "FK_ChurchEvent_ChurchMember_ContactId1",
         schema: "dbo",
         table: "Events",
         column: "ContactId1",
         principalSchema: "dbo",
         principalTable: "Members",
         principalColumn: "Id");
 }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_Category_Article", table: "Article");
     migrationBuilder.AlterColumn<string>(
         name: "Url",
         table: "Section",
         nullable: false);
     migrationBuilder.AlterColumn<string>(
         name: "Title",
         table: "Section",
         nullable: false);
     migrationBuilder.AlterColumn<string>(
         name: "Url",
         table: "Category",
         nullable: false);
     migrationBuilder.AlterColumn<string>(
         name: "Title",
         table: "Category",
         nullable: false);
     migrationBuilder.AddForeignKey(
         name: "FK_Category_Article",
         table: "Article",
         column: "CategoryId",
         principalTable: "Category",
         principalColumn: "CategoryId",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_Section_Category",
         table: "Category",
         column: "SectionId",
         principalTable: "Section",
         principalColumn: "SectionId",
         onDelete: ReferentialAction.Cascade);
 }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Products_ProductCategories_ProjectCategoryProductCategoryId",
                table: "Products");

            migrationBuilder.AlterColumn<int>(
                name: "ProjectCategoryProductCategoryId",
                table: "Products",
                nullable: false);

            migrationBuilder.AlterColumn<string>(
                name: "ProductName",
                table: "Products",
                maxLength: 100,
                nullable: false);

            migrationBuilder.AlterColumn<string>(
                name: "ProductDescription",
                table: "Products",
                maxLength: 1000,
                nullable: false);

            migrationBuilder.AddForeignKey(
                name: "FK_Products_ProductCategories_ProjectCategoryProductCategoryId",
                table: "Products",
                column: "ProjectCategoryProductCategoryId",
                principalTable: "ProductCategories",
                principalColumn: "ProductCategoryId",
                onDelete: ReferentialAction.Cascade);
        }
 protected override void Down(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_PriceHistory_Stock_StockId", table: "PriceHistory");
     migrationBuilder.DropForeignKey(name: "FK_Txn_Stock_StockId", table: "Txn");
     migrationBuilder.AlterColumn<decimal>(
         name: "Open",
         table: "PriceHistory",
         nullable: false);
     migrationBuilder.AlterColumn<decimal>(
         name: "Low",
         table: "PriceHistory",
         nullable: false);
     migrationBuilder.AlterColumn<decimal>(
         name: "High",
         table: "PriceHistory",
         nullable: false);
     migrationBuilder.AlterColumn<decimal>(
         name: "Close",
         table: "PriceHistory",
         nullable: false);
     migrationBuilder.AddForeignKey(
         name: "FK_PriceHistory_Stock_StockId",
         table: "PriceHistory",
         column: "StockId",
         principalTable: "Stock",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_Txn_Stock_StockId",
         table: "Txn",
         column: "StockId",
         principalTable: "Stock",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
 }
 protected override void Down(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
     migrationBuilder.DropColumn(name: "City", table: "AspNetUsers");
     migrationBuilder.DropColumn(name: "State", table: "AspNetUsers");
     migrationBuilder.DropTable("ToDo");
     migrationBuilder.AlterColumn<string>(
         name: "UserId",
         table: "AspNetUserLogins",
         nullable: true);
     migrationBuilder.AlterColumn<string>(
         name: "UserId",
         table: "AspNetUserClaims",
         nullable: true);
     migrationBuilder.AlterColumn<string>(
         name: "RoleId",
         table: "AspNetRoleClaims",
         nullable: true);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
         table: "AspNetRoleClaims",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
         table: "AspNetUserClaims",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
         table: "AspNetUserLogins",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
         table: "AspNetUserRoles",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
         table: "AspNetUserRoles",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
 }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.AlterColumn<string>(
         name: "LastName",
         table: "Player",
         nullable: false);
     migrationBuilder.AlterColumn<string>(
         name: "FirstName",
         table: "Player",
         nullable: false);
 }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.AlterColumn<int>(
         name: "Weight",
         table: "Player",
         nullable: true);
     migrationBuilder.AlterColumn<int>(
         name: "Height",
         table: "Player",
         nullable: true);
 }
 protected override void Down(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_ChirpPost_ChirpUser_UserId", table: "ChirpPost");
     migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ChirpUser_UserId", table: "AspNetUserClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ChirpUser_UserId", table: "AspNetUserLogins");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ChirpUser_UserId", table: "AspNetUserRoles");
     migrationBuilder.DropColumn(name: "HasProfilePicture", table: "AspNetUsers");
     migrationBuilder.AlterColumn<int>(
         name: "UserId",
         table: "ChirpPost",
         nullable: false);
     migrationBuilder.AlterColumn<DateTime>(
         name: "PostTime",
         table: "ChirpPost",
         nullable: false);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
         table: "AspNetRoleClaims",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserClaim<string>_ChirpUser_UserId",
         table: "AspNetUserClaims",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserLogin<string>_ChirpUser_UserId",
         table: "AspNetUserLogins",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
         table: "AspNetUserRoles",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_ChirpUser_UserId",
         table: "AspNetUserRoles",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
 }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<string>(
                name: "LastName",
                table: "Student",
                nullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "FirstMidName",
                table: "Student",
                nullable: true);
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<DateTimeOffset>(
                name: "StartTime",
                table: "TemperatureSettings",
                nullable: true);

            migrationBuilder.AlterColumn<DateTimeOffset>(
                name: "EndTime",
                table: "TemperatureSettings",
                nullable: true);
        }
 protected override void Down(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropColumn(name: "ReleaseDate", table: "Movie");
     migrationBuilder.DropColumn(name: "TicketPrice", table: "Movie");
     migrationBuilder.AlterColumn<string>(
         name: "Title",
         table: "Movie",
         nullable: true);
     migrationBuilder.AlterColumn<string>(
         name: "Director",
         table: "Movie",
         nullable: true);
 }
 public override void Up(MigrationBuilder migration)
 {
     migration.AlterColumn(
         name: "CampaignId",
         table: "Activity",
         type: "int",
         nullable: false);
     migration.AlterColumn(
         name: "TenantId",
         table: "Activity",
         type: "int",
         nullable: false);
 }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.AlterColumn<bool>(
         name: "IsDeleted",
         table: "Thing",
         isNullable: false,
         defaultValue: false);
     migrationBuilder.AlterColumn<int>(
         name: "FavouriteNumber",
         table: "Thing",
         isNullable: false,
         defaultValue: 42);
 }
 public override void Up(MigrationBuilder migration)
 {
     migration.AlterColumn(
         name: "Latitude",
         table: "PhoneSpotting",
         type: "float",
         nullable: false);
     migration.AlterColumn(
         name: "Longitude",
         table: "PhoneSpotting",
         type: "float",
         nullable: false);
 }
 public override void Up(MigrationBuilder migration)
 {
     migration.AlterColumn(
         name: "DireccionId",
         table: "Usuario",
         type: "int",
         nullable: true);
     migration.AlterColumn(
         name: "TelefonoId",
         table: "Usuario",
         type: "int",
         nullable: true);
 }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.CreateTable(
         name: "Rating",
         columns: table => new
         {
             RateId = table.Column<int>(nullable: false)
                 .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
             Email = table.Column<string>(nullable: true),
             PostId = table.Column<int>(nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Rating", x => x.RateId);
             table.ForeignKey(
                 name: "FK_Rating_Post_PostId",
                 column: x => x.PostId,
                 principalTable: "Post",
                 principalColumn: "Id");
         });
     migrationBuilder.AlterColumn<string>(
         name: "Name",
         table: "Post",
         nullable: true);
 }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.AlterColumn<DateTime>(
         name: "EndTime",
         table: "Borrow",
         isNullable: true);
 }
Exemple #21
0
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder?.AlterColumn <bool>(
         name: "AssigneeId",
         table: "TR_TICKET",
         nullable: true);
 }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Tweets_Categories_CategoryId",
                table: "Tweets");

            migrationBuilder.DropIndex(
                name: "IX_Tweets_CategoryId",
                table: "Tweets");

            migrationBuilder.AlterColumn<int>(
                name: "CategoryId",
                table: "Tweets",
                nullable: false);

            migrationBuilder.CreateIndex(
                name: "IX_Tweets_CategoryId",
                table: "Tweets",
                column: "CategoryId");

            migrationBuilder.AddForeignKey(
                name: "FK_Tweets_Categories_CategoryId",
                table: "Tweets",
                column: "CategoryId",
                principalTable: "Categories",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
 protected override void Down(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.AlterColumn<int>(
         name: "ClassSubmissionType",
         table: "Questions",
         nullable: true);
 }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<string>(
                name: "CartId",
                table: "CartItem",
                type: "nvarchar(500)",
                nullable: false);

            migrationBuilder.CreateTable(
                name: "Cart",
                columns: table => new
                {
                    CartId = table.Column<string>(nullable: false, type: "nvarchar(500)")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Cart", x => x.CartId);
                });
            migrationBuilder.AddForeignKey(
                name: "FK_CartItem_Cart_CartId",
                table: "CartItem",
                column: "CartId",
                principalTable: "Cart",
                principalColumn: "CartId");
        }
 protected override void Down(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.AlterColumn<int>(
         name: "UserId",
         table: "Bookmark",
         nullable: false);
 }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_ChurchEvent_ChurchMember_ContactId1", schema: "dbo", table: "Events");
     migrationBuilder.DropColumn(name: "ContactId1", schema: "dbo", table: "Events");
     migrationBuilder.AlterColumn<bool>(
         name: "IsRecurring",
         schema: "dbo",
         table: "Events",
         isNullable: false,
         defaultValue: false);
     migrationBuilder.AlterColumn<int>(
         name: "ContactId",
         schema: "dbo",
         table: "Events",
         isNullable: false);
 }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.AlterColumn<DateTimeOffset>(
         name: "CreatedDateTime",
         table: "TemperatureEntries",
         nullable: false);
 }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Products_ProductsWithMaintenance_MaintenanceId",
                table: "Products");

            migrationBuilder.DropIndex(
                name: "IX_Products_MaintenanceId",
                table: "Products");

            migrationBuilder.DropColumn(
                name: "MaintenanceId",
                table: "Products");

            migrationBuilder.AlterColumn<int>(
                name: "Id",
                table: "ProductsWithMaintenance",
                nullable: false);

            migrationBuilder.CreateIndex(
                name: "IX_ProductsWithMaintenance_Id",
                table: "ProductsWithMaintenance",
                column: "Id",
                unique: true);

            migrationBuilder.AddForeignKey(
                name: "FK_ProductsWithMaintenance_Products_Id",
                table: "ProductsWithMaintenance",
                column: "Id",
                principalTable: "Products",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.AlterColumn<string>(
         name: "Name",
         table: "Skill",
         nullable: false);
 }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_ProductsWithMaintenance_Products_Id",
                table: "ProductsWithMaintenance");

            migrationBuilder.DropIndex(
                name: "IX_ProductsWithMaintenance_Id",
                table: "ProductsWithMaintenance");

            migrationBuilder.AddColumn<int>(
                name: "MaintenanceId",
                table: "Products",
                nullable: true);

            migrationBuilder.AlterColumn<int>(
                name: "Id",
                table: "ProductsWithMaintenance",
                nullable: false)
                .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

            migrationBuilder.CreateIndex(
                name: "IX_Products_MaintenanceId",
                table: "Products",
                column: "MaintenanceId",
                unique: true);

            migrationBuilder.AddForeignKey(
                name: "FK_Products_ProductsWithMaintenance_MaintenanceId",
                table: "Products",
                column: "MaintenanceId",
                principalTable: "ProductsWithMaintenance",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.AlterColumn<string>(
         name: "UserId",
         table: "Bookmark",
         nullable: true);
 }
Exemple #32
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Articles_AspNetUsers_UserId",
                table: "Articles");

            migrationBuilder.DropForeignKey(
                name: "FK_Comments_AspNetUsers_UserId",
                table: "Comments");

            migrationBuilder.DropForeignKey(
                name: "FK_Locations_Addresses_AddressId",
                table: "Locations");

            migrationBuilder.DropForeignKey(
                name: "FK_Locations_Coordinates_LatLonId",
                table: "Locations");

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "Towns",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Type",
                table: "LocationTypes",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "LatLonId",
                table: "Locations",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "AddressId",
                table: "Locations",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Url",
                table: "Images",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "UserId",
                table: "Comments",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(450)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Content",
                table: "Comments",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "UserId",
                table: "Articles",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(450)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Title",
                table: "Articles",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Content",
                table: "Articles",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AddForeignKey(
                name: "FK_Articles_AspNetUsers_UserId",
                table: "Articles",
                column: "UserId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Comments_AspNetUsers_UserId",
                table: "Comments",
                column: "UserId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Locations_Addresses_AddressId",
                table: "Locations",
                column: "AddressId",
                principalTable: "Addresses",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Locations_Coordinates_LatLonId",
                table: "Locations",
                column: "LatLonId",
                principalTable: "Coordinates",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
Exemple #33
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_Employees",
                table: "Employees");

            migrationBuilder.DropIndex(
                name: "IX_Employees_SSN",
                table: "Employees");

            migrationBuilder.DropSequence(
                name: "EntityFrameworkHiLoSequence");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "Employees");

            migrationBuilder.AlterColumn<string>(
                name: "SSN",
                table: "Employees",
                type: "nvarchar(450)",
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "nvarchar(450)",
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "FirstName",
                table: "Employees",
                type: "nvarchar(450)",
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "FamilyName",
                table: "Employees",
                type: "nvarchar(450)",
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_Employees",
                table: "Employees",
                columns: new[] { "SSN", "FirstName", "FamilyName" });

            migrationBuilder.CreateTable(
                name: "SecondaryIdentity",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    InActiveUse = table.Column<bool>(type: "bit", nullable: false),
                    PrimarySSN = table.Column<string>(type: "nvarchar(450)", nullable: true),
                    PrimaryFirstName = table.Column<string>(type: "nvarchar(450)", nullable: true),
                    PrimaryFamilyName = table.Column<string>(type: "nvarchar(450)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SecondaryIdentity", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SecondaryIdentity_Employees_PrimarySSN_PrimaryFirstName_PrimaryFamilyName",
                        columns: x => new { x.PrimarySSN, x.PrimaryFirstName, x.PrimaryFamilyName },
                        principalTable: "Employees",
                        principalColumns: new[] { "SSN", "FirstName", "FamilyName" },
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_SecondaryIdentity_PrimarySSN_PrimaryFirstName_PrimaryFamilyName",
                table: "SecondaryIdentity",
                columns: new[] { "PrimarySSN", "PrimaryFirstName", "PrimaryFamilyName" },
                unique: true,
                filter: "[PrimarySSN] IS NOT NULL AND [PrimaryFirstName] IS NOT NULL AND [PrimaryFamilyName] IS NOT NULL");
        }
Exemple #34
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Votes");

            migrationBuilder.DropTable(
                name: "Restos");

            migrationBuilder.DropTable(
                name: "Sondages");

            migrationBuilder.DeleteData(
                table: "Personnes",
                keyColumn: "PersonneId",
                keyValue: 1);

            migrationBuilder.DeleteData(
                table: "Personnes",
                keyColumn: "PersonneId",
                keyValue: 2);

            migrationBuilder.DeleteData(
                table: "Personnes",
                keyColumn: "PersonneId",
                keyValue: 3);

            migrationBuilder.DeleteData(
                table: "Personnes",
                keyColumn: "PersonneId",
                keyValue: 4);

            migrationBuilder.DeleteData(
                table: "Personnes",
                keyColumn: "PersonneId",
                keyValue: 5);

            migrationBuilder.AlterColumn <string>(
                name: "Ville",
                table: "Personnes",
                type: "nvarchar(max)",
                nullable: true,
                oldClrType: typeof(string));

            migrationBuilder.AlterColumn <string>(
                name: "Telephone",
                table: "Personnes",
                type: "nvarchar(max)",
                nullable: true,
                oldClrType: typeof(string));

            migrationBuilder.AlterColumn <string>(
                name: "Prenom",
                table: "Personnes",
                type: "nvarchar(max)",
                nullable: true,
                oldClrType: typeof(string));

            migrationBuilder.AlterColumn <string>(
                name: "Nom",
                table: "Personnes",
                type: "nvarchar(max)",
                nullable: true,
                oldClrType: typeof(string));

            migrationBuilder.AlterColumn <string>(
                name: "Mail",
                table: "Personnes",
                type: "nvarchar(max)",
                nullable: true,
                oldClrType: typeof(string));

            migrationBuilder.AlterColumn <string>(
                name: "Adresse",
                table: "Personnes",
                type: "nvarchar(max)",
                nullable: true,
                oldClrType: typeof(string));

            migrationBuilder.InsertData(
                table: "Personnes",
                columns: new[] { "PersonneId", "Adresse", "CodePostal", "Mail", "Nom", "Prenom", "Telephone", "Ville" },
                values: new object[, ]
            {
                { 1, "Allée Reaumure", 26000, "*****@*****.**", "DIALLO", "Abdou", "06 16 43 28 73", "Valence" },
                { 2, "5C Eugene Varlin", 93000, "*****@*****.**", "Barry", "Aminata", "06 13 43 75 83", "Montreuil" },
                { 3, "3 martin Guemou", 13000, "*****@*****.**", "Bah", "Aly", "06 13 66 75 23", "Marseil" },
                { 4, "13 allée clotures", 33000, "*****@*****.**", "Sow", "Moussa", "06 43 53 15 73", "Grenoble" },
                { 5, "13 allée des Martirs", 73000, "*****@*****.**", "Camara", "Amara", "06 43 15 15 73", "Paris" }
            });
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "RoomImageUrl",
                table: "rooms");

            migrationBuilder.RenameColumn(
                name: "RoomType",
                table: "roomTypes",
                newName: "RoomTypeName");

            migrationBuilder.AlterColumn<decimal>(
                name: "RoomPrice",
                table: "rooms",
                type: "decimal(18,2)",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)");

            migrationBuilder.CreateTable(
                name: "signInUserModels",
                columns: table => new
                {
                    Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                });

            migrationBuilder.CreateTable(
                name: "signUpUserModels",
                columns: table => new
                {
                    FirstName = table.Column<string>(type: "nvarchar(100)", nullable: false),
                    LastName = table.Column<string>(type: "nvarchar(100)", nullable: false),
                    City = table.Column<string>(type: "nvarchar(35)", maxLength: 35, nullable: true),
                    Address = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ConfirmPassword = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                });

            migrationBuilder.CreateIndex(
                name: "IX_rooms_BookingStatusId",
                table: "rooms",
                column: "BookingStatusId");

            migrationBuilder.CreateIndex(
                name: "IX_rooms_RoomTypeId",
                table: "rooms",
                column: "RoomTypeId");

            migrationBuilder.AddForeignKey(
                name: "FK_rooms_bookingStatuses_BookingStatusId",
                table: "rooms",
                column: "BookingStatusId",
                principalTable: "bookingStatuses",
                principalColumn: "BookingStatusId",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_rooms_roomTypes_RoomTypeId",
                table: "rooms",
                column: "RoomTypeId",
                principalTable: "roomTypes",
                principalColumn: "RoomTypeId",
                onDelete: ReferentialAction.Cascade);
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_TestDrives_Statuses_StatusId",
                table: "TestDrives");

            migrationBuilder.DropForeignKey(
                name: "FK_TestDrives_AspNetUsers_UserId",
                table: "TestDrives");

            migrationBuilder.DropIndex(
                name: "IX_TestDrives_StatusId",
                table: "TestDrives");

            migrationBuilder.DropIndex(
                name: "IX_TestDrives_UserId",
                table: "TestDrives");

            migrationBuilder.DropColumn(
                name: "StatusId",
                table: "TestDrives");

            migrationBuilder.DropColumn(
                name: "UserId",
                table: "TestDrives");

            migrationBuilder.AlterColumn <DateTime>(
                name: "ScheduleDate",
                table: "TestDrives",
                nullable: false,
                defaultValue: new DateTime(2019, 7, 27, 20, 43, 31, 651, DateTimeKind.Utc).AddTicks(1154),
                oldClrType: typeof(DateTime),
                oldDefaultValue: new DateTime(2019, 7, 27, 21, 24, 59, 177, DateTimeKind.Utc).AddTicks(6578));

            migrationBuilder.CreateTable(
                name: "TestDrivesStatuses",
                columns: table => new
            {
                Id          = table.Column <string>(nullable: false),
                StatusId    = table.Column <string>(nullable: false),
                TestDriveId = table.Column <string>(nullable: false),
                UserId      = table.Column <string>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_TestDrivesStatuses", x => x.Id);
                table.ForeignKey(
                    name: "FK_TestDrivesStatuses_Statuses_StatusId",
                    column: x => x.StatusId,
                    principalTable: "Statuses",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
                table.ForeignKey(
                    name: "FK_TestDrivesStatuses_TestDrives_TestDriveId",
                    column: x => x.TestDriveId,
                    principalTable: "TestDrives",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
                table.ForeignKey(
                    name: "FK_TestDrivesStatuses_AspNetUsers_UserId",
                    column: x => x.UserId,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateIndex(
                name: "IX_TestDrivesStatuses_StatusId",
                table: "TestDrivesStatuses",
                column: "StatusId");

            migrationBuilder.CreateIndex(
                name: "IX_TestDrivesStatuses_TestDriveId",
                table: "TestDrivesStatuses",
                column: "TestDriveId");

            migrationBuilder.CreateIndex(
                name: "IX_TestDrivesStatuses_UserId",
                table: "TestDrivesStatuses",
                column: "UserId");
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_UserComponentTypeDetails_ComponentTypeDetails_ComponentTypeDetailId",
                table: "UserComponentTypeDetails");

            migrationBuilder.DropForeignKey(
                name: "FK_UserComponentTypes_AspNetUsers_IdentityUserId",
                table: "UserComponentTypes");

            migrationBuilder.DropIndex(
                name: "IX_UserComponentTypes_IdentityUserId",
                table: "UserComponentTypes");

            migrationBuilder.AlterColumn <int>(
                name: "IdentityUserId",
                table: "UserComponentTypes",
                type: "int",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AddColumn <string>(
                name: "IdentityUserId1",
                table: "UserComponentTypes",
                type: "nvarchar(450)",
                nullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "ComponentTypeDetailId",
                table: "UserComponentTypeDetails",
                type: "int",
                nullable: false,
                oldClrType: typeof(int),
                oldNullable: true);

            migrationBuilder.AddColumn <int>(
                name: "UserTypeComponentId",
                table: "UserComponentTypeDetails",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateIndex(
                name: "IX_UserComponentTypes_IdentityUserId1",
                table: "UserComponentTypes",
                column: "IdentityUserId1");

            migrationBuilder.AddForeignKey(
                name: "FK_UserComponentTypeDetails_ComponentTypeDetails_ComponentTypeDetailId",
                table: "UserComponentTypeDetails",
                column: "ComponentTypeDetailId",
                principalTable: "ComponentTypeDetails",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_UserComponentTypes_AspNetUsers_IdentityUserId1",
                table: "UserComponentTypes",
                column: "IdentityUserId1",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
Exemple #38
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn <DateTime>(
                name: "RowVersion",
                table: "Users",
                rowVersion: true,
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "timestamp(6)",
                oldNullable: true)
            .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);

            migrationBuilder.AlterColumn <DateTime>(
                name: "RowVersion",
                table: "Storage",
                rowVersion: true,
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "timestamp(6)",
                oldNullable: true)
            .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);

            migrationBuilder.AlterColumn <DateTime>(
                name: "RowVersion",
                table: "Role",
                rowVersion: true,
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "timestamp(6)",
                oldNullable: true)
            .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);

            migrationBuilder.AlterColumn <DateTime>(
                name: "RowVersion",
                table: "Region",
                rowVersion: true,
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "timestamp(6)",
                oldNullable: true)
            .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);

            migrationBuilder.AlterColumn <DateTime>(
                name: "RowVersion",
                table: "GoodsType",
                rowVersion: true,
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "timestamp(6)",
                oldNullable: true)
            .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);

            migrationBuilder.AlterColumn <DateTime>(
                name: "RowVersion",
                table: "Goods",
                rowVersion: true,
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "timestamp(6)",
                oldNullable: true)
            .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);

            migrationBuilder.CreateTable(
                name: "StorageRegion",
                columns: table => new
            {
                Id = table.Column <int>(nullable: false)
                     .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                CreatedTime = table.Column <DateTime>(nullable: false),
                ModifyTime  = table.Column <DateTime>(nullable: false),
                RowVersion  = table.Column <DateTime>(rowVersion: true, nullable: true)
                              .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn),
                StorageId = table.Column <int>(nullable: false),
                RegionId  = table.Column <int>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_StorageRegion", x => x.Id);
            });
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn <string>(
                name: "sex_skull",
                table: "Bones",
                type: "varchar(1)",
                unicode: false,
                maxLength: 1,
                nullable: true,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "rack",
                table: "Bones",
                type: "varchar(1)",
                unicode: false,
                maxLength: 1,
                nullable: true,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "pubic_symphysis",
                table: "Bones",
                type: "varchar(1)",
                unicode: false,
                maxLength: 1,
                nullable: true,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "porotic_hyperososis_locations",
                table: "Bones",
                type: "varchar(1)",
                unicode: false,
                maxLength: 1,
                nullable: true,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "osteophytosis",
                table: "Bones",
                type: "varchar(1)",
                unicode: false,
                maxLength: 1,
                nullable: true,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "osteology_unknown_comment",
                table: "Bones",
                type: "varchar(1)",
                unicode: false,
                maxLength: 1,
                nullable: true,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "foreman_magnum",
                table: "Bones",
                type: "varchar(1)",
                unicode: false,
                maxLength: 1,
                nullable: true,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "epiphyseal_union",
                table: "Bones",
                type: "varchar(1)",
                unicode: false,
                maxLength: 1,
                nullable: true,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "cranial_suture",
                table: "Bones",
                type: "varchar(1)",
                unicode: false,
                maxLength: 1,
                nullable: true,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "basilar_suture",
                table: "Bones",
                type: "varchar(1)",
                unicode: false,
                maxLength: 1,
                nullable: true,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "age_skull",
                table: "Bones",
                type: "varchar(1)",
                unicode: false,
                maxLength: 1,
                nullable: true,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50,
                oldNullable: true);
        }
Exemple #40
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn <DateTime>(
                name: "UltimaCompra",
                table: "Proveedores",
                type: "datetime",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "datetime");

            migrationBuilder.AlterColumn <DateTime>(
                name: "FechaAlta",
                table: "Proveedores",
                type: "datetime",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "datetime");

            migrationBuilder.CreateTable(
                name: "CategoriaMenus",
                columns: table => new
            {
                IdCategoriaMenu = table.Column <int>(type: "int", nullable: false)
                                  .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn),
                Nombre = table.Column <string>(type: "text", nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_CategoriaMenus", x => x.IdCategoriaMenu);
            });

            migrationBuilder.CreateTable(
                name: "CategoriaOpcions",
                columns: table => new
            {
                IdCategoriaOpcion = table.Column <int>(type: "int", nullable: false)
                                    .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn),
                Nombre          = table.Column <string>(type: "text", nullable: true),
                IdCategoriaMenu = table.Column <int>(type: "int", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_CategoriaOpcions", x => x.IdCategoriaOpcion);
                table.ForeignKey(
                    name: "FK_CategoriaOpcions_CategoriaMenus_IdCategoriaMenu",
                    column: x => x.IdCategoriaMenu,
                    principalTable: "CategoriaMenus",
                    principalColumn: "IdCategoriaMenu",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "Clientes",
                columns: table => new
            {
                Id = table.Column <int>(type: "int", nullable: false)
                     .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn),
                ClaveRegistro                 = table.Column <string>(type: "text", nullable: true),
                RazonSocial                   = table.Column <string>(type: "text", nullable: false),
                Rfc                           = table.Column <string>(type: "text", nullable: true),
                Email                         = table.Column <string>(type: "text", nullable: false),
                Telefono                      = table.Column <string>(type: "text", nullable: false),
                Celular                       = table.Column <string>(type: "text", nullable: true),
                Domicilio                     = table.Column <string>(type: "text", nullable: true),
                Ciudad                        = table.Column <string>(type: "text", nullable: true),
                Estado                        = table.Column <string>(type: "text", nullable: true),
                Pais                          = table.Column <string>(type: "text", nullable: true),
                Cp                            = table.Column <string>(type: "text", nullable: true),
                Comentario                    = table.Column <string>(type: "text", nullable: false),
                Paqueteria                    = table.Column <string>(type: "text", nullable: true),
                FechaAlta                     = table.Column <DateTime>(type: "datetime", nullable: true),
                Banco                         = table.Column <string>(type: "text", nullable: true),
                ClaveBancaria                 = table.Column <string>(type: "text", nullable: true),
                CuentaBancaria                = table.Column <string>(type: "text", nullable: true),
                Representante                 = table.Column <string>(type: "text", nullable: false),
                EmpresaTelefeono              = table.Column <string>(type: "text", nullable: true),
                EmpresaCelular                = table.Column <string>(type: "text", nullable: false),
                EmpresaEmail                  = table.Column <string>(type: "text", nullable: true),
                EmpresaDomicilio              = table.Column <string>(type: "text", nullable: true),
                EmpresaCiudad                 = table.Column <string>(type: "text", nullable: true),
                EmpresaEstado                 = table.Column <string>(type: "text", nullable: true),
                EmpresaPais                   = table.Column <string>(type: "text", nullable: true),
                EmpresaCp                     = table.Column <string>(type: "text", nullable: true),
                DiasCredito                   = table.Column <decimal>(type: "decimal(18, 2)", nullable: false),
                LimiteCredito                 = table.Column <decimal>(type: "decimal(18, 2)", nullable: false),
                IdCategoria                   = table.Column <int>(type: "int", nullable: false),
                CategoriaIdCategoriaOpcion    = table.Column <int>(type: "int", nullable: true),
                IdNumeroPrecio                = table.Column <int>(type: "int", nullable: false),
                NumeroPrecioIdCategoriaOpcion = table.Column <int>(type: "int", nullable: true),
                Activo                        = table.Column <bool>(type: "tinyint(1)", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Clientes", x => x.Id);
                table.ForeignKey(
                    name: "FK_Clientes_CategoriaOpcions_CategoriaIdCategoriaOpcion",
                    column: x => x.CategoriaIdCategoriaOpcion,
                    principalTable: "CategoriaOpcions",
                    principalColumn: "IdCategoriaOpcion",
                    onDelete: ReferentialAction.Restrict);
                table.ForeignKey(
                    name: "FK_Clientes_CategoriaOpcions_NumeroPrecioIdCategoriaOpcion",
                    column: x => x.NumeroPrecioIdCategoriaOpcion,
                    principalTable: "CategoriaOpcions",
                    principalColumn: "IdCategoriaOpcion",
                    onDelete: ReferentialAction.Restrict);
            });

            migrationBuilder.CreateIndex(
                name: "IX_CategoriaOpcions_IdCategoriaMenu",
                table: "CategoriaOpcions",
                column: "IdCategoriaMenu");

            migrationBuilder.CreateIndex(
                name: "IX_Clientes_CategoriaIdCategoriaOpcion",
                table: "Clientes",
                column: "CategoriaIdCategoriaOpcion");

            migrationBuilder.CreateIndex(
                name: "IX_Clientes_NumeroPrecioIdCategoriaOpcion",
                table: "Clientes",
                column: "NumeroPrecioIdCategoriaOpcion");
        }
Exemple #41
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn <string>(
                name: "StationName",
                table: "Stations",
                type: "text",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "TEXT",
                oldNullable: true);

            migrationBuilder.AlterColumn <double>(
                name: "GegrLon",
                table: "Stations",
                type: "double precision",
                nullable: false,
                oldClrType: typeof(float),
                oldType: "REAL");

            migrationBuilder.AlterColumn <double>(
                name: "GegrLat",
                table: "Stations",
                type: "double precision",
                nullable: false,
                oldClrType: typeof(float),
                oldType: "REAL");

            migrationBuilder.AlterColumn <int>(
                name: "CityId",
                table: "Stations",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "INTEGER");

            migrationBuilder.AlterColumn <string>(
                name: "AddressStreet",
                table: "Stations",
                type: "text",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "TEXT",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "Id",
                table: "Stations",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "INTEGER")
            .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

            migrationBuilder.AlterColumn <string>(
                name: "ProvinceName",
                table: "Provinces",
                type: "text",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "TEXT",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "Id",
                table: "Provinces",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "INTEGER")
            .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

            migrationBuilder.AlterColumn <double>(
                name: "ParamNorm",
                table: "Norms",
                type: "double precision",
                nullable: false,
                oldClrType: typeof(float),
                oldType: "REAL");

            migrationBuilder.AlterColumn <string>(
                name: "ParamCode",
                table: "Norms",
                type: "text",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "TEXT");

            migrationBuilder.AlterColumn <int>(
                name: "ProvienceId",
                table: "Districts",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "INTEGER");

            migrationBuilder.AlterColumn <string>(
                name: "DistrictName",
                table: "Districts",
                type: "text",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "TEXT",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "Id",
                table: "Districts",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "INTEGER")
            .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

            migrationBuilder.AlterColumn <int>(
                name: "DistrictId",
                table: "Communes",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "INTEGER");

            migrationBuilder.AlterColumn <string>(
                name: "CommuneName",
                table: "Communes",
                type: "text",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "TEXT",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "Id",
                table: "Communes",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "INTEGER")
            .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "Cities",
                type: "text",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "TEXT",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "CommuneId",
                table: "Cities",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "INTEGER");

            migrationBuilder.AlterColumn <int>(
                name: "Id",
                table: "Cities",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "INTEGER")
            .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
        }
Exemple #42
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "TransactionSourceTypes",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "ServiceTypes",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "Services",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "ReligiousBackgrounds",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "PhoneNumber",
                table: "Persons",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "Persons",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <DateTime>(
                name: "MarriageAnniversary",
                table: "Persons",
                nullable: true,
                oldClrType: typeof(DateTime));

            migrationBuilder.AlterColumn <int>(
                name: "LastVisitYearOfMarriageAnniversary",
                table: "Persons",
                nullable: true,
                oldClrType: typeof(int));

            migrationBuilder.AlterColumn <int>(
                name: "LastVisitYearOfBirthday",
                table: "Persons",
                nullable: true,
                oldClrType: typeof(int));

            migrationBuilder.AlterColumn <DateTime>(
                name: "LastVisitDate",
                table: "Persons",
                nullable: true,
                oldClrType: typeof(DateTime));

            migrationBuilder.AlterColumn <int>(
                name: "GradeId",
                table: "Persons",
                nullable: true,
                oldClrType: typeof(int));

            migrationBuilder.AlterColumn <DateTime>(
                name: "Birthday",
                table: "Persons",
                nullable: true,
                oldClrType: typeof(DateTime));

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "MarriageTypes",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "MaritalStatuses",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "ReceiptNumber",
                table: "Incomes",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "Grades",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "ExpenseTypes",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "Countries",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);
        }
Exemple #43
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Course_Department_DepartmentID",
                table: "Course");

            migrationBuilder.DropTable(
                name: "CourseAssignment");

            migrationBuilder.DropTable(
                name: "Department");

            migrationBuilder.DropTable(
                name: "OfficeAssignment");

            migrationBuilder.DropTable(
                name: "Instructor");

            migrationBuilder.DropIndex(
                name: "IX_Course_DepartmentID",
                table: "Course");

            migrationBuilder.DropColumn(
                name: "DepartmentID",
                table: "Course");

            migrationBuilder.RenameColumn(
                name: "FirstName",
                table: "Student",
                newName: "FirstMidName");

            migrationBuilder.AlterColumn <string>(
                name: "LastName",
                table: "Student",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50);

            migrationBuilder.AlterColumn <string>(
                name: "FirstMidName",
                table: "Student",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50);

            migrationBuilder.AlterColumn <string>(
                name: "Title",
                table: "Course",
                type: "nvarchar(max)",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50,
                oldNullable: true);
        }
Exemple #44
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "StorageRegion");

            migrationBuilder.AlterColumn <DateTime>(
                name: "RowVersion",
                table: "Users",
                type: "timestamp(6)",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldRowVersion: true,
                oldNullable: true)
            .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);

            migrationBuilder.AlterColumn <DateTime>(
                name: "RowVersion",
                table: "Storage",
                type: "timestamp(6)",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldRowVersion: true,
                oldNullable: true)
            .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);

            migrationBuilder.AlterColumn <DateTime>(
                name: "RowVersion",
                table: "Role",
                type: "timestamp(6)",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldRowVersion: true,
                oldNullable: true)
            .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);

            migrationBuilder.AlterColumn <DateTime>(
                name: "RowVersion",
                table: "Region",
                type: "timestamp(6)",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldRowVersion: true,
                oldNullable: true)
            .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);

            migrationBuilder.AlterColumn <DateTime>(
                name: "RowVersion",
                table: "GoodsType",
                type: "timestamp(6)",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldRowVersion: true,
                oldNullable: true)
            .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);

            migrationBuilder.AlterColumn <DateTime>(
                name: "RowVersion",
                table: "Goods",
                type: "timestamp(6)",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldRowVersion: true,
                oldNullable: true)
            .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Applications_Users_UserId",
                table: "Applications");

            migrationBuilder.AlterColumn <int>(
                name: "UserId",
                table: "Partys",
                type: "int",
                nullable: true,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AlterColumn <int>(
                name: "PartyStatusId",
                table: "Partys",
                type: "int",
                nullable: true,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AlterColumn <int>(
                name: "FriendshipStatusId",
                table: "Friendships",
                type: "int",
                nullable: true,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AlterColumn <int>(
                name: "UserId",
                table: "Applications",
                type: "int",
                nullable: true,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AlterColumn <int>(
                name: "PartyId",
                table: "Applications",
                type: "int",
                nullable: true,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AlterColumn <int>(
                name: "ApplicationStatusId",
                table: "Applications",
                type: "int",
                nullable: true,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.CreateIndex(
                name: "IX_Partys_PartyStatusId",
                table: "Partys",
                column: "PartyStatusId");

            migrationBuilder.CreateIndex(
                name: "IX_Partys_UserId",
                table: "Partys",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_Friendships_FriendshipStatusId",
                table: "Friendships",
                column: "FriendshipStatusId");

            migrationBuilder.CreateIndex(
                name: "IX_Applications_ApplicationStatusId",
                table: "Applications",
                column: "ApplicationStatusId");

            migrationBuilder.CreateIndex(
                name: "IX_Applications_PartyId",
                table: "Applications",
                column: "PartyId");

            migrationBuilder.AddForeignKey(
                name: "FK_Applications_ApplicationStatuses_ApplicationStatusId",
                table: "Applications",
                column: "ApplicationStatusId",
                principalTable: "ApplicationStatuses",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Applications_Partys_PartyId",
                table: "Applications",
                column: "PartyId",
                principalTable: "Partys",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Applications_Users_UserId",
                table: "Applications",
                column: "UserId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Friendships_FriendshipStatuses_FriendshipStatusId",
                table: "Friendships",
                column: "FriendshipStatusId",
                principalTable: "FriendshipStatuses",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Partys_PartyStatuses_PartyStatusId",
                table: "Partys",
                column: "PartyStatusId",
                principalTable: "PartyStatuses",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Partys_Users_UserId",
                table: "Partys",
                column: "UserId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
Exemple #46
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Photos_Vehicles_VehicleId",
                table: "Photos");

            migrationBuilder.AlterColumn<int>(
                name: "VehicleId",
                table: "Photos",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.CreateTable(
                name: "AspNetRoles",
                columns: table => new
                {
                    Id = table.Column<string>(nullable: false),
                    Name = table.Column<string>(maxLength: 256, nullable: true),
                    NormalizedName = table.Column<string>(maxLength: 256, nullable: true),
                    ConcurrencyStamp = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetRoles", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AspNetUsers",
                columns: table => new
                {
                    Id = table.Column<string>(nullable: false),
                    UserName = table.Column<string>(maxLength: 256, nullable: true),
                    NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
                    Email = table.Column<string>(maxLength: 256, nullable: true),
                    NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
                    EmailConfirmed = table.Column<bool>(nullable: false),
                    PasswordHash = table.Column<string>(nullable: true),
                    SecurityStamp = table.Column<string>(nullable: true),
                    ConcurrencyStamp = table.Column<string>(nullable: true),
                    PhoneNumber = table.Column<string>(nullable: true),
                    PhoneNumberConfirmed = table.Column<bool>(nullable: false),
                    TwoFactorEnabled = table.Column<bool>(nullable: false),
                    LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
                    LockoutEnabled = table.Column<bool>(nullable: false),
                    AccessFailedCount = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetUsers", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "DeviceCodes",
                columns: table => new
                {
                    UserCode = table.Column<string>(maxLength: 200, nullable: false),
                    DeviceCode = table.Column<string>(maxLength: 200, nullable: false),
                    SubjectId = table.Column<string>(maxLength: 200, nullable: true),
                    ClientId = table.Column<string>(maxLength: 200, nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    Expiration = table.Column<DateTime>(nullable: false),
                    Data = table.Column<string>(maxLength: 50000, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DeviceCodes", x => x.UserCode);
                });

            migrationBuilder.CreateTable(
                name: "PersistedGrants",
                columns: table => new
                {
                    Key = table.Column<string>(maxLength: 200, nullable: false),
                    Type = table.Column<string>(maxLength: 50, nullable: false),
                    SubjectId = table.Column<string>(maxLength: 200, nullable: true),
                    ClientId = table.Column<string>(maxLength: 200, nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    Expiration = table.Column<DateTime>(nullable: true),
                    Data = table.Column<string>(maxLength: 50000, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PersistedGrants", x => x.Key);
                });

            migrationBuilder.CreateTable(
                name: "AspNetRoleClaims",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RoleId = table.Column<string>(nullable: false),
                    ClaimType = table.Column<string>(nullable: true),
                    ClaimValue = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "AspNetRoles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AspNetUserClaims",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserId = table.Column<string>(nullable: false),
                    ClaimType = table.Column<string>(nullable: true),
                    ClaimValue = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AspNetUserClaims_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AspNetUserLogins",
                columns: table => new
                {
                    LoginProvider = table.Column<string>(maxLength: 128, nullable: false),
                    ProviderKey = table.Column<string>(maxLength: 128, nullable: false),
                    ProviderDisplayName = table.Column<string>(nullable: true),
                    UserId = table.Column<string>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
                    table.ForeignKey(
                        name: "FK_AspNetUserLogins_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AspNetUserRoles",
                columns: table => new
                {
                    UserId = table.Column<string>(nullable: false),
                    RoleId = table.Column<string>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
                    table.ForeignKey(
                        name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "AspNetRoles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_AspNetUserRoles_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AspNetUserTokens",
                columns: table => new
                {
                    UserId = table.Column<string>(nullable: false),
                    LoginProvider = table.Column<string>(maxLength: 128, nullable: false),
                    Name = table.Column<string>(maxLength: 128, nullable: false),
                    Value = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
                    table.ForeignKey(
                        name: "FK_AspNetUserTokens_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_AspNetRoleClaims_RoleId",
                table: "AspNetRoleClaims",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "RoleNameIndex",
                table: "AspNetRoles",
                column: "NormalizedName",
                unique: true,
                filter: "[NormalizedName] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserClaims_UserId",
                table: "AspNetUserClaims",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserLogins_UserId",
                table: "AspNetUserLogins",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserRoles_RoleId",
                table: "AspNetUserRoles",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "EmailIndex",
                table: "AspNetUsers",
                column: "NormalizedEmail");

            migrationBuilder.CreateIndex(
                name: "UserNameIndex",
                table: "AspNetUsers",
                column: "NormalizedUserName",
                unique: true,
                filter: "[NormalizedUserName] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_DeviceCodes_DeviceCode",
                table: "DeviceCodes",
                column: "DeviceCode",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_DeviceCodes_Expiration",
                table: "DeviceCodes",
                column: "Expiration");

            migrationBuilder.CreateIndex(
                name: "IX_PersistedGrants_Expiration",
                table: "PersistedGrants",
                column: "Expiration");

            migrationBuilder.CreateIndex(
                name: "IX_PersistedGrants_SubjectId_ClientId_Type",
                table: "PersistedGrants",
                columns: new[] { "SubjectId", "ClientId", "Type" });

            migrationBuilder.AddForeignKey(
                name: "FK_Photos_Vehicles_VehicleId",
                table: "Photos",
                column: "VehicleId",
                principalTable: "Vehicles",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "CampaignFinalRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "CampaignStartRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "CampaignTargetRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "DaypartFinalRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "DaypartStartRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "DaypartTargetRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "DowPattern",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "SalesAreaGroupFinalRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "SalesAreaGroupStartRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "StrikeWeightTargetRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "StrikeWeightStartRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "StrikeWeightFinalRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "SpotLengthTargetRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "SpotLengthStartRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "SpotLengthFinalRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "SalesAreaGroupTargetRatings",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "StrikeWeightStartDate",
                table: "ScenarioCampaignResults");

            migrationBuilder.DropColumn(
                name: "StrikeWeightEndDate",
                table: "ScenarioCampaignResults");

            migrationBuilder.AddColumn <long>(
                name: "TargetRatings",
                table: "ScenarioCampaignResults",
                nullable: true);

            migrationBuilder.AddColumn <long>(
                name: "RSCancelledSpots",
                table: "ScenarioCampaignResults",
                nullable: true);

            migrationBuilder.AddColumn <long>(
                name: "RSCancelledRatings",
                table: "ScenarioCampaignResults",
                nullable: true);

            migrationBuilder.AddColumn <long>(
                name: "PreRunRatings",
                table: "ScenarioCampaignResults",
                nullable: true);

            migrationBuilder.AddColumn <long>(
                name: "OptimiserRatings",
                table: "ScenarioCampaignResults",
                nullable: true);

            migrationBuilder.AddColumn <long>(
                name: "ISRCancelledSpots",
                table: "ScenarioCampaignResults",
                nullable: true);

            migrationBuilder.AddColumn <long>(
                name: "ISRCancelledRatings",
                table: "ScenarioCampaignResults",
                nullable: true);

            migrationBuilder.AddColumn <DateTime>(
                name: "StrikeWeightStartDate",
                table: "ScenarioCampaignResults",
                nullable: true);

            migrationBuilder.AddColumn <DateTime>(
                name: "StrikeWeightEndDate",
                table: "ScenarioCampaignResults",
                nullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "SalesAreaName",
                table: "ScenarioCampaignResults",
                maxLength: 128,
                nullable: true,
                oldClrType: typeof(string),
                oldMaxLength: 512,
                oldNullable: true);

            migrationBuilder.AddColumn <string>(
                name: "DaypartName",
                table: "ScenarioCampaignResults",
                maxLength: 512,
                nullable: true);
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Applications_ApplicationStatuses_ApplicationStatusId",
                table: "Applications");

            migrationBuilder.DropForeignKey(
                name: "FK_Applications_Partys_PartyId",
                table: "Applications");

            migrationBuilder.DropForeignKey(
                name: "FK_Applications_Users_UserId",
                table: "Applications");

            migrationBuilder.DropForeignKey(
                name: "FK_Friendships_FriendshipStatuses_FriendshipStatusId",
                table: "Friendships");

            migrationBuilder.DropForeignKey(
                name: "FK_Partys_PartyStatuses_PartyStatusId",
                table: "Partys");

            migrationBuilder.DropForeignKey(
                name: "FK_Partys_Users_UserId",
                table: "Partys");

            migrationBuilder.DropIndex(
                name: "IX_Partys_PartyStatusId",
                table: "Partys");

            migrationBuilder.DropIndex(
                name: "IX_Partys_UserId",
                table: "Partys");

            migrationBuilder.DropIndex(
                name: "IX_Friendships_FriendshipStatusId",
                table: "Friendships");

            migrationBuilder.DropIndex(
                name: "IX_Applications_ApplicationStatusId",
                table: "Applications");

            migrationBuilder.DropIndex(
                name: "IX_Applications_PartyId",
                table: "Applications");

            migrationBuilder.AlterColumn <int>(
                name: "UserId",
                table: "Partys",
                type: "int",
                nullable: false,
                defaultValue: 0,
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "PartyStatusId",
                table: "Partys",
                type: "int",
                nullable: false,
                defaultValue: 0,
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "FriendshipStatusId",
                table: "Friendships",
                type: "int",
                nullable: false,
                defaultValue: 0,
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "UserId",
                table: "Applications",
                type: "int",
                nullable: false,
                defaultValue: 0,
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "PartyId",
                table: "Applications",
                type: "int",
                nullable: false,
                defaultValue: 0,
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "ApplicationStatusId",
                table: "Applications",
                type: "int",
                nullable: false,
                defaultValue: 0,
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AddForeignKey(
                name: "FK_Applications_Users_UserId",
                table: "Applications",
                column: "UserId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn <string>(
                name: "ClaimType",
                table: "AbpUserClaims",
                maxLength: 256,
                nullable: true,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "UserName",
                table: "AbpUserAccounts",
                maxLength: 32,
                nullable: true,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "EmailAddress",
                table: "AbpUserAccounts",
                maxLength: 256,
                nullable: true,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "ClaimType",
                table: "AbpRoleClaims",
                maxLength: 256,
                nullable: true,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.CreateTable(
                name: "AbpEntityChangeSets",
                columns: table => new
            {
                Id = table.Column <long>(nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                BrowserInfo          = table.Column <string>(maxLength: 256, nullable: true),
                ClientIpAddress      = table.Column <string>(maxLength: 64, nullable: true),
                ClientName           = table.Column <string>(maxLength: 128, nullable: true),
                CreationTime         = table.Column <DateTime>(nullable: false),
                ExtensionData        = table.Column <string>(nullable: true),
                ImpersonatorTenantId = table.Column <int>(nullable: true),
                ImpersonatorUserId   = table.Column <long>(nullable: true),
                Reason   = table.Column <string>(maxLength: 256, nullable: true),
                TenantId = table.Column <int>(nullable: true),
                UserId   = table.Column <long>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AbpEntityChangeSets", x => x.Id);
            });

            migrationBuilder.CreateTable(
                name: "AbpEntityChanges",
                columns: table => new
            {
                Id = table.Column <long>(nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                ChangeTime         = table.Column <DateTime>(nullable: false),
                ChangeType         = table.Column <byte>(nullable: false),
                EntityChangeSetId  = table.Column <long>(nullable: false),
                EntityId           = table.Column <string>(maxLength: 48, nullable: true),
                EntityTypeFullName = table.Column <string>(maxLength: 192, nullable: true),
                TenantId           = table.Column <int>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AbpEntityChanges", x => x.Id);
                table.ForeignKey(
                    name: "FK_AbpEntityChanges_AbpEntityChangeSets_EntityChangeSetId",
                    column: x => x.EntityChangeSetId,
                    principalTable: "AbpEntityChangeSets",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "AbpEntityPropertyChanges",
                columns: table => new
            {
                Id = table.Column <long>(nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                EntityChangeId       = table.Column <long>(nullable: false),
                NewValue             = table.Column <string>(maxLength: 512, nullable: true),
                OriginalValue        = table.Column <string>(maxLength: 512, nullable: true),
                PropertyName         = table.Column <string>(maxLength: 96, nullable: true),
                PropertyTypeFullName = table.Column <string>(maxLength: 192, nullable: true),
                TenantId             = table.Column <int>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id);
                table.ForeignKey(
                    name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId",
                    column: x => x.EntityChangeId,
                    principalTable: "AbpEntityChanges",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateIndex(
                name: "IX_AbpEntityChanges_EntityChangeSetId",
                table: "AbpEntityChanges",
                column: "EntityChangeSetId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpEntityChanges_EntityTypeFullName_EntityId",
                table: "AbpEntityChanges",
                columns: new[] { "EntityTypeFullName", "EntityId" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpEntityChangeSets_TenantId_CreationTime",
                table: "AbpEntityChangeSets",
                columns: new[] { "TenantId", "CreationTime" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpEntityChangeSets_TenantId_Reason",
                table: "AbpEntityChangeSets",
                columns: new[] { "TenantId", "Reason" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpEntityChangeSets_TenantId_UserId",
                table: "AbpEntityChangeSets",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpEntityPropertyChanges_EntityChangeId",
                table: "AbpEntityPropertyChanges",
                column: "EntityChangeId");
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Activities_Users_UserId",
                table: "Activities");

            migrationBuilder.DropForeignKey(
                name: "FK_Expenses_Users_AddedById",
                table: "Expenses");

            migrationBuilder.DropForeignKey(
                name: "FK_GroupMemberMappings_Users_MemberId",
                table: "GroupMemberMappings");

            migrationBuilder.DropForeignKey(
                name: "FK_Groups_Users_MadeById",
                table: "Groups");

            migrationBuilder.DropForeignKey(
                name: "FK_Payees_Users_PayeeId",
                table: "Payees");

            migrationBuilder.DropForeignKey(
                name: "FK_Payers_Users_PayerId",
                table: "Payers");

            migrationBuilder.DropForeignKey(
                name: "FK_Settlements_Users_PayeeId",
                table: "Settlements");

            migrationBuilder.DropForeignKey(
                name: "FK_Settlements_Users_PayerId",
                table: "Settlements");

            migrationBuilder.DropForeignKey(
                name: "FK_UserFriendMappings_Users_FriendId",
                table: "UserFriendMappings");

            migrationBuilder.DropForeignKey(
                name: "FK_UserFriendMappings_Users_UserId",
                table: "UserFriendMappings");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Users",
                table: "Users");

            migrationBuilder.RenameTable(
                name: "Users",
                newName: "AspNetUsers");

            migrationBuilder.AlterColumn <string>(
                name: "UserName",
                table: "AspNetUsers",
                maxLength: 256,
                nullable: true,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "NormalizedUserName",
                table: "AspNetUsers",
                maxLength: 256,
                nullable: true,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "NormalizedEmail",
                table: "AspNetUsers",
                maxLength: 256,
                nullable: true,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Email",
                table: "AspNetUsers",
                maxLength: 256,
                nullable: true,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_AspNetUsers",
                table: "AspNetUsers",
                column: "Id");

            migrationBuilder.CreateTable(
                name: "AspNetRoles",
                columns: table => new
            {
                Id               = table.Column <string>(nullable: false),
                Name             = table.Column <string>(maxLength: 256, nullable: true),
                NormalizedName   = table.Column <string>(maxLength: 256, nullable: true),
                ConcurrencyStamp = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetRoles", x => x.Id);
            });

            migrationBuilder.CreateTable(
                name: "AspNetUserClaims",
                columns: table => new
            {
                Id = table.Column <int>(nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                UserId     = table.Column <string>(nullable: false),
                ClaimType  = table.Column <string>(nullable: true),
                ClaimValue = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
                table.ForeignKey(
                    name: "FK_AspNetUserClaims_AspNetUsers_UserId",
                    column: x => x.UserId,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "AspNetUserLogins",
                columns: table => new
            {
                LoginProvider       = table.Column <string>(nullable: false),
                ProviderKey         = table.Column <string>(nullable: false),
                ProviderDisplayName = table.Column <string>(nullable: true),
                UserId = table.Column <string>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
                table.ForeignKey(
                    name: "FK_AspNetUserLogins_AspNetUsers_UserId",
                    column: x => x.UserId,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "AspNetUserTokens",
                columns: table => new
            {
                UserId        = table.Column <string>(nullable: false),
                LoginProvider = table.Column <string>(nullable: false),
                Name          = table.Column <string>(nullable: false),
                Value         = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
                table.ForeignKey(
                    name: "FK_AspNetUserTokens_AspNetUsers_UserId",
                    column: x => x.UserId,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "AspNetRoleClaims",
                columns: table => new
            {
                Id = table.Column <int>(nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                RoleId     = table.Column <string>(nullable: false),
                ClaimType  = table.Column <string>(nullable: true),
                ClaimValue = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
                table.ForeignKey(
                    name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
                    column: x => x.RoleId,
                    principalTable: "AspNetRoles",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "AspNetUserRoles",
                columns: table => new
            {
                UserId = table.Column <string>(nullable: false),
                RoleId = table.Column <string>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
                table.ForeignKey(
                    name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
                    column: x => x.RoleId,
                    principalTable: "AspNetRoles",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
                table.ForeignKey(
                    name: "FK_AspNetUserRoles_AspNetUsers_UserId",
                    column: x => x.UserId,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateIndex(
                name: "EmailIndex",
                table: "AspNetUsers",
                column: "NormalizedEmail");

            migrationBuilder.CreateIndex(
                name: "UserNameIndex",
                table: "AspNetUsers",
                column: "NormalizedUserName",
                unique: true,
                filter: "[NormalizedUserName] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetRoleClaims_RoleId",
                table: "AspNetRoleClaims",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "RoleNameIndex",
                table: "AspNetRoles",
                column: "NormalizedName",
                unique: true,
                filter: "[NormalizedName] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserClaims_UserId",
                table: "AspNetUserClaims",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserLogins_UserId",
                table: "AspNetUserLogins",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserRoles_RoleId",
                table: "AspNetUserRoles",
                column: "RoleId");

            migrationBuilder.AddForeignKey(
                name: "FK_Activities_AspNetUsers_UserId",
                table: "Activities",
                column: "UserId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Expenses_AspNetUsers_AddedById",
                table: "Expenses",
                column: "AddedById",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_GroupMemberMappings_AspNetUsers_MemberId",
                table: "GroupMemberMappings",
                column: "MemberId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Groups_AspNetUsers_MadeById",
                table: "Groups",
                column: "MadeById",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Payees_AspNetUsers_PayeeId",
                table: "Payees",
                column: "PayeeId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Payers_AspNetUsers_PayerId",
                table: "Payers",
                column: "PayerId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Settlements_AspNetUsers_PayeeId",
                table: "Settlements",
                column: "PayeeId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Settlements_AspNetUsers_PayerId",
                table: "Settlements",
                column: "PayerId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_UserFriendMappings_AspNetUsers_FriendId",
                table: "UserFriendMappings",
                column: "FriendId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_UserFriendMappings_AspNetUsers_UserId",
                table: "UserFriendMappings",
                column: "UserId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
Exemple #51
0
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
     migrationBuilder.CreateTable(
         name: "Hobby",
         columns: table => new
     {
         ID = table.Column <int>(nullable: false)
              .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
         Description = table.Column <string>(nullable: true),
         Title       = table.Column <string>(nullable: true)
     },
         constraints: table =>
     {
         table.PrimaryKey("PK_Hobby", x => x.ID);
     });
     migrationBuilder.AlterColumn <string>(
         name: "UserId",
         table: "AspNetUserLogins",
         nullable: false);
     migrationBuilder.AlterColumn <string>(
         name: "UserId",
         table: "AspNetUserClaims",
         nullable: false);
     migrationBuilder.AlterColumn <string>(
         name: "RoleId",
         table: "AspNetRoleClaims",
         nullable: false);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
         table: "AspNetRoleClaims",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
         table: "AspNetUserClaims",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
         table: "AspNetUserLogins",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
         table: "AspNetUserRoles",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
         table: "AspNetUserRoles",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
 }
Exemple #52
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn <string>(
                name: "ZipCode",
                table: "Orders",
                type: "nvarchar(10)",
                maxLength: 10,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "State",
                table: "Orders",
                type: "nvarchar(10)",
                maxLength: 10,
                nullable: true,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "PhoneNumber",
                table: "Orders",
                type: "nvarchar(25)",
                maxLength: 25,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "LastName",
                table: "Orders",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "FirstName",
                table: "Orders",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Email",
                table: "Orders",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Country",
                table: "Orders",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "City",
                table: "Orders",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "AddressLine1",
                table: "Orders",
                type: "nvarchar(100)",
                maxLength: 100,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.CreateTable(
                name: "AspNetRoles",
                columns: table => new
            {
                Id = table.Column <string>(type: "nvarchar(450)", nullable: false),
                ConcurrencyStamp = table.Column <string>(type: "nvarchar(max)", nullable: true),
                Name             = table.Column <string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                NormalizedName   = table.Column <string>(type: "nvarchar(256)", maxLength: 256, nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetRoles", x => x.Id);
            });

            migrationBuilder.CreateTable(
                name: "AspNetUsers",
                columns: table => new
            {
                Id = table.Column <string>(type: "nvarchar(450)", nullable: false),
                AccessFailedCount    = table.Column <int>(type: "int", nullable: false),
                ConcurrencyStamp     = table.Column <string>(type: "nvarchar(max)", nullable: true),
                Email                = table.Column <string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                EmailConfirmed       = table.Column <bool>(type: "bit", nullable: false),
                LockoutEnabled       = table.Column <bool>(type: "bit", nullable: false),
                LockoutEnd           = table.Column <DateTimeOffset>(type: "datetimeoffset", nullable: true),
                NormalizedEmail      = table.Column <string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                NormalizedUserName   = table.Column <string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                PasswordHash         = table.Column <string>(type: "nvarchar(max)", nullable: true),
                PhoneNumber          = table.Column <string>(type: "nvarchar(max)", nullable: true),
                PhoneNumberConfirmed = table.Column <bool>(type: "bit", nullable: false),
                SecurityStamp        = table.Column <string>(type: "nvarchar(max)", nullable: true),
                TwoFactorEnabled     = table.Column <bool>(type: "bit", nullable: false),
                UserName             = table.Column <string>(type: "nvarchar(256)", maxLength: 256, nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetUsers", x => x.Id);
            });

            migrationBuilder.CreateTable(
                name: "AspNetRoleClaims",
                columns: table => new
            {
                Id = table.Column <int>(type: "int", nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                ClaimType  = table.Column <string>(type: "nvarchar(max)", nullable: true),
                ClaimValue = table.Column <string>(type: "nvarchar(max)", nullable: true),
                RoleId     = table.Column <string>(type: "nvarchar(450)", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
                table.ForeignKey(
                    name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
                    column: x => x.RoleId,
                    principalTable: "AspNetRoles",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "AspNetUserClaims",
                columns: table => new
            {
                Id = table.Column <int>(type: "int", nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                ClaimType  = table.Column <string>(type: "nvarchar(max)", nullable: true),
                ClaimValue = table.Column <string>(type: "nvarchar(max)", nullable: true),
                UserId     = table.Column <string>(type: "nvarchar(450)", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
                table.ForeignKey(
                    name: "FK_AspNetUserClaims_AspNetUsers_UserId",
                    column: x => x.UserId,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "AspNetUserLogins",
                columns: table => new
            {
                LoginProvider       = table.Column <string>(type: "nvarchar(450)", nullable: false),
                ProviderKey         = table.Column <string>(type: "nvarchar(450)", nullable: false),
                ProviderDisplayName = table.Column <string>(type: "nvarchar(max)", nullable: true),
                UserId = table.Column <string>(type: "nvarchar(450)", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
                table.ForeignKey(
                    name: "FK_AspNetUserLogins_AspNetUsers_UserId",
                    column: x => x.UserId,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "AspNetUserRoles",
                columns: table => new
            {
                UserId = table.Column <string>(type: "nvarchar(450)", nullable: false),
                RoleId = table.Column <string>(type: "nvarchar(450)", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
                table.ForeignKey(
                    name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
                    column: x => x.RoleId,
                    principalTable: "AspNetRoles",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
                table.ForeignKey(
                    name: "FK_AspNetUserRoles_AspNetUsers_UserId",
                    column: x => x.UserId,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "AspNetUserTokens",
                columns: table => new
            {
                UserId        = table.Column <string>(type: "nvarchar(450)", nullable: false),
                LoginProvider = table.Column <string>(type: "nvarchar(450)", nullable: false),
                Name          = table.Column <string>(type: "nvarchar(450)", nullable: false),
                Value         = table.Column <string>(type: "nvarchar(max)", nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
                table.ForeignKey(
                    name: "FK_AspNetUserTokens_AspNetUsers_UserId",
                    column: x => x.UserId,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateIndex(
                name: "IX_AspNetRoleClaims_RoleId",
                table: "AspNetRoleClaims",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "RoleNameIndex",
                table: "AspNetRoles",
                column: "NormalizedName",
                unique: true,
                filter: "[NormalizedName] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserClaims_UserId",
                table: "AspNetUserClaims",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserLogins_UserId",
                table: "AspNetUserLogins",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserRoles_RoleId",
                table: "AspNetUserRoles",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "EmailIndex",
                table: "AspNetUsers",
                column: "NormalizedEmail");

            migrationBuilder.CreateIndex(
                name: "UserNameIndex",
                table: "AspNetUsers",
                column: "NormalizedUserName",
                unique: true,
                filter: "[NormalizedUserName] IS NOT NULL");
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.Sql("DELETE FROM Users", true);
            migrationBuilder.DropPrimaryKey(
                name: "PK_Users",
                table: "Users");

            migrationBuilder.DropColumn(
                name: "UserID",
                table: "Users");

            migrationBuilder.RenameTable(
                name: "Users",
                newName: "AspNetUsers");

            migrationBuilder.AlterColumn <string>(
                name: "UserName",
                table: "AspNetUsers",
                maxLength: 256,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(500)");

            migrationBuilder.AlterColumn <bool>(
                name: "UserActive",
                table: "AspNetUsers",
                nullable: true,
                oldClrType: typeof(bool),
                oldType: "bit");

            migrationBuilder.AddColumn <string>(
                name: "Id",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <int>(
                name: "AccessFailedCount",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn <string>(
                name: "ConcurrencyStamp",
                table: "AspNetUsers",
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "Discriminator",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "Email",
                table: "AspNetUsers",
                maxLength: 256,
                nullable: true);

            migrationBuilder.AddColumn <bool>(
                name: "EmailConfirmed",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn <bool>(
                name: "LockoutEnabled",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn <DateTimeOffset>(
                name: "LockoutEnd",
                table: "AspNetUsers",
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "NormalizedEmail",
                table: "AspNetUsers",
                maxLength: 256,
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "NormalizedUserName",
                table: "AspNetUsers",
                maxLength: 256,
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "PasswordHash",
                table: "AspNetUsers",
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "PhoneNumber",
                table: "AspNetUsers",
                nullable: true);

            migrationBuilder.AddColumn <bool>(
                name: "PhoneNumberConfirmed",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn <string>(
                name: "SecurityStamp",
                table: "AspNetUsers",
                nullable: true);

            migrationBuilder.AddColumn <bool>(
                name: "TwoFactorEnabled",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn <string>(
                name: "FullName",
                table: "AspNetUsers",
                type: "nvarchar(150)",
                nullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_AspNetUsers",
                table: "AspNetUsers",
                column: "Id");

            migrationBuilder.CreateTable(
                name: "AspNetRoles",
                columns: table => new
            {
                Id               = table.Column <string>(nullable: false),
                Name             = table.Column <string>(maxLength: 256, nullable: true),
                NormalizedName   = table.Column <string>(maxLength: 256, nullable: true),
                ConcurrencyStamp = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetRoles", x => x.Id);
            });

            migrationBuilder.CreateTable(
                name: "AspNetUserClaims",
                columns: table => new
            {
                Id = table.Column <int>(nullable: false)
                     .Annotation("SqlServer:Identity", "1, 1"),
                UserId     = table.Column <string>(nullable: false),
                ClaimType  = table.Column <string>(nullable: true),
                ClaimValue = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
                table.ForeignKey(
                    name: "FK_AspNetUserClaims_AspNetUsers_UserId",
                    column: x => x.UserId,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "AspNetUserLogins",
                columns: table => new
            {
                LoginProvider       = table.Column <string>(maxLength: 128, nullable: false),
                ProviderKey         = table.Column <string>(maxLength: 128, nullable: false),
                ProviderDisplayName = table.Column <string>(nullable: true),
                UserId = table.Column <string>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
                table.ForeignKey(
                    name: "FK_AspNetUserLogins_AspNetUsers_UserId",
                    column: x => x.UserId,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "AspNetUserTokens",
                columns: table => new
            {
                UserId        = table.Column <string>(nullable: false),
                LoginProvider = table.Column <string>(maxLength: 128, nullable: false),
                Name          = table.Column <string>(maxLength: 128, nullable: false),
                Value         = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
                table.ForeignKey(
                    name: "FK_AspNetUserTokens_AspNetUsers_UserId",
                    column: x => x.UserId,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "AspNetRoleClaims",
                columns: table => new
            {
                Id = table.Column <int>(nullable: false)
                     .Annotation("SqlServer:Identity", "1, 1"),
                RoleId     = table.Column <string>(nullable: false),
                ClaimType  = table.Column <string>(nullable: true),
                ClaimValue = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
                table.ForeignKey(
                    name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
                    column: x => x.RoleId,
                    principalTable: "AspNetRoles",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "AspNetUserRoles",
                columns: table => new
            {
                UserId = table.Column <string>(nullable: false),
                RoleId = table.Column <string>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
                table.ForeignKey(
                    name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
                    column: x => x.RoleId,
                    principalTable: "AspNetRoles",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
                table.ForeignKey(
                    name: "FK_AspNetUserRoles_AspNetUsers_UserId",
                    column: x => x.UserId,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateIndex(
                name: "EmailIndex",
                table: "AspNetUsers",
                column: "NormalizedEmail");

            migrationBuilder.CreateIndex(
                name: "UserNameIndex",
                table: "AspNetUsers",
                column: "NormalizedUserName",
                unique: true,
                filter: "[NormalizedUserName] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetRoleClaims_RoleId",
                table: "AspNetRoleClaims",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "RoleNameIndex",
                table: "AspNetRoles",
                column: "NormalizedName",
                unique: true,
                filter: "[NormalizedName] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserClaims_UserId",
                table: "AspNetUserClaims",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserLogins_UserId",
                table: "AspNetUserLogins",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserRoles_RoleId",
                table: "AspNetUserRoles",
                column: "RoleId");
        }
Exemple #54
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Tasks_Projects_ProjectId",
                table: "Tasks");

            migrationBuilder.DropColumn(
                name: "Owner",
                table: "Tasks");

            migrationBuilder.DropColumn(
                name: "Owner",
                table: "Projects");

            migrationBuilder.AlterColumn <long>(
                name: "ProjectId",
                table: "Tasks",
                nullable: true,
                oldClrType: typeof(long));

            migrationBuilder.AddColumn <long>(
                name: "OwnerId",
                table: "Tasks",
                nullable: true);

            migrationBuilder.AddColumn <long>(
                name: "OwnerId",
                table: "Projects",
                nullable: true);

            migrationBuilder.CreateTable(
                name: "Users",
                columns: table => new
            {
                Id = table.Column <long>(nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                Name       = table.Column <string>(nullable: true),
                Department = table.Column <string>(nullable: true),
                Role       = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Users", x => x.Id);
            });

            migrationBuilder.CreateIndex(
                name: "IX_Tasks_OwnerId",
                table: "Tasks",
                column: "OwnerId");

            migrationBuilder.CreateIndex(
                name: "IX_Projects_OwnerId",
                table: "Projects",
                column: "OwnerId");

            migrationBuilder.AddForeignKey(
                name: "FK_Projects_Users_OwnerId",
                table: "Projects",
                column: "OwnerId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Tasks_Users_OwnerId",
                table: "Tasks",
                column: "OwnerId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Tasks_Projects_ProjectId",
                table: "Tasks",
                column: "ProjectId",
                principalTable: "Projects",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Activities_AspNetUsers_UserId",
                table: "Activities");

            migrationBuilder.DropForeignKey(
                name: "FK_Expenses_AspNetUsers_AddedById",
                table: "Expenses");

            migrationBuilder.DropForeignKey(
                name: "FK_GroupMemberMappings_AspNetUsers_MemberId",
                table: "GroupMemberMappings");

            migrationBuilder.DropForeignKey(
                name: "FK_Groups_AspNetUsers_MadeById",
                table: "Groups");

            migrationBuilder.DropForeignKey(
                name: "FK_Payees_AspNetUsers_PayeeId",
                table: "Payees");

            migrationBuilder.DropForeignKey(
                name: "FK_Payers_AspNetUsers_PayerId",
                table: "Payers");

            migrationBuilder.DropForeignKey(
                name: "FK_Settlements_AspNetUsers_PayeeId",
                table: "Settlements");

            migrationBuilder.DropForeignKey(
                name: "FK_Settlements_AspNetUsers_PayerId",
                table: "Settlements");

            migrationBuilder.DropForeignKey(
                name: "FK_UserFriendMappings_AspNetUsers_FriendId",
                table: "UserFriendMappings");

            migrationBuilder.DropForeignKey(
                name: "FK_UserFriendMappings_AspNetUsers_UserId",
                table: "UserFriendMappings");

            migrationBuilder.DropTable(
                name: "AspNetRoleClaims");

            migrationBuilder.DropTable(
                name: "AspNetUserClaims");

            migrationBuilder.DropTable(
                name: "AspNetUserLogins");

            migrationBuilder.DropTable(
                name: "AspNetUserRoles");

            migrationBuilder.DropTable(
                name: "AspNetUserTokens");

            migrationBuilder.DropTable(
                name: "AspNetRoles");

            migrationBuilder.DropPrimaryKey(
                name: "PK_AspNetUsers",
                table: "AspNetUsers");

            migrationBuilder.DropIndex(
                name: "EmailIndex",
                table: "AspNetUsers");

            migrationBuilder.DropIndex(
                name: "UserNameIndex",
                table: "AspNetUsers");

            migrationBuilder.RenameTable(
                name: "AspNetUsers",
                newName: "Users");

            migrationBuilder.AlterColumn <string>(
                name: "UserName",
                table: "Users",
                nullable: true,
                oldClrType: typeof(string),
                oldMaxLength: 256,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "NormalizedUserName",
                table: "Users",
                nullable: true,
                oldClrType: typeof(string),
                oldMaxLength: 256,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "NormalizedEmail",
                table: "Users",
                nullable: true,
                oldClrType: typeof(string),
                oldMaxLength: 256,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Email",
                table: "Users",
                nullable: true,
                oldClrType: typeof(string),
                oldMaxLength: 256,
                oldNullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_Users",
                table: "Users",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_Activities_Users_UserId",
                table: "Activities",
                column: "UserId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Expenses_Users_AddedById",
                table: "Expenses",
                column: "AddedById",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_GroupMemberMappings_Users_MemberId",
                table: "GroupMemberMappings",
                column: "MemberId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Groups_Users_MadeById",
                table: "Groups",
                column: "MadeById",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Payees_Users_PayeeId",
                table: "Payees",
                column: "PayeeId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Payers_Users_PayerId",
                table: "Payers",
                column: "PayerId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Settlements_Users_PayeeId",
                table: "Settlements",
                column: "PayeeId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Settlements_Users_PayerId",
                table: "Settlements",
                column: "PayerId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_UserFriendMappings_Users_FriendId",
                table: "UserFriendMappings",
                column: "FriendId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_UserFriendMappings_Users_UserId",
                table: "UserFriendMappings",
                column: "UserId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AspNetRoleClaims");

            migrationBuilder.DropTable(
                name: "AspNetUserClaims");

            migrationBuilder.DropTable(
                name: "AspNetUserLogins");

            migrationBuilder.DropTable(
                name: "AspNetUserRoles");

            migrationBuilder.DropTable(
                name: "AspNetUserTokens");

            migrationBuilder.DropTable(
                name: "AspNetRoles");

            migrationBuilder.DropPrimaryKey(
                name: "PK_AspNetUsers",
                table: "AspNetUsers");

            migrationBuilder.DropIndex(
                name: "EmailIndex",
                table: "AspNetUsers");

            migrationBuilder.DropIndex(
                name: "UserNameIndex",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "AccessFailedCount",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "ConcurrencyStamp",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "Discriminator",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "Email",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "EmailConfirmed",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "LockoutEnabled",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "LockoutEnd",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "NormalizedEmail",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "NormalizedUserName",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "PasswordHash",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "PhoneNumber",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "PhoneNumberConfirmed",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "SecurityStamp",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "TwoFactorEnabled",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "FullName",
                table: "AspNetUsers");

            migrationBuilder.RenameTable(
                name: "AspNetUsers",
                newName: "Users");

            migrationBuilder.AlterColumn <bool>(
                name: "UserActive",
                table: "Users",
                type: "bit",
                nullable: false,
                oldClrType: typeof(bool),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "UserName",
                table: "Users",
                type: "nvarchar(500)",
                nullable: false,
                oldClrType: typeof(string),
                oldMaxLength: 256,
                oldNullable: true);

            migrationBuilder.AddColumn <int>(
                name: "UserID",
                table: "Users",
                type: "int",
                nullable: false,
                defaultValue: 0)
            .Annotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Users",
                table: "Users",
                column: "UserID");
        }
Exemple #57
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AspNetRoleClaims");

            migrationBuilder.DropTable(
                name: "AspNetUserClaims");

            migrationBuilder.DropTable(
                name: "AspNetUserLogins");

            migrationBuilder.DropTable(
                name: "AspNetUserRoles");

            migrationBuilder.DropTable(
                name: "AspNetUserTokens");

            migrationBuilder.DropTable(
                name: "AspNetRoles");

            migrationBuilder.DropTable(
                name: "AspNetUsers");

            migrationBuilder.AlterColumn <string>(
                name: "ZipCode",
                table: "Orders",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(10)",
                oldMaxLength: 10);

            migrationBuilder.AlterColumn <string>(
                name: "State",
                table: "Orders",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(10)",
                oldMaxLength: 10,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "PhoneNumber",
                table: "Orders",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(25)",
                oldMaxLength: 25);

            migrationBuilder.AlterColumn <string>(
                name: "LastName",
                table: "Orders",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50);

            migrationBuilder.AlterColumn <string>(
                name: "FirstName",
                table: "Orders",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50);

            migrationBuilder.AlterColumn <string>(
                name: "Email",
                table: "Orders",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50);

            migrationBuilder.AlterColumn <string>(
                name: "Country",
                table: "Orders",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50);

            migrationBuilder.AlterColumn <string>(
                name: "City",
                table: "Orders",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50);

            migrationBuilder.AlterColumn <string>(
                name: "AddressLine1",
                table: "Orders",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(100)",
                oldMaxLength: 100);
        }
Exemple #58
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DeleteData(
                table: "Personnes",
                keyColumn: "PersonneId",
                keyValue: 1);

            migrationBuilder.DeleteData(
                table: "Personnes",
                keyColumn: "PersonneId",
                keyValue: 2);

            migrationBuilder.DeleteData(
                table: "Personnes",
                keyColumn: "PersonneId",
                keyValue: 3);

            migrationBuilder.DeleteData(
                table: "Personnes",
                keyColumn: "PersonneId",
                keyValue: 4);

            migrationBuilder.DeleteData(
                table: "Personnes",
                keyColumn: "PersonneId",
                keyValue: 5);

            migrationBuilder.AlterColumn <string>(
                name: "Ville",
                table: "Personnes",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Telephone",
                table: "Personnes",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Prenom",
                table: "Personnes",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Nom",
                table: "Personnes",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Mail",
                table: "Personnes",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Adresse",
                table: "Personnes",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.CreateTable(
                name: "Restos",
                columns: table => new
            {
                RestoId = table.Column <int>(nullable: false)
                          .Annotation("SqlServer:Identity", "1, 1"),
                Nom       = table.Column <string>(nullable: false),
                Telephone = table.Column <string>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Restos", x => x.RestoId);
            });

            migrationBuilder.CreateTable(
                name: "Sondages",
                columns: table => new
            {
                SondageId = table.Column <int>(nullable: false)
                            .Annotation("SqlServer:Identity", "1, 1"),
                Date = table.Column <DateTime>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Sondages", x => x.SondageId);
            });

            migrationBuilder.CreateTable(
                name: "Votes",
                columns: table => new
            {
                VoteId = table.Column <int>(nullable: false)
                         .Annotation("SqlServer:Identity", "1, 1"),
                RestoId    = table.Column <int>(nullable: true),
                PersonneId = table.Column <int>(nullable: true),
                SondageId  = table.Column <int>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Votes", x => x.VoteId);
                table.ForeignKey(
                    name: "FK_Votes_Personnes_PersonneId",
                    column: x => x.PersonneId,
                    principalTable: "Personnes",
                    principalColumn: "PersonneId",
                    onDelete: ReferentialAction.Restrict);
                table.ForeignKey(
                    name: "FK_Votes_Restos_RestoId",
                    column: x => x.RestoId,
                    principalTable: "Restos",
                    principalColumn: "RestoId",
                    onDelete: ReferentialAction.Restrict);
                table.ForeignKey(
                    name: "FK_Votes_Sondages_SondageId",
                    column: x => x.SondageId,
                    principalTable: "Sondages",
                    principalColumn: "SondageId",
                    onDelete: ReferentialAction.Restrict);
            });

            migrationBuilder.InsertData(
                table: "Personnes",
                columns: new[] { "PersonneId", "Adresse", "CodePostal", "Mail", "Nom", "Prenom", "Telephone", "Ville" },
                values: new object[, ]
            {
                { 1, "Allée Reaumure", 26000, "*****@*****.**", "DIALLO", "Abdou", "06 16 43 28 73", "Valence" },
                { 2, "5C Eugene Varlin", 93000, "*****@*****.**", "Barry", "Aminata", "06 13 43 75 83", "Montreuil" },
                { 3, "3 martin Guemou", 13000, "*****@*****.**", "Bah", "Aly", "06 13 66 75 23", "Marseil" },
                { 4, "13 allée clotures", 33000, "*****@*****.**", "Sow", "Moussa", "06 43 53 15 73", "Grenoble" },
                { 5, "13 allée des Martirs", 73000, "*****@*****.**", "Camara", "Amara", "06 43 15 15 73", "Paris" }
            });

            migrationBuilder.CreateIndex(
                name: "IX_Votes_PersonneId",
                table: "Votes",
                column: "PersonneId");

            migrationBuilder.CreateIndex(
                name: "IX_Votes_RestoId",
                table: "Votes",
                column: "RestoId");

            migrationBuilder.CreateIndex(
                name: "IX_Votes_SondageId",
                table: "Votes",
                column: "SondageId");
        }
Exemple #59
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "FirstMidName",
                table: "Student",
                newName: "FirstName");

            migrationBuilder.AlterColumn <string>(
                name: "LastName",
                table: "Student",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "FirstName",
                table: "Student",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Title",
                table: "Course",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            //migrationBuilder.AddColumn<int>(
            //    name: "DepartmentID",
            //    table: "Course",
            //    type: "int",
            //    nullable: false,
            //    defaultValue: 0);

            migrationBuilder.CreateTable(
                name: "Instructor",
                columns: table => new
            {
                ID = table.Column <int>(type: "int", nullable: false)
                     .Annotation("SqlServer:Identity", "1, 1"),
                LastName  = table.Column <string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                FirstName = table.Column <string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                HireDate  = table.Column <DateTime>(type: "datetime2", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Instructor", x => x.ID);
            });

            migrationBuilder.CreateTable(
                name: "CourseAssignment",
                columns: table => new
            {
                InstructorID = table.Column <int>(type: "int", nullable: false),
                CourseID     = table.Column <int>(type: "int", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_CourseAssignment", x => new { x.CourseID, x.InstructorID });
                table.ForeignKey(
                    name: "FK_CourseAssignment_Course_CourseID",
                    column: x => x.CourseID,
                    principalTable: "Course",
                    principalColumn: "CourseID",
                    onDelete: ReferentialAction.Cascade);
                table.ForeignKey(
                    name: "FK_CourseAssignment_Instructor_InstructorID",
                    column: x => x.InstructorID,
                    principalTable: "Instructor",
                    principalColumn: "ID",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "Department",
                columns: table => new
            {
                DepartmentID = table.Column <int>(type: "int", nullable: false)
                               .Annotation("SqlServer:Identity", "1, 1"),
                Name         = table.Column <string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                Budget       = table.Column <decimal>(type: "money", nullable: false),
                StartDate    = table.Column <DateTime>(type: "datetime2", nullable: false),
                InstructorID = table.Column <int>(type: "int", nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Department", x => x.DepartmentID);
                table.ForeignKey(
                    name: "FK_Department_Instructor_InstructorID",
                    column: x => x.InstructorID,
                    principalTable: "Instructor",
                    principalColumn: "ID",
                    onDelete: ReferentialAction.Restrict);
            });

            migrationBuilder.CreateTable(
                name: "OfficeAssignment",
                columns: table => new
            {
                InstructorID = table.Column <int>(type: "int", nullable: false),
                Location     = table.Column <string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_OfficeAssignment", x => x.InstructorID);
                table.ForeignKey(
                    name: "FK_OfficeAssignment_Instructor_InstructorID",
                    column: x => x.InstructorID,
                    principalTable: "Instructor",
                    principalColumn: "ID",
                    onDelete: ReferentialAction.Cascade);
            });
            migrationBuilder.Sql("INSERT INTO dbo.Department (Name, Budget, StartDate) VALUES ('Temp', 0.00, GETDATE())");
            // Default value for FK points to department created above, with
            // defaultValue changed to 1 in following AddColumn statement.

            migrationBuilder.AddColumn <int>(
                name: "DepartmentID",
                table: "Course",
                nullable: false,
                defaultValue: 1);

            migrationBuilder.CreateIndex(
                name: "IX_Course_DepartmentID",
                table: "Course",
                column: "DepartmentID");

            migrationBuilder.CreateIndex(
                name: "IX_CourseAssignment_InstructorID",
                table: "CourseAssignment",
                column: "InstructorID");

            migrationBuilder.CreateIndex(
                name: "IX_Department_InstructorID",
                table: "Department",
                column: "InstructorID");

            migrationBuilder.AddForeignKey(
                name: "FK_Course_Department_DepartmentID",
                table: "Course",
                column: "DepartmentID",
                principalTable: "Department",
                principalColumn: "DepartmentID",
                onDelete: ReferentialAction.Cascade);
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "Email",
                table: "Collaborator",
                newName: "Mail");

            migrationBuilder.RenameColumn(
                name: "Email",
                table: "Collaborative",
                newName: "Mail");

            migrationBuilder.AlterColumn<DateTime>(
                name: "CreationDate",
                table: "Product",
                type: "DATETIME2",
                nullable: false,
                defaultValue: new DateTime(2020, 9, 23, 10, 59, 58, 645, DateTimeKind.Local).AddTicks(4318),
                oldClrType: typeof(DateTime),
                oldType: "DATETIME2",
                oldDefaultValue: new DateTime(2020, 9, 23, 11, 39, 1, 506, DateTimeKind.Local).AddTicks(9261));

            migrationBuilder.AlterColumn<DateTime>(
                name: "Ordered",
                table: "Order",
                type: "DATETIME2",
                nullable: false,
                defaultValue: new DateTime(2020, 9, 23, 10, 59, 58, 643, DateTimeKind.Local).AddTicks(5608),
                oldClrType: typeof(DateTime),
                oldType: "DATETIME2",
                oldDefaultValue: new DateTime(2020, 9, 23, 11, 39, 1, 506, DateTimeKind.Local).AddTicks(3328));

            migrationBuilder.AlterColumn<DateTime>(
                name: "Open",
                table: "FinancialAccount",
                type: "DATETIME2",
                nullable: false,
                defaultValue: new DateTime(2020, 9, 23, 10, 59, 58, 643, DateTimeKind.Local).AddTicks(4794),
                oldClrType: typeof(DateTime),
                oldType: "DATETIME2",
                oldDefaultValue: new DateTime(2020, 9, 23, 11, 39, 1, 506, DateTimeKind.Local).AddTicks(2571));

            migrationBuilder.AlterColumn<DateTime>(
                name: "CreationDate",
                table: "Collaborator",
                type: "DATETIME2",
                nullable: false,
                defaultValue: new DateTime(2020, 9, 23, 10, 59, 58, 643, DateTimeKind.Local).AddTicks(3729),
                oldClrType: typeof(DateTime),
                oldType: "DATETIME2",
                oldDefaultValue: new DateTime(2020, 9, 23, 11, 39, 1, 506, DateTimeKind.Local).AddTicks(1567));

            migrationBuilder.AlterColumn<DateTime>(
                name: "CreationDate",
                table: "Collaborative",
                type: "DATETIME2",
                nullable: false,
                defaultValue: new DateTime(2020, 9, 23, 10, 59, 58, 643, DateTimeKind.Local).AddTicks(2726),
                oldClrType: typeof(DateTime),
                oldType: "DATETIME2",
                oldDefaultValue: new DateTime(2020, 9, 23, 11, 39, 1, 506, DateTimeKind.Local).AddTicks(576));
        }