11using System ;
2+ using Microsoft . EntityFrameworkCore . Metadata ;
23using Microsoft . EntityFrameworkCore . Migrations ;
34
45#nullable disable
@@ -11,37 +12,49 @@ public partial class InitialCreate : Migration
1112 /// <inheritdoc />
1213 protected override void Up ( MigrationBuilder migrationBuilder )
1314 {
15+ migrationBuilder . AlterDatabase ( )
16+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ;
17+
1418 migrationBuilder . CreateTable (
1519 name : "Users" ,
1620 columns : table => new
1721 {
18- Id = table . Column < int > ( type : "INTEGER" , nullable : false )
19- . Annotation ( "Sqlite:Autoincrement" , true ) ,
20- FirstName = table . Column < string > ( type : "TEXT" , maxLength : 50 , nullable : false ) ,
21- LastName = table . Column < string > ( type : "TEXT" , maxLength : 50 , nullable : false ) ,
22- Username = table . Column < string > ( type : "TEXT" , maxLength : 30 , nullable : false ) ,
23- Email = table . Column < string > ( type : "TEXT" , maxLength : 100 , nullable : false ) ,
24- PasswordHash = table . Column < string > ( type : "TEXT" , nullable : false ) ,
25- ProfilePicture = table . Column < byte [ ] > ( type : "BLOB" , nullable : true )
22+ Id = table . Column < int > ( type : "int" , nullable : false )
23+ . Annotation ( "MySql:ValueGenerationStrategy" , MySqlValueGenerationStrategy . IdentityColumn ) ,
24+ FirstName = table . Column < string > ( type : "varchar(50)" , maxLength : 50 , nullable : false )
25+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ,
26+ LastName = table . Column < string > ( type : "varchar(50)" , maxLength : 50 , nullable : false )
27+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ,
28+ Username = table . Column < string > ( type : "varchar(30)" , maxLength : 30 , nullable : false )
29+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ,
30+ Email = table . Column < string > ( type : "varchar(100)" , maxLength : 100 , nullable : false )
31+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ,
32+ PasswordHash = table . Column < string > ( type : "longtext" , nullable : false )
33+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ,
34+ ProfilePicture = table . Column < byte [ ] > ( type : "longblob" , nullable : true )
2635 } ,
2736 constraints : table =>
2837 {
2938 table . PrimaryKey ( "PK_Users" , x => x . Id ) ;
30- } ) ;
39+ } )
40+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ;
3141
3242 migrationBuilder . CreateTable (
3343 name : "Projects" ,
3444 columns : table => new
3545 {
36- ProjectId = table . Column < int > ( type : "INTEGER" , nullable : false )
37- . Annotation ( "Sqlite:Autoincrement" , true ) ,
38- Name = table . Column < string > ( type : "TEXT" , maxLength : 100 , nullable : false ) ,
39- Description = table . Column < string > ( type : "TEXT" , maxLength : 500 , nullable : false ) ,
40- Deadline = table . Column < DateOnly > ( type : "TEXT" , nullable : true ) ,
41- Status = table . Column < int > ( type : "INTEGER" , nullable : false ) ,
42- CreatedAt = table . Column < DateTime > ( type : "TEXT" , nullable : false ) ,
43- Color = table . Column < string > ( type : "TEXT" , maxLength : 10 , nullable : false ) ,
44- OwnerId = table . Column < int > ( type : "INTEGER" , nullable : false )
46+ ProjectId = table . Column < int > ( type : "int" , nullable : false )
47+ . Annotation ( "MySql:ValueGenerationStrategy" , MySqlValueGenerationStrategy . IdentityColumn ) ,
48+ Name = table . Column < string > ( type : "varchar(100)" , maxLength : 100 , nullable : false )
49+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ,
50+ Description = table . Column < string > ( type : "varchar(500)" , maxLength : 500 , nullable : false )
51+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ,
52+ Deadline = table . Column < DateOnly > ( type : "date" , nullable : true ) ,
53+ Status = table . Column < int > ( type : "int" , nullable : false ) ,
54+ CreatedAt = table . Column < DateTime > ( type : "datetime(6)" , nullable : false ) ,
55+ Color = table . Column < string > ( type : "varchar(10)" , maxLength : 10 , nullable : false )
56+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ,
57+ OwnerId = table . Column < int > ( type : "int" , nullable : false )
4558 } ,
4659 constraints : table =>
4760 {
@@ -52,22 +65,25 @@ protected override void Up(MigrationBuilder migrationBuilder)
5265 principalTable : "Users" ,
5366 principalColumn : "Id" ,
5467 onDelete : ReferentialAction . Cascade ) ;
55- } ) ;
68+ } )
69+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ;
5670
5771 migrationBuilder . CreateTable (
5872 name : "Tasks" ,
5973 columns : table => new
6074 {
61- TaskId = table . Column < int > ( type : "INTEGER" , nullable : false )
62- . Annotation ( "Sqlite:Autoincrement" , true ) ,
63- Title = table . Column < string > ( type : "TEXT" , maxLength : 100 , nullable : false ) ,
64- Description = table . Column < string > ( type : "TEXT" , maxLength : 500 , nullable : false ) ,
65- Priority = table . Column < int > ( type : "INTEGER" , nullable : false ) ,
66- Status = table . Column < int > ( type : "INTEGER" , nullable : false ) ,
67- Deadline = table . Column < DateOnly > ( type : "TEXT" , nullable : true ) ,
68- CreatedAt = table . Column < DateTime > ( type : "TEXT" , nullable : false ) ,
69- AssigneeId = table . Column < int > ( type : "INTEGER" , nullable : false ) ,
70- ProjectId = table . Column < int > ( type : "INTEGER" , nullable : false )
75+ TaskId = table . Column < int > ( type : "int" , nullable : false )
76+ . Annotation ( "MySql:ValueGenerationStrategy" , MySqlValueGenerationStrategy . IdentityColumn ) ,
77+ Title = table . Column < string > ( type : "varchar(100)" , maxLength : 100 , nullable : false )
78+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ,
79+ Description = table . Column < string > ( type : "varchar(500)" , maxLength : 500 , nullable : false )
80+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ,
81+ Priority = table . Column < int > ( type : "int" , nullable : false ) ,
82+ Status = table . Column < int > ( type : "int" , nullable : false ) ,
83+ Deadline = table . Column < DateOnly > ( type : "date" , nullable : true ) ,
84+ CreatedAt = table . Column < DateTime > ( type : "datetime(6)" , nullable : false ) ,
85+ AssigneeId = table . Column < int > ( type : "int" , nullable : false ) ,
86+ ProjectId = table . Column < int > ( type : "int" , nullable : false )
7187 } ,
7288 constraints : table =>
7389 {
@@ -84,18 +100,20 @@ protected override void Up(MigrationBuilder migrationBuilder)
84100 principalTable : "Users" ,
85101 principalColumn : "Id" ,
86102 onDelete : ReferentialAction . Cascade ) ;
87- } ) ;
103+ } )
104+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ;
88105
89106 migrationBuilder . CreateTable (
90107 name : "UserProject" ,
91108 columns : table => new
92109 {
93- Id = table . Column < int > ( type : "INTEGER" , nullable : false )
94- . Annotation ( "Sqlite:Autoincrement" , true ) ,
95- Role = table . Column < string > ( type : "TEXT" , maxLength : 50 , nullable : false ) ,
96- JoinedAt = table . Column < DateTime > ( type : "TEXT" , nullable : false ) ,
97- UserId = table . Column < int > ( type : "INTEGER" , nullable : false ) ,
98- ProjectId = table . Column < int > ( type : "INTEGER" , nullable : false )
110+ Id = table . Column < int > ( type : "int" , nullable : false )
111+ . Annotation ( "MySql:ValueGenerationStrategy" , MySqlValueGenerationStrategy . IdentityColumn ) ,
112+ Role = table . Column < string > ( type : "varchar(50)" , maxLength : 50 , nullable : false )
113+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ,
114+ JoinedAt = table . Column < DateTime > ( type : "datetime(6)" , nullable : false ) ,
115+ UserId = table . Column < int > ( type : "int" , nullable : false ) ,
116+ ProjectId = table . Column < int > ( type : "int" , nullable : false )
99117 } ,
100118 constraints : table =>
101119 {
@@ -112,7 +130,8 @@ protected override void Up(MigrationBuilder migrationBuilder)
112130 principalTable : "Users" ,
113131 principalColumn : "Id" ,
114132 onDelete : ReferentialAction . Cascade ) ;
115- } ) ;
133+ } )
134+ . Annotation ( "MySql:CharSet" , "utf8mb4" ) ;
116135
117136 migrationBuilder . CreateIndex (
118137 name : "IX_Projects_OwnerId" ,
0 commit comments