@@ -12,28 +12,30 @@ public partial class initial : Migration
12
12
/// <inheritdoc />
13
13
protected override void Up ( MigrationBuilder migrationBuilder )
14
14
{
15
- // migrationBuilder.AlterDatabase()
16
- // .Annotation("MySql:CharSet", "utf8mb4");
15
+ migrationBuilder . AlterDatabase ( )
16
+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ;
17
17
18
- //migrationBuilder.CreateTable(
19
- // name: "Notification",
20
- // columns: table => new
21
- // {
22
- // PostId = table.Column<int>(type: "int", nullable: false),
23
- // UserName = table.Column<string>(type: "varchar(255)", nullable: false)
24
- // .Annotation("MySql:CharSet", "utf8mb4"),
25
- // Author = table.Column<string>(type: "longtext", nullable: false)
26
- // .Annotation("MySql:CharSet", "utf8mb4"),
27
- // ImgUrl = table.Column<string>(type: "longtext", nullable: false)
28
- // .Annotation("MySql:CharSet", "utf8mb4"),
29
- // NotificationType = table.Column<string>(type: "longtext", nullable: false)
30
- // .Annotation("MySql:CharSet", "utf8mb4")
31
- // },
32
- // constraints: table =>
33
- // {
34
- // table.PrimaryKey("PK_Notification", x => new { x.PostId, x.UserName });
35
- // })
36
- // .Annotation("MySql:CharSet", "utf8mb4");
18
+ migrationBuilder . CreateTable (
19
+ name : "Notification" ,
20
+ columns : table => new
21
+ {
22
+ Id = table . Column < int > ( type : "int" , nullable : false )
23
+ . Annotation ( "MySql:ValueGenerationStrategy" , MySqlValueGenerationStrategy . IdentityColumn ) ,
24
+ PostId = table . Column < int > ( type : "int" , nullable : false ) ,
25
+ UserName = table . Column < string > ( type : "varchar(255)" , nullable : false )
26
+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ,
27
+ Author = table . Column < string > ( type : "varchar(255)" , nullable : false )
28
+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ,
29
+ ImgUrl = table . Column < string > ( type : "longtext" , nullable : false )
30
+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ,
31
+ NotificationType = table . Column < string > ( type : "varchar(255)" , nullable : false )
32
+ . Annotation ( "MySql:CharSet" , "utf8mb4" )
33
+ } ,
34
+ constraints : table =>
35
+ {
36
+ table . PrimaryKey ( "PK_Notification" , x => x . Id ) ;
37
+ } )
38
+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ;
37
39
38
40
//migrationBuilder.CreateTable(
39
41
// name: "Post",
@@ -173,20 +175,6 @@ protected override void Up(MigrationBuilder migrationBuilder)
173
175
// table: "YtVideo",
174
176
// column: "Url",
175
177
// unique: true);
176
-
177
- migrationBuilder . AddColumn < string > (
178
- name : "Author" ,
179
- table : "Notification" ,
180
- type : "varchar(255)" ,
181
- nullable : false )
182
- . Annotation ( "MySql:CharSet" , "utf8mb4" ) ;
183
-
184
- migrationBuilder . AddColumn < string > (
185
- name : "ImgUrl" ,
186
- table : "Notification" ,
187
- type : "longtext" ,
188
- nullable : false )
189
- . Annotation ( "MySql:CharSet" , "utf8mb4" ) ;
190
178
}
191
179
192
180
/// <inheritdoc />
0 commit comments