当前位置: 首页>>代码示例>>C#>>正文


C# MigrationBuilder.AddColumn方法代码示例

本文整理汇总了C#中MigrationBuilder.AddColumn方法的典型用法代码示例。如果您正苦于以下问题:C# MigrationBuilder.AddColumn方法的具体用法?C# MigrationBuilder.AddColumn怎么用?C# MigrationBuilder.AddColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MigrationBuilder的用法示例。


在下文中一共展示了MigrationBuilder.AddColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Down

 protected override void Down(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_Translation_Content_ContentId", table: "Translation");
     migrationBuilder.DropPrimaryKey(name: "PK_Content", table: "Content");
     migrationBuilder.DropColumn(name: "Id", table: "Content");
     migrationBuilder.AddColumn<Guid>(
         name: "ContentContentGuid",
         table: "Translation",
         nullable: true);
     migrationBuilder.AddColumn<Guid>(
         name: "ContentGuid",
         table: "Content",
         nullable: false,
         defaultValueSql: "newsequentialid()");
     migrationBuilder.AddPrimaryKey(
         name: "PK_Content",
         table: "Content",
         column: "ContentGuid");
     migrationBuilder.AddForeignKey(
         name: "FK_Translation_Content_ContentContentGuid",
         table: "Translation",
         column: "ContentContentGuid",
         principalTable: "Content",
         principalColumn: "ContentGuid",
         onDelete: ReferentialAction.Restrict);
 }
开发者ID:nettsundere,项目名称:PersonalWebsite,代码行数:26,代码来源:20151128025750_ReplaceGuidWithIdForContentsAndTranslations.cs

示例2: Up

        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<bool>(
                name: "IsOriginal",
                table: "Posts",
                nullable: false,
                defaultValue: false);
            migrationBuilder.AddColumn<string>(
                name: "SourceLink",
                table: "Posts",
                nullable: true);

            migrationBuilder.Sql(@"Alter view HierarchyPosts as
            WITH Cte (Id, Parentpostid, Depth, Rootid) AS
            (SELECT Id,
            Replytopostid,
            0 AS Thelevel,
            Id AS Rootid
             FROM Posts
             WHERE Replytopostid IS NULL
             AND Isdeleted = 0
             UNION ALL SELECT Pn.Id,
                      Pn.Replytopostid,
                      P1.Depth +1,
                      P1.Rootid
             FROM Posts Pn
             INNER JOIN Cte AS P1 ON P1.Id = Pn.Replytopostid
             WHERE Pn.Isdeleted = 0)
            SELECT Cte.Id AS Postid,
               ReplyToPostId,
               Depth,
               ForumId,
               LastChangedDate,
               PublishDate,
               Title,
               Body,
               IsModified,
               U.UserName,
               U.Id,
               UserId,
               RootId,
               IsDeleted,
               IsImportantReply,
               Views,
               IsOriginal,
               SourceLink,
            (SELECT Count(1)
             FROM Userreviews Ur
             WHERE Ur.Touserid = P.Userid
             AND Ur.Votetype = 1
             AND Ur.IsDeleted = 0) AS PositiveReviewsScore,
            (SELECT Count(1)
             FROM Userreviews Ur
             WHERE Ur.Touserid = P.Userid
             AND Ur.Votetype = 2
             AND Ur.IsDeleted = 0) AS NegativeReviewsScore
            FROM Cte
            INNER JOIN Posts P ON Cte.Id = P.Id
            INNER JOIN Users U ON U.Id = P.Userid");
        }
开发者ID:gdoron,项目名称:Forums,代码行数:60,代码来源:20160314191704_SourceOriginal.cs

示例3: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_ReleaseBatchItem_ReleaseBatch_ReleaseBatchId", schema: "kraken", table: "ReleaseBatchItem");
     migrationBuilder.AddColumn<DateTimeOffset>(
         name: "DeployDateTime",
         schema: "kraken",
         table: "ReleaseBatch",
         nullable: true);
     migrationBuilder.AddColumn<string>(
         name: "DeployEnvironmentId",
         schema: "kraken",
         table: "ReleaseBatch",
         nullable: true);
     migrationBuilder.AddColumn<string>(
         name: "DeployUserName",
         schema: "kraken",
         table: "ReleaseBatch",
         nullable: true);
     migrationBuilder.AddForeignKey(
         name: "FK_ReleaseBatchItem_ReleaseBatch_ReleaseBatchId",
         schema: "kraken",
         table: "ReleaseBatchItem",
         column: "ReleaseBatchId",
         principalSchema: "kraken",
         principalTable: "ReleaseBatch",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
 }
开发者ID:Zywave,项目名称:OctopusDeploy-Kraken,代码行数:28,代码来源:20160118200516_auditinfo.cs

