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


C# MigrationBuilder.CreateSequence方法代码示例

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


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

示例1: Up

 public override void Up(MigrationBuilder migration)
 {
     migration.CreateSequence(
         name: "DefaultSequence",
         type: "bigint",
         startWith: 1L,
         incrementBy: 10);
     migration.CreateTable(
         name: "Course",
         columns: table => new
         {
             Id = table.Column(type: "uniqueidentifier", nullable: false),
             EndDate = table.Column(type: "datetime2", nullable: false),
             Name = table.Column(type: "nvarchar(max)", nullable: true),
             StartDate = table.Column(type: "datetime2", nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Course", x => x.Id);
         });
     migration.CreateTable(
         name: "Student",
         columns: table => new
         {
             Id = table.Column(type: "uniqueidentifier", nullable: false),
             Address = table.Column(type: "nvarchar(max)", nullable: true),
             DateOfBirth = table.Column(type: "datetime2", nullable: false),
             Name = table.Column(type: "nvarchar(max)", nullable: true),
             PhoneNumber = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Student", x => x.Id);
         });
 }
开发者ID:tanloiit2010,项目名称:KPIDemo,代码行数:35,代码来源:20151106032819_Init.cs

示例2: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.CreateSequence(
         name: "LpaUserSeq",
         schema: "dbo",
         incrementBy: 10);
     migrationBuilder.CreateTable(
         name: "Claims",
         columns: table => new
         {
             Id = table.Column<int>(isNullable: false)
                 .Annotation("SqlServer:ValueGenerationStrategy", SqlServerIdentityStrategy.IdentityColumn),
             Name = table.Column<string>(isNullable: false),
             Value = table.Column<string>(isNullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_LpaClaim", x => x.Id)
                 .Annotation("SqlServer:Clustered", true);
         });
     migrationBuilder.CreateTable(
         name: "Users",
         columns: table => new
         {
             Id = table.Column<int>(isNullable: false),
             Created = table.Column<DateTime>(isNullable: false, defaultValueSql: "sysdatetime()"),
             Password = table.Column<string>(isNullable: false),
             PasswordSalt = table.Column<string>(isNullable: false),
             Username = table.Column<string>(isNullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_LpaUser", x => x.Id);
         });
     migrationBuilder.CreateTable(
         name: "UserClaims",
         columns: table => new
         {
             ClaimId = table.Column<int>(isNullable: false),
             UserId = table.Column<int>(isNullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_LpaUserClaim", x => new { x.UserId, x.ClaimId })
                 .Annotation("SqlServer:Clustered", true);
             table.ForeignKey(
                 name: "FK_LpaUserClaim_LpaClaim_ClaimId",
                 column: x => x.ClaimId,
                 principalTable: "Claims",
                 principalColumn: "Id");
             table.ForeignKey(
                 name: "FK_LpaUserClaim_LpaUser_UserId",
                 column: x => x.UserId,
                 principalTable: "Users",
                 principalColumn: "Id");
         });
 }
开发者ID:nteague22,项目名称:LPA-Site,代码行数:57,代码来源:20151005044610_InitializeAuth.cs

示例3: Up

 public override void Up(MigrationBuilder migration)
 {
     migration.CreateSequence(
         name: "DefaultSequence",
         type: "bigint",
         startWith: 1L,
         incrementBy: 10);
     migration.CreateTable(
         name: "Role",
         columns: table => new
         {
             RoleId = table.Column(type: "int", nullable: false),
             RoleName = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Role", x => x.RoleId);
         });
     migration.CreateTable(
         name: "User",
         columns: table => new
         {
             DateOfBirth = table.Column(type: "datetime2", nullable: false),
             Email = table.Column(type: "nvarchar(max)", nullable: true),
             FirstName = table.Column(type: "nvarchar(max)", nullable: true),
             LastName = table.Column(type: "nvarchar(max)", nullable: true),
             Salary = table.Column(type: "decimal(18, 2)", nullable: false),
             UserId = table.Column(type: "int", nullable: false),
             UserName = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_User", x => x.UserId);
         });
     migration.CreateTable(
         name: "UserRole",
         columns: table => new
         {
             RoleId = table.Column(type: "int", nullable: false),
             UserId = table.Column(type: "int", nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_UserRole", x => new { x.UserId, x.RoleId });
             table.ForeignKey(
                 name: "FK_UserRole_Role_RoleId",
                 columns: x => x.RoleId,
                 referencedTable: "Role",
                 referencedColumn: "RoleId");
             table.ForeignKey(
                 name: "FK_UserRole_User_UserId",
                 columns: x => x.UserId,
                 referencedTable: "User",
                 referencedColumn: "UserId");
         });
 }
开发者ID:lanierhall-doubleline,项目名称:FullStack,代码行数:56,代码来源:20150630020801_InitialMigration.cs

示例4: Up

 public override void Up(MigrationBuilder migration)
 {
     migration.CreateSequence(
         name: "DefaultSequence",
         type: "bigint",
         startWith: 1L,
         incrementBy: 10);
     migration.CreateTable(
         name: "AuthModel",
         columns: table => new
         {
             AuthModelId = table.Column(type: "int", nullable: false),
             ip = table.Column(type: "nvarchar(max)", nullable: true),
             mac = table.Column(type: "nvarchar(max)", nullable: true),
             token = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_AuthModel", x => x.AuthModelId);
         });
     migration.CreateTable(
         name: "DynamicPassword",
         columns: table => new
         {
             DynamicPasswordId = table.Column(type: "int", nullable: false),
             Password = table.Column(type: "int", nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_DynamicPassword", x => x.DynamicPasswordId);
         });
     migration.CreateTable(
         name: "LoginModel",
         columns: table => new
         {
             LoginModelId = table.Column(type: "int", nullable: false),
             gw_address = table.Column(type: "nvarchar(max)", nullable: true),
             gw_id = table.Column(type: "nvarchar(max)", nullable: true),
             gw_port = table.Column(type: "int", nullable: false),
             mac = table.Column(type: "nvarchar(max)", nullable: true),
             token = table.Column(type: "nvarchar(max)", nullable: true),
             url = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_LoginModel", x => x.LoginModelId);
         });
 }
开发者ID:jim-king-2000,项目名称:AuthCloud,代码行数:48,代码来源:20150908103402_Initial.cs

示例5: Up

 public override void Up(MigrationBuilder migration)
 {
     migration.CreateSequence(
         name: "DefaultSequence",
         type: "bigint",
         startWith: 1L,
         incrementBy: 10);
     migration.CreateTable(
         name: "Category",
         columns: table => new
         {
             CategoryId = table.Column(type: "int", nullable: false),
             Description = table.Column(type: "nvarchar(max)", nullable: true),
             ImageUrl = table.Column(type: "nvarchar(max)", nullable: true),
             Name = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Category", x => x.CategoryId);
         });
     migration.CreateTable(
         name: "Product",
         columns: table => new
         {
             CategoryId = table.Column(type: "int", nullable: false),
             Created = table.Column(type: "datetime2", nullable: false),
             Description = table.Column(type: "nvarchar(max)", nullable: true),
             Inventory = table.Column(type: "int", nullable: false),
             LeadTime = table.Column(type: "int", nullable: false),
             Price = table.Column(type: "decimal(18, 2)", nullable: false),
             ProductArtUrl = table.Column(type: "nvarchar(max)", nullable: true),
             ProductDetails = table.Column(type: "nvarchar(max)", nullable: true),
             ProductId = table.Column(type: "int", nullable: false),
             RecommendationId = table.Column(type: "int", nullable: false),
             SalePrice = table.Column(type: "decimal(18, 2)", nullable: false),
             SkuNumber = table.Column(type: "nvarchar(max)", nullable: true),
             Title = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Product", x => x.ProductId);
             table.ForeignKey(
                 name: "FK_Product_Category_CategoryId",
                 columns: x => x.CategoryId,
                 referencedTable: "Category",
                 referencedColumn: "CategoryId");
         });
 }
开发者ID:fjsnogueira,项目名称:ProductMicroservices,代码行数:48,代码来源:20150713060408_MyFirstMigration.cs

示例6: CreateSequence_adds_operation

        public void CreateSequence_adds_operation()
        {
            var builder = new MigrationBuilder();

            builder.CreateSequence("dbo.MySequence", "bigint", 10, 5);

            Assert.Equal(1, builder.Operations.Count);
            Assert.IsType<CreateSequenceOperation>(builder.Operations[0]);

            var operation = (CreateSequenceOperation)builder.Operations[0];

            Assert.Equal("dbo.MySequence", operation.Sequence.Name);
            Assert.Equal("bigint", operation.Sequence.DataType);
            Assert.Equal(10, operation.Sequence.StartWith);
            Assert.Equal(5, operation.Sequence.IncrementBy);
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:16,代码来源:MigrationBuilderTest.cs

示例7: Up

 public override void Up(MigrationBuilder migration)
 {
     migration.CreateSequence(
         name: "DefaultSequence",
         type: "bigint",
         startWith: 1L,
         incrementBy: 10);
     migration.CreateTable(
         name: "Artist",
         columns: table => new
         {
             ArtistId = table.Column(type: "int", nullable: false),
             City = table.Column(type: "nvarchar(50)", nullable: true),
             Country = table.Column(type: "nvarchar(50)", nullable: true),
             CreateDate = table.Column(type: "datetime2", nullable: false),
             ModifiedDate = table.Column(type: "datetime2", nullable: false),
             Provence = table.Column(type: "nvarchar(50)", nullable: true),
             UserName = table.Column(type: "nvarchar(50)", nullable: false),
             WebSite = table.Column(type: "nvarchar(255)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Artist", x => x.ArtistId);
         });
     migration.CreateTable(
         name: "ArtistSkill",
         columns: table => new
         {
             ArtistArtistId = table.Column(type: "int", nullable: true),
             ArtistSkillId = table.Column(type: "int", nullable: false),
             Details = table.Column(type: "nvarchar(255)", nullable: true),
             SkillLevel = table.Column(type: "int", nullable: false),
             Styles = table.Column(type: "nvarchar(50)", nullable: false),
             TalentName = table.Column(type: "nvarchar(255)", nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_ArtistSkill", x => x.ArtistSkillId);
             table.ForeignKey(
                 name: "FK_ArtistSkill_Artist_ArtistArtistId",
                 columns: x => x.ArtistArtistId,
                 referencedTable: "Artist",
                 referencedColumn: "ArtistId");
         });
 }
开发者ID:LeoLcy,项目名称:MVC6Recipes,代码行数:45,代码来源:20150520020057_initial.cs

示例8: Up

 public override void Up(MigrationBuilder migration)
 {
     migration.CreateSequence(
         name: "DefaultSequence",
         type: "bigint",
         startWith: 1L,
         incrementBy: 10);
     migration.CreateTable(
         name: "Country",
         columns: table => new
         {
             CountryName = table.Column(type: "nvarchar(max)", nullable: true),
             Id = table.Column(type: "bigint", nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Country", x => x.Id);
         });
 }
开发者ID:richardvaldivieso,项目名称:aspnet5ef7,代码行数:19,代码来源:20150611141058_Initial.cs

示例9: Up

 public override void Up(MigrationBuilder migration)
 {
     migration.CreateSequence(
         name: "DefaultSequence",
         type: "bigint",
         startWith: 1L,
         incrementBy: 10);
     migration.CreateTable(
         name: "Author",
         columns: table => new
         {
             AuthorID = table.Column(type: "int", nullable: false),
             FirstMidName = table.Column(type: "nvarchar(max)", nullable: true),
             LastName = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Author", x => x.AuthorID);
         });
     migration.CreateTable(
         name: "Book",
         columns: table => new
         {
             BookID = table.Column(type: "int", nullable: false),
             AuthorID = table.Column(type: "int", nullable: false),
             Genre = table.Column(type: "nvarchar(max)", nullable: true),
             Price = table.Column(type: "decimal(18, 2)", nullable: false),
             Title = table.Column(type: "nvarchar(max)", nullable: true),
             Year = table.Column(type: "int", nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Book", x => x.BookID);
             table.ForeignKey(
                 name: "FK_Book_Author_AuthorID",
                 columns: x => x.AuthorID,
                 referencedTable: "Author",
                 referencedColumn: "AuthorID");
         });
 }
开发者ID:nslindtner,项目名称:Docs,代码行数:40,代码来源:20150624041210_Initial.cs

示例10: Up

 public override void Up(MigrationBuilder migration)
 {
     migration.CreateSequence(
         name: "DefaultSequence",
         type: "bigint",
         startWith: 1L,
         incrementBy: 10);
     migration.CreateTable(
         name: "Blog",
         columns: table => new
         {
             BlogId = table.Column(type: "int", nullable: false),
             Url = table.Column(type: "nvarchar(max)", nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Blog", x => x.BlogId);
         });
     migration.CreateTable(
         name: "Post",
         columns: table => new
         {
             PostId = table.Column(type: "int", nullable: false),
             BlogId = table.Column(type: "int", nullable: false),
             Content = table.Column(type: "nvarchar(max)", nullable: true),
             Title = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Post", x => x.PostId);
             table.ForeignKey(
                 name: "FK_Post_Blog_BlogId",
                 columns: x => x.BlogId,
                 referencedTable: "Blog",
                 referencedColumn: "BlogId");
         });
 }
开发者ID:rhires,项目名称:EntityFramework.Docs,代码行数:37,代码来源:20150630215833_MyFirstMigration.cs

示例11: Up

 public override void Up(MigrationBuilder migration)
 {
     migration.CreateSequence(
         name: "DefaultSequence",
         type: "bigint",
         startWith: 1L,
         incrementBy: 10);
     migration.CreateTable(
         name: "PhoneSpotting",
         columns: table => new
         {
             Latitude = table.Column(type: "int", nullable: false),
             Longitude = table.Column(type: "int", nullable: false),
             Notes = table.Column(type: "nvarchar(max)", nullable: true),
             PhoneManufacturer = table.Column(type: "nvarchar(max)", nullable: true),
             PhoneModel = table.Column(type: "nvarchar(max)", nullable: true),
             PhoneSpottingId = table.Column(type: "int", nullable: false),
             SpotTime = table.Column(type: "datetime2", nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_PhoneSpotting", x => x.PhoneSpottingId);
         });
 }
开发者ID:jeffa00,项目名称:WinPhoneSpotter01,代码行数:24,代码来源:20150705033116_PhoneSettingCreate.cs

示例12: Up

 public override void Up(MigrationBuilder migration)
 {
     migration.CreateSequence(
         name: "DefaultSequence",
         type: "bigint",
         startWith: 1L,
         incrementBy: 10);
     migration.CreateTable(
         name: "Line",
         columns: table => new
         {
             id = table.Column(type: "int", nullable: false),
             Name = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Line", x => x.id);
         });
     migration.CreateTable(
         name: "Product",
         columns: table => new
         {
             id = table.Column(type: "int", nullable: false),
             Name = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Product", x => x.id);
         });
     migration.CreateTable(
         name: "Operation",
         columns: table => new
         {
             id = table.Column(type: "int", nullable: false),
             LineId = table.Column(type: "int", nullable: false),
             Name = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Operation", x => x.id);
             table.ForeignKey(
                 name: "FK_Operation_Line_LineId",
                 columns: x => x.LineId,
                 referencedTable: "Line",
                 referencedColumn: "id");
         });
     migration.CreateTable(
         name: "ProductLine",
         columns: table => new
         {
             ProductId = table.Column(type: "int", nullable: false),
             LineId = table.Column(type: "int", nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_ProductLine", x => new { x.ProductId, x.LineId });
             table.ForeignKey(
                 name: "FK_ProductLine_Line_LineId",
                 columns: x => x.LineId,
                 referencedTable: "Line",
                 referencedColumn: "id");
             table.ForeignKey(
                 name: "FK_ProductLine_Product_ProductId",
                 columns: x => x.ProductId,
                 referencedTable: "Product",
                 referencedColumn: "id");
         });
     migration.CreateTable(
         name: "Status",
         columns: table => new
         {
             id = table.Column(type: "int", nullable: false),
             Complete = table.Column(type: "bit", nullable: false),
             Notes = table.Column(type: "nvarchar(max)", nullable: true),
             OperationId = table.Column(type: "int", nullable: false),
             ProductId = table.Column(type: "int", nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Status", x => x.id);
             table.ForeignKey(
                 name: "FK_Status_Operation_OperationId",
                 columns: x => x.OperationId,
                 referencedTable: "Operation",
                 referencedColumn: "id");
             table.ForeignKey(
                 name: "FK_Status_Product_ProductId",
                 columns: x => x.ProductId,
                 referencedTable: "Product",
                 referencedColumn: "id");
         });
 }
开发者ID:anttieskola,项目名称:tsdemo,代码行数:92,代码来源:20150729174302_first.cs

示例13: 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

示例14: Up

 public override void Up(MigrationBuilder migration)
 {
     migration.CreateSequence(
         name: "DefaultSequence",
         type: "bigint",
         startWith: 1L,
         incrementBy: 10);
     migration.CreateTable(
         name: "User",
         columns: table => new
         {
             UserID = table.Column(type: "nvarchar(450)", nullable: false),
             AddedOn = table.Column(type: "datetime2", nullable: false),
             IsScrumMaster = table.Column(type: "bit", nullable: false),
             Password = table.Column(type: "nvarchar(max)", nullable: true),
             Token = table.Column(type: "nvarchar(max)", nullable: true),
             Username = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_User", x => x.UserID);
         });
     migration.CreateTable(
         name: "APIDocumentation",
         columns: table => new
         {
             ID = table.Column(type: "int", nullable: false),
             AddedOn = table.Column(type: "datetime2", nullable: false),
             Description = table.Column(type: "nvarchar(max)", nullable: true),
             Name = table.Column(type: "nvarchar(max)", nullable: true),
             SampleImplementation = table.Column(type: "nvarchar(max)", nullable: true),
             Url = table.Column(type: "nvarchar(max)", nullable: true),
             UserID = table.Column(type: "nvarchar(450)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_APIDocumentation", x => x.ID);
             table.ForeignKey(
                 name: "FK_APIDocumentation_User_UserID",
                 columns: x => x.UserID,
                 referencedTable: "User",
                 referencedColumn: "UserID");
         });
     migration.CreateTable(
         name: "Project",
         columns: table => new
         {
             ProjectID = table.Column(type: "nvarchar(450)", nullable: false),
             AddedOn = table.Column(type: "datetime2", nullable: false),
             Description = table.Column(type: "nvarchar(max)", nullable: true),
             Name = table.Column(type: "nvarchar(max)", nullable: true),
             Status = table.Column(type: "int", nullable: false),
             UserID = table.Column(type: "nvarchar(450)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Project", x => x.ProjectID);
             table.ForeignKey(
                 name: "FK_Project_User_UserID",
                 columns: x => x.UserID,
                 referencedTable: "User",
                 referencedColumn: "UserID");
         });
     migration.CreateTable(
         name: "UserSession",
         columns: table => new
         {
             Id = table.Column(type: "int", nullable: false),
             AddedOn = table.Column(type: "datetime2", nullable: false),
             Expiration = table.Column(type: "datetime2", nullable: false),
             Token = table.Column(type: "nvarchar(max)", nullable: true),
             UserID = table.Column(type: "nvarchar(450)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_UserSession", x => x.Id);
             table.ForeignKey(
                 name: "FK_UserSession_User_UserID",
                 columns: x => x.UserID,
                 referencedTable: "User",
                 referencedColumn: "UserID");
         });
     migration.CreateTable(
         name: "Sprint",
         columns: table => new
         {
             SprintID = table.Column(type: "nvarchar(450)", nullable: false),
             AddedOn = table.Column(type: "datetime2", nullable: false),
             DateEnded = table.Column(type: "datetime2", nullable: false),
             DateStarted = table.Column(type: "datetime2", nullable: false),
             ProjectID = table.Column(type: "nvarchar(450)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Sprint", x => x.SprintID);
             table.ForeignKey(
                 name: "FK_Sprint_Project_ProjectID",
                 columns: x => x.ProjectID,
                 referencedTable: "Project",
                 referencedColumn: "ProjectID");
//.........这里部分代码省略.........
开发者ID:miffy081409,项目名称:scrumtemplate,代码行数:101,代码来源:20150919151507_Initial.cs

示例15: Up

 public override void Up(MigrationBuilder migration)
 {
     migration.CreateSequence(
         name: "DefaultSequence",
         type: "bigint",
         startWith: 1L,
         incrementBy: 10);
     migration.CreateTable(
         name: "Administrator",
         columns: table => new
         {
             Id = table.Column(type: "int", nullable: false),
             Password = table.Column(type: "nvarchar(max)", nullable: true),
             Username = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Administrator", x => x.Id);
         });
     migration.CreateTable(
         name: "Category",
         columns: table => new
         {
             Id = table.Column(type: "int", nullable: false),
             Name = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Category", x => x.Id);
         });
     migration.CreateTable(
         name: "Foo",
         columns: table => new
         {
             Id = table.Column(type: "int", nullable: false),
             Name = table.Column(type: "nvarchar(max)", nullable: true)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Foo", x => x.Id);
         });
     migration.CreateTable(
         name: "MenuItem",
         columns: table => new
         {
             Id = table.Column(type: "int", nullable: false),
             CategoryId = table.Column(type: "int", nullable: false),
             Description = table.Column(type: "nvarchar(max)", nullable: true),
             Image = table.Column(type: "varbinary(max)", nullable: true),
             Name = table.Column(type: "nvarchar(max)", nullable: true),
             Price = table.Column(type: "decimal(18, 2)", nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_MenuItem", x => x.Id);
         });
     migration.CreateTable(
         name: "Order",
         columns: table => new
         {
             Id = table.Column(type: "uniqueidentifier", nullable: false),
             Note = table.Column(type: "nvarchar(max)", nullable: true),
             Status = table.Column(type: "nvarchar(max)", nullable: true),
             TableNo = table.Column(type: "int", nullable: false),
             Time = table.Column(type: "datetime2", nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_Order", x => x.Id);
         });
     migration.CreateTable(
         name: "OrderItem",
         columns: table => new
         {
             Id = table.Column(type: "int", nullable: false),
             ClientName = table.Column(type: "nvarchar(max)", nullable: true),
             MenuItemId = table.Column(type: "int", nullable: false),
             MenuItemName = table.Column(type: "nvarchar(max)", nullable: true),
             OrderId = table.Column(type: "uniqueidentifier", nullable: false),
             Price = table.Column(type: "decimal(18, 2)", nullable: false)
         },
         constraints: table =>
         {
             table.PrimaryKey("PK_OrderItem", x => x.Id);
             table.ForeignKey(
                 name: "FK_OrderItem_Order_OrderId",
                 columns: x => x.OrderId,
                 referencedTable: "Order",
                 referencedColumn: "Id");
         });
 }
开发者ID:hanjia2014,项目名称:HotmenuApp,代码行数:91,代码来源:20150721214833_InitialDatabase.cs


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