protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn <short>(
                name: "HarvestSeason",
                table: "Actions",
                type: "smallint",
                nullable: true);

            migrationBuilder.UpdateData(
                table: "Actions",
                keyColumns: new[] { "Id", "LocationId", "PlantId" },
                keyValues: new object[] { 1, 2, 1 },
                columns: new[] { "ActionDate", "HarvestSeason" },
                values: new object[] { new DateTime(2019, 11, 7, 0, 0, 0, 0, DateTimeKind.Unspecified), (short)2020 });

            migrationBuilder.UpdateData(
                table: "Actions",
                keyColumns: new[] { "Id", "LocationId", "PlantId" },
                keyValues: new object[] { 2, 2, 2 },
                columns: new[] { "ActionDate", "HarvestSeason" },
                values: new object[] { new DateTime(2019, 11, 7, 0, 0, 0, 0, DateTimeKind.Unspecified), (short)2020 });

            migrationBuilder.UpdateData(
                table: "Actions",
                keyColumns: new[] { "Id", "LocationId", "PlantId" },
                keyValues: new object[] { 3, 2, 3 },
                columns: new[] { "ActionDate", "HarvestSeason" },
                values: new object[] { new DateTime(2020, 4, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), (short)2020 });

            migrationBuilder.AddCheckConstraint(
                name: "CK_Actions_HarvestSeason",
                table: "Actions",
                sql: "HarvestSeason >= year(ActionDate)");
        }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.AddCheckConstraint(
         name: "CK_Age",
         table: "EF_Student",
         sql: "Age BETWEEN 0 AND 150");
 }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.AddCheckConstraint(
         name: "CK_CreateTime",
         table: "Register",
         sql: "CreateTime>'2020-1-1'");
 }
예제 #4
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "constraint_history_check_valid_event_type",
                table: "History");

            migrationBuilder.AlterColumn <string>(
                name: "LastName",
                table: "Persons",
                type: "nvarchar(128)",
                maxLength: 128,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(64)",
                oldMaxLength: 64);

            migrationBuilder.AlterColumn <string>(
                name: "FirstName",
                table: "Persons",
                type: "nvarchar(128)",
                maxLength: 128,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(64)",
                oldMaxLength: 64);

            migrationBuilder.AddCheckConstraint(
                name: "constraint_history_check_valid_event_type",
                table: "History",
                sql: "EventType in ('IpoCompleted','IpoAccepted','IpoSigned','IpoUnaccepted','IpoCreated','IpoEdited','AttachmentUploaded','AttachmentRemoved','CommentAdded','CommentRemoved','IpoCanceled')");
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "HaveEitherAddressOrUserId",
                table: "server_ban");

            migrationBuilder.AddColumn <byte[]>(
                name: "hwid",
                table: "server_ban",
                type: "bytea",
                nullable: true);

            migrationBuilder.AddColumn <byte[]>(
                name: "last_seen_hwid",
                table: "player",
                type: "bytea",
                nullable: true);

            migrationBuilder.AddColumn <byte[]>(
                name: "hwid",
                table: "connection_log",
                type: "bytea",
                nullable: true);

            migrationBuilder.AddCheckConstraint(
                name: "HaveEitherAddressOrUserIdOrHWId",
                table: "server_ban",
                sql: "address IS NOT NULL OR user_id IS NOT NULL OR hwid IS NOT NULL");
        }
예제 #6
0
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.AddCheckConstraint(
         name: "ck_email_lowercase",
         table: "operatives",
         schema: "public",
         sql: "LOWER(email) = email");
 }
예제 #7
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "constraint_history_check_valid_event_type",
                table: "History");

            migrationBuilder.AddCheckConstraint(
                name: "constraint_history_check_valid_event_type",
                table: "History",
                sql: "EventType in ('IpoCompleted','IpoAccepted','IpoSigned','IpoUncompleted','IpoUnaccepted','IpoCreated','IpoEdited','AttachmentUploaded','AttachmentRemoved','CommentAdded','CommentRemoved','IpoCanceled')");
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "CK_AppUser_Gendre",
                table: "AspNetUsers");

            migrationBuilder.AddCheckConstraint(
                name: "CK_AppUser_Gendre",
                table: "AspNetUsers",
                sql: "[Gendre] IN ('Female', 'Male', 'unset')");
        }