示例4: Up

 public override void Up(MigrationBuilder migration)
 {
     migration.DropForeignKey(name: "FK_Registration_Member_MemberId", table: "Registration");
     migration.DropColumn(name: "MemberId", table: "Registration");
     migration.DropTable("Member");
     migration.AddColumn(
         name: "UserId",
         table: "Registration",
         type: "nvarchar(450)",
         nullable: true);
     migration.RenameTable(
         name: "AspNetUsers",
         newName: "Users");
     migration.AddColumn(
         name: "Name",
         table: "Users",
         type: "nvarchar(100)",
         nullable: true);
     migration.AddForeignKey(
         name: "FK_Registration_ApplicationUser_UserId",
         table: "Registration",
         column: "UserId",
         referencedTable: "Users",
         referencedColumn: "Id");
 }
开发者ID:cabarney,项目名称:MvcNextGen,代码行数:25,代码来源:20150901212837_MergeMemberIntoUser.cs

示例5: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_Recipe_Category_CategoryId", table: "Recipe");
     migrationBuilder.AddColumn<string>(
         name: "Content",
         table: "Recipe",
         nullable: false,
         defaultValue: "");
     migrationBuilder.AddColumn<string>(
         name: "CoockTime",
         table: "Recipe",
         nullable: true);
     migrationBuilder.AddColumn<DateTime>(
         name: "CreatedAt",
         table: "Recipe",
         nullable: false,
         defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
     migrationBuilder.AddColumn<bool>(
         name: "IsFavorite",
         table: "Recipe",
         nullable: false,
         defaultValue: false);
     migrationBuilder.AddColumn<DateTime>(
         name: "UpdatedAt",
         table: "Recipe",
         nullable: true);
     migrationBuilder.AddForeignKey(
         name: "FK_Recipe_Category_CategoryId",
         table: "Recipe",
         column: "CategoryId",
         principalTable: "Category",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
 }
开发者ID:KrInMotion,项目名称:RecipeManager,代码行数:34,代码来源:20160202094525_Recipe_02.02.2016_12.45.cs

示例6: Up

 public override void Up(MigrationBuilder migration)
 {
     migration.DropColumn(name: "Logo", table: "Teams");
     migration.AddColumn(
         name: "CheerleaderImage",
         table: "Teams",
         type: "nvarchar(max)",
         nullable: true);
     migration.AddColumn(
         name: "CoachImage",
         table: "Teams",
         type: "nvarchar(max)",
         nullable: true);
     migration.AddColumn(
         name: "DivisionId",
         table: "Teams",
         type: "int",
         nullable: true);
     migration.AddColumn(
         name: "HeaderImage",
         table: "Teams",
         type: "nvarchar(max)",
         nullable: true);
     migration.AddColumn(
         name: "LogoImage",
         table: "Teams",
         type: "nvarchar(max)",
         nullable: true);
     migration.AddForeignKey(
         name: "FK_Team_Division_DivisionId",
         table: "Teams",
         column: "DivisionId",
         referencedTable: "Divisions",
         referencedColumn: "DivisionId");
 }
开发者ID:knightofren,项目名称:lovelyjubblymvc6,代码行数:35,代码来源:20151027191524_editteam.cs

示例7: Up

        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()");
        }
开发者ID:RossWhitehead,项目名称:SandboxCore,代码行数:26,代码来源:20160822185317_AddLastUpdated.cs

示例8: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_Leaderboard_Game_GameID", table: "Leaderboard");
     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.AddColumn<string>(
         name: "PlayerName",
         table: "Leaderboard",
         nullable: true);
     migrationBuilder.AddColumn<int>(
         name: "PlayerPoints",
         table: "Leaderboard",
         nullable: false,
         defaultValue: 0);
     migrationBuilder.AddForeignKey(
         name: "FK_Leaderboard_Game_GameID",
         table: "Leaderboard",
         column: "GameID",
         principalTable: "Game",
         principalColumn: "GameID",
         onDelete: ReferentialAction.Cascade);
     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);
 }
开发者ID:sNAtttu,项目名称:LanCenter,代码行数:60,代码来源:20160124205250_leaderPlayer.cs

示例9: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_WorldUser_UserId", table: "AspNetUserClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_WorldUser_UserId", table: "AspNetUserLogins");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_WorldUser_UserId", table: "AspNetUserRoles");
     migrationBuilder.AddColumn<string>(
         name: "Firstname",
         table: "AspNetUsers",
         nullable: true);
     migrationBuilder.AddColumn<string>(
         name: "Lastname",
         table: "AspNetUsers",
         nullable: true);
     migrationBuilder.AddColumn<string>(
         name: "PhoneNumber",
         table: "AspNetUsers",
         nullable: true);
     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>_WorldUser_UserId",
         table: "AspNetUserClaims",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserLogin<string>_WorldUser_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>_WorldUser_UserId",
         table: "AspNetUserRoles",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.RenameColumn(
         name: "PhoneNumber",
         table: "AspNetUsers",
         newName: "Phonenumber");
 }
开发者ID:HansKlokkenspel,项目名称:CRIA-LBR,代码行数:59,代码来源:20151202093916_IdentityEntitiesRegistration.cs

