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


C# MigrationBuilder.EnsureSchema方法代码示例

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


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

示例1: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.EnsureSchema("mab");
     migrationBuilder.CreateTable(
         name: "MicroAggression",
         schema: "mab",
         columns: table => new
         {
             Aggression = table.Column<string>(nullable: false),
             Aggressiveness = table.Column<int>(nullable: false),
             Created = table.Column<DateTime>(nullable: false),
             _Alternatives = table.Column<string>(nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_MicroAggression", x => x.Aggression);
         });
     migrationBuilder.CreateTable(
         name: "Offense",
         schema: "mab",
         columns: table => new
         {
             Id = table.Column<Guid>(nullable: false),
             Offenses = table.Column<int>(nullable: false),
             User = table.Column<string>(nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Offense", x => x.Id);
         });
     migrationBuilder.CreateTable(
         name: "Correction",
         schema: "mab",
         columns: table => new
         {
             Id = table.Column<Guid>(nullable: false),
             Created = table.Column<DateTime>(nullable: false),
             MicroAggressionId = table.Column<string>(nullable: true),
             OffenseId = table.Column<Guid>(nullable: false),
             Tweet = table.Column<string>(nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Correction", x => x.Id);
             table.ForeignKey(
                 name: "FK_Correction_MicroAggression_MicroAggressionId",
                 column: x => x.MicroAggressionId,
                 principalSchema: "mab",
                 principalTable: "MicroAggression",
                 principalColumn: "Aggression",
                 onDelete: ReferentialAction.Restrict);
             table.ForeignKey(
                 name: "FK_Correction_Offense_OffenseId",
                 column: x => x.OffenseId,
                 principalSchema: "mab",
                 principalTable: "Offense",
                 principalColumn: "Id",
                 onDelete: ReferentialAction.Restrict);
         });
 }
开发者ID:mattschwartz,项目名称:mab,代码行数:60,代码来源:20160213054012_Initial.cs

示例2: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.EnsureSchema("kraken");
     migrationBuilder.CreateTable(
         name: "ApplicationUser",
         schema: "kraken",
         columns: table => new
         {
             UserName = table.Column<string>(nullable: false),
             OctopusApiKey = table.Column<string>(nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_ApplicationUser", x => x.UserName);
         });
     migrationBuilder.CreateTable(
         name: "ReleaseBatch",
         schema: "kraken",
         columns: table => new
         {
             Id = table.Column<int>(nullable: false)
                 .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
             Name = table.Column<string>(nullable: false),
             SyncDateTime = table.Column<DateTimeOffset>(nullable: true),
             SyncEnvironmentId = table.Column<string>(nullable: true),
             SyncUserName = table.Column<string>(nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_ReleaseBatch", x => x.Id);
         });
     migrationBuilder.CreateTable(
         name: "ReleaseBatchItem",
         schema: "kraken",
         columns: table => new
         {
             Id = table.Column<int>(nullable: false)
                 .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
             ProjectId = table.Column<string>(nullable: false),
             ProjectName = table.Column<string>(nullable: false),
             ReleaseBatchId = table.Column<int>(nullable: false),
             ReleaseId = table.Column<string>(nullable: true),
             ReleaseVersion = table.Column<string>(nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_ReleaseBatchItem", x => x.Id);
             table.UniqueConstraint("AK_ReleaseBatchItem_ReleaseBatchId_ProjectId", x => new { x.ReleaseBatchId, x.ProjectId });
             table.ForeignKey(
                 name: "FK_ReleaseBatchItem_ReleaseBatch_ReleaseBatchId",
                 column: x => x.ReleaseBatchId,
                 principalSchema: "kraken",
                 principalTable: "ReleaseBatch",
                 principalColumn: "Id",
                 onDelete: ReferentialAction.Cascade);
         });
 }
开发者ID:Zywave,项目名称:OctopusDeploy-Kraken,代码行数:57,代码来源:20160114181804_initial.cs

示例3: Up

        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.EnsureSchema(
                name: "mc");

            migrationBuilder.CreateTable(
                name: "MenuCards",
                schema: "mc",
                columns: table => new
                {
                    MenuCardId = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Title = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MenuCards", x => x.MenuCardId);
                });

            migrationBuilder.CreateTable(
                name: "Menus",
                schema: "mc",
                columns: table => new
                {
                    MenuId = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    MenuCardId = table.Column<int>(nullable: false),
                    Price = table.Column<decimal>(type: "Money", nullable: false),
                    Text = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Menus", x => x.MenuId);
                    table.ForeignKey(
                        name: "FK_Menus_MenuCards_MenuCardId",
                        column: x => x.MenuCardId,
                        principalSchema: "mc",
                        principalTable: "MenuCards",
                        principalColumn: "MenuCardId",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_Menus_MenuCardId",
                schema: "mc",
                table: "Menus",
                column: "MenuCardId");
        }
开发者ID:ProfessionalCSharp,项目名称:ProfessionalCSharp6,代码行数:48,代码来源:20160522083613_InitMenuCards.cs

示例4: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.EnsureSchema("dbo");
     migrationBuilder.CreateTable(
         name: "Members",
         schema: "dbo",
         columns: table => new
         {
             Id = table.Column<int>(isNullable: false)
                 .Annotation("SqlServer:ValueGenerationStrategy", SqlServerIdentityStrategy.IdentityColumn),
             Name = table.Column<string>(isNullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_ChurchMember", x => x.Id);
         });
     migrationBuilder.CreateTable(
         name: "Events",
         schema: "dbo",
         columns: table => new
         {
             Id = table.Column<int>(isNullable: false)
                 .Annotation("SqlServer:ValueGenerationStrategy", SqlServerIdentityStrategy.IdentityColumn),
             ContactId = table.Column<int>(isNullable: true),
             ContactId1 = table.Column<int>(isNullable: false),
             Date = table.Column<DateTime>(isNullable: false),
             Description = table.Column<string>(isNullable: true),
             IsRecurring = table.Column<bool>(isNullable: false, defaultValue: false),
             Name = table.Column<string>(isNullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_ChurchEvent", x => x.Id);
             table.ForeignKey(
                 name: "FK_ChurchEvent_ChurchMember_ContactId",
                 column: x => x.ContactId,
                 principalSchema: "dbo",
                 principalTable: "Members",
                 principalColumn: "Id");
             table.ForeignKey(
                 name: "FK_ChurchEvent_ChurchMember_ContactId1",
                 column: x => x.ContactId1,
                 principalSchema: "dbo",
                 principalTable: "Members",
                 principalColumn: "Id");
         });
 }
开发者ID:nteague22,项目名称:Lighthouse.Site,代码行数:47,代码来源:20150928011242_InitSchedule.cs

示例5: Up

        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.EnsureSchema(
                name: "Store");

            migrationBuilder.CreateTable(
                name: "Categories",
                schema: "Store",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    CategoryName = table.Column<string>(nullable: true),
                    TimeStamp = table.Column<byte[]>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Categories", x => x.Id);
                });
        }
开发者ID:techoli76,项目名称:KCDC_ASPDOTNET,代码行数:20,代码来源:20160519193504_Initial.cs

示例6: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_SkillToTag_Skill_SkillId", schema: "skill", table: "SkillToTag");
     migrationBuilder.DropForeignKey(name: "FK_SkillToTag_SkillTag_TagId", schema: "skill", table: "SkillToTag");
     migrationBuilder.EnsureSchema("blog");
     migrationBuilder.CreateTable(
         name: "Entry",
         schema: "blog",
         columns: table => new
         {
             EntryId = table.Column<Guid>(nullable: false),
             DateCreated = table.Column<DateTimeOffset>(nullable: false),
             DateLastModified = table.Column<DateTimeOffset>(nullable: false),
             DatePublished = table.Column<DateTimeOffset>(nullable: true),
             HtmlContent = table.Column<string>(nullable: true),
             MarkdownContent = table.Column<string>(nullable: true),
             Slug = table.Column<string>(nullable: false),
             Title = table.Column<string>(nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_BlogEntry", x => x.EntryId);
         });
     migrationBuilder.CreateTable(
         name: "Comment",
         schema: "blog",
         columns: table => new
         {
             CommentId = table.Column<Guid>(nullable: false),
             AuthorEmail = table.Column<string>(nullable: false),
             AuthorName = table.Column<string>(nullable: false),
             AuthorWebsite = table.Column<string>(nullable: true),
             DateReviewed = table.Column<DateTimeOffset>(nullable: true),
             DateSubmitted = table.Column<DateTimeOffset>(nullable: false),
             EntryId = table.Column<Guid>(nullable: false),
             HtmlContent = table.Column<string>(nullable: true),
             IsApproved = table.Column<bool>(nullable: false),
             MarkdownContent = table.Column<string>(nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_BlogComment", x => x.CommentId);
             table.ForeignKey(
                 name: "FK_BlogComment_BlogEntry_EntryId",
                 column: x => x.EntryId,
                 principalSchema: "blog",
                 principalTable: "Entry",
                 principalColumn: "EntryId",
                 onDelete: ReferentialAction.Cascade);
         });
     migrationBuilder.AddForeignKey(
         name: "FK_SkillToTag_Skill_SkillId",
         schema: "skill",
         table: "SkillToTag",
         column: "SkillId",
         principalSchema: "skill",
         principalTable: "Skill",
         principalColumn: "SkillId",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_SkillToTag_SkillTag_TagId",
         schema: "skill",
         table: "SkillToTag",
         column: "TagId",
         principalSchema: "skill",
         principalTable: "Tag",
         principalColumn: "TagId",
         onDelete: ReferentialAction.Cascade);
 }
开发者ID:OlsonDev,项目名称:PersonalWebApp,代码行数:69,代码来源:20160318190119_AddBlogTables.cs

示例7: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.EnsureSchema("dbo");
     migrationBuilder.CreateSequence(
         name: "UserSeq",
         schema: "dbo",
         incrementBy: 10);
     migrationBuilder.CreateTable(
         name: "SecurityRoles",
         schema: "dbo",
         columns: table => new
         {
             Id = table.Column<int>(isNullable: false)
                 .Annotation("SqlServer:ValueGenerationStrategy", SqlServerIdentityStrategy.IdentityColumn),
             Name = table.Column<string>(isNullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("pk_Roles", x => x.Id)
                 .Annotation("SqlServer:Clustered", false);
         });
     migrationBuilder.CreateTable(
         name: "SecurityClaims",
         schema: "dbo",
         columns: table => new
         {
             Id = table.Column<int>(isNullable: false)
                 .Annotation("SqlServer:ValueGenerationStrategy", SqlServerIdentityStrategy.IdentityColumn),
             BookmastersRoleId = table.Column<int>(isNullable: true),
             IsActive = table.Column<bool>(isNullable: false, defaultValue: true),
             Type = table.Column<string>(isNullable: false),
             Value = table.Column<string>(isNullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Claims", x => x.Id)
                 .Annotation("SqlServer:Clustered", false);
             table.ForeignKey(
                 name: "FK_BookmastersClaim_BookmastersRole_BookmastersRoleId",
                 column: x => x.BookmastersRoleId,
                 principalSchema: "dbo",
                 principalTable: "SecurityRoles",
                 principalColumn: "Id");
         });
     migrationBuilder.CreateTable(
         name: "DashboardUsers",
         schema: "dbo",
         columns: table => new
         {
             Id = table.Column<int>(isNullable: false),
             Email = table.Column<string>(isNullable: true),
             IsActive = table.Column<bool>(isNullable: false, defaultValue: true),
             Password = table.Column<string>(isNullable: false),
             PwSalt = table.Column<string>(isNullable: true),
             RoleId = table.Column<int>(isNullable: true),
             Username = table.Column<string>(isNullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("pk_DashboardUser", x => x.Id)
                 .Annotation("SqlServer:Clustered", false);
             table.ForeignKey(
                 name: "FK_DashboardUser_BookmastersRole_RoleId",
                 column: x => x.RoleId,
                 principalSchema: "dbo",
                 principalTable: "SecurityRoles",
                 principalColumn: "Id");
         });
     migrationBuilder.CreateTable(
         name: "relClaimsLookup",
         schema: "dbo",
         columns: table => new
         {
             UserId = table.Column<int>(isNullable: false),
             ClaimId = table.Column<int>(isNullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_ClaimsLookup", x => new { x.UserId, x.ClaimId });
             table.ForeignKey(
                 name: "FK_ClaimsLookup_BookmastersClaim_ClaimId",
                 column: x => x.ClaimId,
                 principalSchema: "dbo",
                 principalTable: "SecurityClaims",
                 principalColumn: "Id");
             table.ForeignKey(
                 name: "FK_ClaimsLookup_DashboardUser_UserId",
                 column: x => x.UserId,
                 principalSchema: "dbo",
                 principalTable: "DashboardUsers",
                 principalColumn: "Id");
         });
     migrationBuilder.CreateTable(
         name: "UsersLoggedIn",
         schema: "dbo",
         columns: table => new
         {
             UserId = table.Column<int>(isNullable: false),
             AuthType = table.Column<int>(isNullable: false),
             Expiration = table.Column<DateTimeOffset>(isNullable: false, defaultValue: new DateTimeOffset(new DateTime(2015, 9, 10, 18, 59, 21, 756, DateTimeKind.Unspecified), new TimeSpan(0, -4, 0, 0, 0))),
//.........这里部分代码省略.........
开发者ID:nteague22,项目名称:BmDashboard.AspNet5.Ef7b7,代码行数:101,代码来源:20150910195921_authDone.cs

示例8: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.EnsureSchema("skill");
     migrationBuilder.CreateTable(
         name: "Skill",
         schema: "skill",
         columns: table => new
         {
             SkillId = table.Column<Guid>(nullable: false),
                                 Name = table.Column<string>(nullable: false),
                                 Code = table.Column<string>(nullable: false),
             Rating = table.Column<int>(nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Skill", x => x.SkillId);
         });
     migrationBuilder.CreateTable(
         name: "Tag",
         schema: "skill",
         columns: table => new
         {
             TagId = table.Column<Guid>(nullable: false),
                                 Name = table.Column<string>(nullable: false),
                                 Code = table.Column<string>(nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_SkillTag", x => x.TagId);
         });
     migrationBuilder.CreateTable(
         name: "SkillToTag",
         schema: "skill",
         columns: table => new
         {
             SkillId = table.Column<Guid>(nullable: false),
             TagId = table.Column<Guid>(nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_SkillToTag", x => new { x.SkillId, x.TagId });
             table.ForeignKey(
                 name: "FK_SkillToTag_Skill_SkillId",
                 column: x => x.SkillId,
                 principalSchema: "skill",
                 principalTable: "Skill",
                 principalColumn: "SkillId",
                 onDelete: ReferentialAction.Cascade);
             table.ForeignKey(
                 name: "FK_SkillToTag_SkillTag_TagId",
                 column: x => x.TagId,
                 principalSchema: "skill",
                 principalTable: "Tag",
                 principalColumn: "TagId",
                 onDelete: ReferentialAction.Cascade);
         });
     migrationBuilder.CreateIndex(
         name: "IX_Skill_Code",
         schema: "skill",
         table: "Skill",
         column: "Code",
         unique: true);
     migrationBuilder.CreateIndex(
         name: "IX_SkillTag_Code",
         schema: "skill",
         table: "Tag",
         column: "Code",
         unique: true);
 }
开发者ID:OlsonDev,项目名称:PersonalWebApp,代码行数:69,代码来源:20160223011914_Initial.cs

示例9: Up

        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.EnsureSchema(
                name: "Lookup");

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

            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 });
                });

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

            migrationBuilder.CreateTable(
                name: "Documents",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Abstract = table.Column<string>(nullable: true),
                    CreatedByUserId = table.Column<string>(nullable: false),
                    CreatedOn = table.Column<DateTimeOffset>(nullable: false),
                    ModifiedOn = table.Column<DateTimeOffset>(nullable: false),
                    Status = table.Column<int>(nullable: false),
                    Title = table.Column<string>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Documents", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Libraries",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    CreatedByUserId = table.Column<string>(nullable: false),
                    CreatedOn = table.Column<DateTimeOffset>(nullable: false),
                    ModifiedOn = table.Column<DateTimeOffset>(nullable: false),
                    Name = table.Column<string>(nullable: false),
                    Status = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Libraries", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "PermissionTypes",
                schema: "Lookup",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false),
                    Name = table.Column<string>(nullable: false)
//.........这里部分代码省略.........
开发者ID:lruckman,项目名称:DRS,代码行数:101,代码来源:20160522070035_InitialDatabase.cs


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