예제 #9
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_server_role_ban_server_role_unban__unban_id",
                table: "server_role_ban");

            migrationBuilder.DropForeignKey(
                name: "FK_server_role_unban_server_ban_ban_id",
                table: "server_role_unban");

            migrationBuilder.DropIndex(
                name: "IX_server_role_unban_ban_id",
                table: "server_role_unban");

            migrationBuilder.DropIndex(
                name: "IX_server_role_ban__unban_id",
                table: "server_role_ban");

            migrationBuilder.DropColumn(
                name: "unban_id",
                table: "server_role_ban");

            migrationBuilder.CreateIndex(
                name: "IX_server_role_unban_ban_id",
                table: "server_role_unban",
                column: "ban_id",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_server_role_ban_address",
                table: "server_role_ban",
                column: "address");

            migrationBuilder.CreateIndex(
                name: "IX_server_role_ban_user_id",
                table: "server_role_ban",
                column: "user_id");

            migrationBuilder.AddCheckConstraint(
                name: "CK_server_role_ban_HaveEitherAddressOrUserIdOrHWId",
                table: "server_role_ban",
                sql: "address IS NOT NULL OR user_id IS NOT NULL OR hwid IS NOT NULL");

            migrationBuilder.AddForeignKey(
                name: "FK_server_role_unban_server_role_ban_ban_id",
                table: "server_role_unban",
                column: "ban_id",
                principalTable: "server_role_ban",
                principalColumn: "server_role_ban_id",
                onDelete: ReferentialAction.Cascade);
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_JournalRecords_LectureId",
                table: "JournalRecords");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_JournalRecords_LectureId_StudentId",
                table: "JournalRecords",
                columns: new[] { "LectureId", "StudentId" });

            migrationBuilder.AddCheckConstraint(
                name: "CK_JournalRecords_Score",
                table: "JournalRecords",
                sql: "[Attendance] = 0 AND [Score] = 0 OR [Attendance] = 1 AND [Score] BETWEEN 0 AND 5");
        }
예제 #11
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "CK_JournalRecords_Score",
                table: "JournalRecords");

            migrationBuilder.DropColumn(
                name: "Email",
                table: "Students");

            migrationBuilder.DropColumn(
                name: "Email",
                table: "Lecturers");

            migrationBuilder.AddCheckConstraint(
                name: "CK_JournalRecords_Score",
                table: "JournalRecords",
                sql: "[Attendance] = 0 AND [Score] = 0 OR [Attendance] = 1 AND [Score] BETWEEN 1 AND 5");
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.InsertData(
                table: "Locations",
                columns: new[] { "Id", "Name", "Stock" },
                values: new object[] { 1, "Mcdonalds", 20 });

            migrationBuilder.InsertData(
                table: "Locations",
                columns: new[] { "Id", "Name", "Stock" },
                values: new object[] { 2, "Burger King", 10 });

            migrationBuilder.InsertData(
                table: "Orders",
                columns: new[] { "Id", "LocationId", "Quantity" },
                values: new object[] { new Guid("5e3a0865-04ec-4750-9e0b-f260975c6746"), 1, 2 });

            migrationBuilder.AddCheckConstraint(
                name: "CK_Order_Quantity_Nonnegative",
                table: "Orders",
                sql: "[Quantity] >= 0");
        }
예제 #13
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "BookShopState",
                schema: "BookShop",
                columns: table => new
            {
                Id = table.Column <int>(type: "int", nullable: false)
                     .Annotation("SqlServer:Identity", "1, 1"),
                Balance = table.Column <decimal>(type: "decimal(18,2)", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_BookShopState", x => x.Id);
            });

            migrationBuilder.AddCheckConstraint(
                name: "CK_BookShop.Book_Cost",
                schema: "BookShop",
                table: "Book",
                sql: "[Cost] > 0");
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "HaveEitherAddressOrUserIdOrHWId",
                table: "server_ban");

            migrationBuilder.DropColumn(
                name: "hwid",
                table: "server_ban");

            migrationBuilder.DropColumn(
                name: "last_seen_hwid",
                table: "player");

            migrationBuilder.DropColumn(
                name: "hwid",
                table: "connection_log");

            migrationBuilder.AddCheckConstraint(
                name: "HaveEitherAddressOrUserId",
                table: "server_ban",
                sql: "address IS NOT NULL OR user_id IS NOT NULL");
        }