示例10: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_Session_Speaker_SpeakerID", table: "Session");
     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.AddColumn<bool>(
         name: "Special",
         table: "Timeslot",
         nullable: true);
     migrationBuilder.AddColumn<bool>(
         name: "Special",
         table: "Session",
         nullable: true);
     migrationBuilder.AddForeignKey(
         name: "FK_Session_Speaker_SpeakerID",
         table: "Session",
         column: "SpeakerID",
         principalTable: "Speaker",
         principalColumn: "ID",
         onDelete: ReferentialAction.Cascade);
     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);
 }
开发者ID:desinole,项目名称:codecampster,代码行数:59,代码来源:20160218153246_SpecialSessionsTimeSlots.cs

示例11: Up

        protected override void Up(MigrationBuilder migrationBuilder)
        {
	        migrationBuilder.AddColumn<string>("FirstName", "AspNetUsers", nullable: false);
			migrationBuilder.AddColumn<string>("LastName", "AspNetUsers", nullable: false);
			migrationBuilder.AddColumn<string>("Location", "AspNetUsers", nullable: true);
			migrationBuilder.AddColumn<string>("Twitter", "AspNetUsers", nullable: true);
			migrationBuilder.AddColumn<int?>("AvatarID", "AspNetUsers", nullable: true);
		}
开发者ID:desinole,项目名称:codecampster,代码行数:8,代码来源:20160123020522_ProfileFields.cs

示例12: Up

        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<bool>(
                name: "IsDeleted",
                table: "UserReviews",
                nullable: false,
                defaultValue: false);
            migrationBuilder.AddColumn<DateTime>(
                name: "UpdateDate",
                table: "UserReviews",
                nullable: false,
                defaultValueSql: "getutcdate()");

            migrationBuilder.Sql(@"Alter view HierarchyPosts as
            WITH Cte (Id, Parentpostid, Depth, Rootid) AS
            (SELECT Id,
            Replytopostid,
            0 AS Thelevel,
            Id AS Rootid
             FROM Posts
             WHERE Replytopostid IS NULL
             AND Isdeleted = 0
             UNION ALL SELECT Pn.Id,
                      Pn.Replytopostid,
                      P1.Depth +1,
                      P1.Rootid
             FROM Posts Pn
             INNER JOIN Cte AS P1 ON P1.Id = Pn.Replytopostid
             WHERE Pn.Isdeleted = 0)
            SELECT Cte.Id AS Postid,
               Replytopostid,
               Depth,
               Forumid,
               Lastchangeddate,
               Publishdate,
               Title,
               Body,
               Ismodified,
               U.Username,
               U.Id,
               Userid,
               Rootid,
               Isdeleted,
               Isimportantreply,
            (SELECT Count(1)
             FROM Userreviews Ur
             WHERE Ur.Touserid = P.Userid
             AND Ur.Votetype = 1
             AND Ur.IsDeleted = 0) AS PositiveReviewsScore,
            (SELECT Count(1)
             FROM Userreviews Ur
             WHERE Ur.Touserid = P.Userid
             AND Ur.Votetype = 2
             AND Ur.IsDeleted = 0) AS NegativeReviewsScore
            FROM Cte
            INNER JOIN Posts P ON Cte.Id = P.Id
            INNER JOIN Users U ON U.Id = P.Userid");
        }
开发者ID:gdoron,项目名称:Forums,代码行数:58,代码来源:20160305234533_UserReviewsIsDeleted.cs

示例13: Up

 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.AddColumn<int>(
         name: "Progress",
         table: "ProjectsModel",
         nullable: false,
         defaultValue: 0);
     migrationBuilder.AddColumn<string>(
         name: "Status",
         table: "ProjectsModel",
         nullable: true);
     migrationBuilder.AddColumn<DateTime>(
         name: "createdDate",
         table: "ProjectsModel",
         nullable: false,
         defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
     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);
 }
开发者ID:yorkerossington,项目名称:YRADMIN_GIT,代码行数:57,代码来源:20160703211544_Projects+1.cs

示例14: Up

 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.AddColumn<string>(
         name: "CompanyName",
         table: "Speaker",
         nullable: true);
     migrationBuilder.AddColumn<string>(
         name: "SponsorLevel",
         table: "Speaker",
         nullable: true);
     migrationBuilder.AlterColumn<int>(
         name: "ID",
         table: "Announcement",
         nullable: false)
         .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
     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);
 }
开发者ID:desinole,项目名称:codecampster,代码行数:56,代码来源:20160209194218_Sponsor.cs

示例15: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.AddColumn<string>(
         name: "DescriptionHtml",
         table: "Organization",
         nullable: true);
     migrationBuilder.AddColumn<string>(
         name: "Summary",
         table: "Organization",
         nullable: true);
 }
开发者ID:yobenzima,项目名称:allReady,代码行数:11,代码来源:20160624152405_OrgDescFields.cs


注:本文中的MigrationBuilder.AddColumn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。