Skip to content

Commit 01b485e

Browse files
committed
[#199]修复update-database指定migration
1 parent 07928d9 commit 01b485e

File tree

10 files changed

+478
-24
lines changed

10 files changed

+478
-24
lines changed

nuget-publish.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
:start
22
::定义版本
3-
set SHARDINGCORE=6.7.0.3
3+
set SHARDINGCORE=6.7.0.4
44

55
::删除所有bin与obj下的文件
66
@echo off

samples/Sample.SqlServer/Domain/Entities/SysTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ public class SysTest
44
{
55
public string Id { get; set; }
66
public string UserId { get; set; }
7+
public string Name { get; set; }
78
}
89
}

samples/Sample.SqlServer/Migrations/20221014021906_InitialCreate.Designer.cs

Lines changed: 114 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
using System;
2+
using Microsoft.EntityFrameworkCore.Migrations;
3+
4+
#nullable disable
5+
6+
namespace Sample.SqlServer.Migrations
7+
{
8+
public partial class InitialCreate : Migration
9+
{
10+
protected override void Up(MigrationBuilder migrationBuilder)
11+
{
12+
migrationBuilder.CreateTable(
13+
name: "SysTest",
14+
columns: table => new
15+
{
16+
Id = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
17+
UserId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false)
18+
},
19+
constraints: table =>
20+
{
21+
table.PrimaryKey("PK_SysTest", x => x.Id);
22+
});
23+
24+
migrationBuilder.CreateTable(
25+
name: "SysUserMod",
26+
columns: table => new
27+
{
28+
Id = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
29+
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
30+
Age = table.Column<int>(type: "int", nullable: false),
31+
AgeGroup = table.Column<int>(type: "int", nullable: false)
32+
},
33+
constraints: table =>
34+
{
35+
table.PrimaryKey("PK_SysUserMod", x => x.Id);
36+
});
37+
38+
migrationBuilder.CreateTable(
39+
name: "SysUserSalary",
40+
columns: table => new
41+
{
42+
Id = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
43+
UserId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
44+
DateOfMonth = table.Column<int>(type: "int", nullable: false),
45+
Salary = table.Column<int>(type: "int", nullable: false),
46+
SalaryLong = table.Column<long>(type: "bigint", nullable: false),
47+
SalaryDecimal = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
48+
SalaryDouble = table.Column<double>(type: "float", nullable: false),
49+
SalaryFloat = table.Column<float>(type: "real", nullable: false)
50+
},
51+
constraints: table =>
52+
{
53+
table.PrimaryKey("PK_SysUserSalary", x => x.Id);
54+
});
55+
56+
migrationBuilder.CreateTable(
57+
name: "TestYearSharding",
58+
columns: table => new
59+
{
60+
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
61+
CreateTIme = table.Column<DateTime>(type: "datetime2", nullable: false)
62+
},
63+
constraints: table =>
64+
{
65+
table.PrimaryKey("PK_TestYearSharding", x => x.Id);
66+
});
67+
}
68+
69+
protected override void Down(MigrationBuilder migrationBuilder)
70+
{
71+
migrationBuilder.DropTable(
72+
name: "SysTest");
73+
74+
migrationBuilder.DropTable(
75+
name: "SysUserMod");
76+
77+
migrationBuilder.DropTable(
78+
name: "SysUserSalary");
79+
80+
migrationBuilder.DropTable(
81+
name: "TestYearSharding");
82+
}
83+
}
84+
}

samples/Sample.SqlServer/Migrations/20221014021942_InitialCreateAddName.Designer.cs

Lines changed: 117 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
#nullable disable
4+
5+
namespace Sample.SqlServer.Migrations
6+
{
7+
public partial class InitialCreateAddName : Migration
8+
{
9+
protected override void Up(MigrationBuilder migrationBuilder)
10+
{
11+
migrationBuilder.AddColumn<string>(
12+
name: "Name",
13+
table: "SysTest",
14+
type: "nvarchar(max)",
15+
nullable: true);
16+
}
17+
18+
protected override void Down(MigrationBuilder migrationBuilder)
19+
{
20+
migrationBuilder.DropColumn(
21+
name: "Name",
22+
table: "SysTest");
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)