예제 #15
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "CK_JournalRecords_Score",
                table: "JournalRecords");

            migrationBuilder.AddColumn <string>(
                name: "Email",
                table: "Students",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "Email",
                table: "Lecturers",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);

            migrationBuilder.UpdateData(
                table: "Lecturers",
                keyColumn: "Id",
                keyValue: 1,
                column: "Email",
                value: "*****@*****.**");

            migrationBuilder.UpdateData(
                table: "Lecturers",
                keyColumn: "Id",
                keyValue: 2,
                column: "Email",
                value: "*****@*****.**");

            migrationBuilder.UpdateData(
                table: "Lecturers",
                keyColumn: "Id",
                keyValue: 3,
                column: "Email",
                value: "*****@*****.**");

            migrationBuilder.UpdateData(
                table: "Students",
                keyColumn: "Id",
                keyValue: 1,
                column: "Email",
                value: "*****@*****.**");

            migrationBuilder.UpdateData(
                table: "Students",
                keyColumn: "Id",
                keyValue: 2,
                column: "Email",
                value: "*****@*****.**");

            migrationBuilder.UpdateData(
                table: "Students",
                keyColumn: "Id",
                keyValue: 3,
                column: "Email",
                value: "*****@*****.**");

            migrationBuilder.UpdateData(
                table: "Students",
                keyColumn: "Id",
                keyValue: 4,
                column: "Email",
                value: "*****@*****.**");

            migrationBuilder.UpdateData(
                table: "Students",
                keyColumn: "Id",
                keyValue: 5,
                column: "Email",
                value: "*****@*****.**");

            migrationBuilder.AddCheckConstraint(
                name: "CK_JournalRecords_Score",
                table: "JournalRecords",
                sql: "[Attendance] = 0 AND [Score] = 0 OR [Attendance] = 1 AND [Score] BETWEEN 0 AND 5");
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn <string>(
                name: "AppUserId",
                table: "Teacher",
                type: "nvarchar(450)",
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "nvarchar(450)",
                oldNullable: true);

            migrationBuilder.AddColumn <string>(
                name: "AppUserId",
                table: "Kid",
                type: "nvarchar(450)",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AlterColumn <string>(
                name: "Gendre",
                table: "AspNetUsers",
                type: "nvarchar(6)",
                maxLength: 6,
                nullable: false,
                defaultValue: "unset",
                oldClrType: typeof(string),
                oldType: "nvarchar(max)");

            migrationBuilder.AlterColumn <string>(
                name: "CIN",
                table: "AspNetUsers",
                type: "nvarchar(8)",
                maxLength: 8,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(450)",
                oldNullable: true);

            migrationBuilder.CreateTable(
                name: "Inscription",
                columns: table => new
            {
                KidID           = table.Column <int>(type: "int", nullable: false),
                AppUserID       = table.Column <string>(type: "nvarchar(450)", nullable: false),
                InscriptionDate = table.Column <DateTime>(type: "datetime2", nullable: false, defaultValueSql: "getdate()")
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Inscription_AppUser_Kid", x => new { x.KidID, x.AppUserID });
                table.ForeignKey(
                    name: "FK_Inscription_AspNetUsers_AppUserID",
                    column: x => x.AppUserID,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Restrict);
                table.ForeignKey(
                    name: "FK_Inscription_Kid_KidID",
                    column: x => x.KidID,
                    principalTable: "Kid",
                    principalColumn: "KidID",
                    onDelete: ReferentialAction.Restrict);
            });

            migrationBuilder.CreateTable(
                name: "TeacherKid",
                columns: table => new
            {
                KidID     = table.Column <int>(type: "int", nullable: false),
                TeacherID = table.Column <int>(type: "int", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_TeacherKid", x => new { x.KidID, x.TeacherID });
                table.ForeignKey(
                    name: "FK_TeacherKid_Kid_KidID",
                    column: x => x.KidID,
                    principalTable: "Kid",
                    principalColumn: "KidID");
                table.ForeignKey(
                    name: "FK_TeacherKid_Teacher_TeacherID",
                    column: x => x.TeacherID,
                    principalTable: "Teacher",
                    principalColumn: "TeacherID",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateIndex(
                name: "IX_Kid_AppUserId",
                table: "Kid",
                column: "AppUserId");

            migrationBuilder.AddCheckConstraint(
                name: "CK_AppUser_Gendre",
                table: "AspNetUsers",
                sql: "[Gendre] IN ('Female', 'Male')");

            migrationBuilder.CreateIndex(
                name: "IX_Inscription_AppUserID",
                table: "Inscription",
                column: "AppUserID");

            migrationBuilder.CreateIndex(
                name: "IX_TeacherKid_TeacherID",
                table: "TeacherKid",
                column: "TeacherID");

            migrationBuilder.AddForeignKey(
                name: "FK_Kid_AspNetUsers_AppUserId",
                table: "Kid",
                column: "AppUserId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }