protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateCheckConstraint(
                name: "CH_TransactionType",
                table: "Transaction",
                sql: "TransactionType in ('B','S','T','W','D')");

            migrationBuilder.CreateCheckConstraint(
                name: "CH_State",
                table: "Customer",
                sql: "State in ('VIC','QLD','NSW','NT','TAS','ACT','SA','WA')");

            migrationBuilder.CreateCheckConstraint(
                name: "CH_PeriodType",
                table: "BillPay",
                sql: "Period in ('A','S','Q','M')");

            migrationBuilder.CreateCheckConstraint(
                name: "CH_ScheduleDate",
                table: "BillPay",
                sql: "ScheduleDate > SYSDATETIME()");

            migrationBuilder.CreateCheckConstraint(
                name: "CH_AccountType",
                table: "Account",
                sql: "AccountType in ('C','S')");
        }
コード例 #2
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "CK_CarePackages_Status",
                table: "CarePackages");

            migrationBuilder.DropCheckConstraint(
                name: "CK_CarePackageHistories_Status",
                table: "CarePackageHistories");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_CarePackages_Status",
                table: "CarePackages",
                sql: "\"Status\" IN (0, 1, 2, 3, 4, 5, 6, 7, 8)");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_CarePackageHistories_Status",
                table: "CarePackageHistories",
                sql: "\"Status\" IN (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)");

            migrationBuilder.InsertData(
                table: "PackageStatuses",
                columns: new[] { "Id", "StatusDisplayName", "StatusName" },
                values: new object[] { 8, "Rejected", "Rejected" });
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.Sql(@"UPDATE ""CarePackageReclaims"" SET ""SubType"" = NULL WHERE ""SubType"" = 0;");

            migrationBuilder.DropCheckConstraint(
                name: "CK_InvoiceItems_ClaimCollector",
                table: "InvoiceItems");

            migrationBuilder.DropCheckConstraint(
                name: "CK_CarePackageReclaims_SubType",
                table: "CarePackageReclaims");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_InvoiceItems_ClaimCollector",
                table: "InvoiceItems",
                sql: "\"ClaimCollector\" IN (1, 2)");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_CarePackageReclaims_SubType",
                table: "CarePackageReclaims",
                sql: "\"SubType\" IN (1, 2, 3)");

            migrationBuilder.UpdateData(
                table: "AspNetUsers",
                keyColumn: "Id",
                keyValue: new Guid("75996f73-3a1a-4efa-8729-eb4a48c465b0"),
                column: "PasswordHash",
                value: "AQAAAAEAACcQAAAAEDazWD57ElBqImqmsmQWOz2nSr6HJMoP4Zlugh04V5hRFU2mTNbrt+WZ6dTli/6vog==");
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "CK_InvoiceItems_ClaimCollector",
                table: "InvoiceItems");

            migrationBuilder.DropCheckConstraint(
                name: "CK_CarePackageReclaims_SubType",
                table: "CarePackageReclaims");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_InvoiceItems_ClaimCollector",
                table: "InvoiceItems",
                sql: "\"ClaimCollector\" IN (NULL, 1, 2)");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_CarePackageReclaims_SubType",
                table: "CarePackageReclaims",
                sql: "\"SubType\" IN (NULL, 1, 2, 3)");

            migrationBuilder.UpdateData(
                table: "AspNetUsers",
                keyColumn: "Id",
                keyValue: new Guid("75996f73-3a1a-4efa-8729-eb4a48c465b0"),
                column: "PasswordHash",
                value: "AQAAAAEAACcQAAAAEKYPIqwiDLYiR3uXhm/X4tDTTapNnoOouHxXDx5ATevmnXncR+pglbIgvvGx1TXLwg==");
        }
コード例 #5
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "CK_CarePackages_Status",
                table: "CarePackages");

            migrationBuilder.DropCheckConstraint(
                name: "CK_CarePackageHistories_Status",
                table: "CarePackageHistories");

            migrationBuilder.DeleteData(
                table: "PackageStatuses",
                keyColumn: "Id",
                keyValue: 8);

            migrationBuilder.CreateCheckConstraint(
                name: "CK_CarePackages_Status",
                table: "CarePackages",
                sql: "\"Status\" IN (0, 1, 2, 3, 4, 5, 6, 7)");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_CarePackageHistories_Status",
                table: "CarePackageHistories",
                sql: "\"Status\" IN (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)");
        }
コード例 #6
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateCheckConstraint(
                name: "CK_Services_Gender_Enum_Constraint",
                table: "Services",
                sql: "[Gender] IN(0, 1, 2)");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_AspNetUsers_Gender_Enum_Constraint",
                table: "AspNetUsers",
                sql: "[Gender] IN(0, 1, 2)");

            migrationBuilder.AlterColumn <short>(
                name: "EstimatedTime",
                table: "Services",
                type: "smallint",
                nullable: false,
                oldClrType: typeof(byte),
                oldType: "tinyint");

            migrationBuilder.AddColumn <string>(
                name: "Description",
                table: "Salons",
                type: "nvarchar(500)",
                maxLength: 500,
                nullable: true);

            migrationBuilder.CreateTable(
                name: "Notifications",
                columns: table => new
            {
                Id = table.Column <int>(type: "int", nullable: false)
                     .Annotation("SqlServer:Identity", "1, 1"),
                AppUserId = table.Column <int>(type: "int", nullable: false),
                Content   = table.Column <string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                Link      = table.Column <string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
                IsRead    = table.Column <bool>(type: "bit", nullable: false),
                Type      = table.Column <int>(type: "int", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Notifications", x => x.Id);
                table.CheckConstraint("CK_Notifications_Type_Enum_Constraint", "[Type] IN(0, 1)");
                table.ForeignKey(
                    name: "FK_Notifications_AspNetUsers_AppUserId",
                    column: x => x.AppUserId,
                    principalTable: "AspNetUsers",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateIndex(
                name: "IX_Notifications_AppUserId",
                table: "Notifications",
                column: "AppUserId");
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Publications_AspNetUsers_SharedById",
                table: "Publications");

            migrationBuilder.DropIndex(
                name: "IX_Publications_SharedById",
                table: "Publications");

            migrationBuilder.DropColumn(
                name: "CreatedOn",
                table: "Publications");

            migrationBuilder.DropColumn(
                name: "SharedById",
                table: "Publications");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_Publications_Type_Enum_Constraint",
                table: "Publications",
                sql: "[Type] IN(0, 1)");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_Friends_Status_Enum_Constraint",
                table: "Friends",
                sql: "[Status] IN(1, 2)");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_AspNetUsers_Gender_Enum_Constraint",
                table: "AspNetUsers",
                sql: "[Gender] IN(1, 2)");

            migrationBuilder.AddColumn <DateTime>(
                name: "DateTime",
                table: "Shares",
                type: "datetime2",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn <bool>(
                name: "IsDeleted",
                table: "Shares",
                type: "bit",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn <DateTime>(
                name: "DateTime",
                table: "Publications",
                type: "datetime2",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
        }
コード例 #8
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateCheckConstraint(
                name: "CK_Friends_Status_Enum_Constraint",
                table: "Friends",
                sql: "[Status] IN(1, 2)");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_AspNetUsers_Gender_Enum_Constraint",
                table: "AspNetUsers",
                sql: "[Gender] IN(1, 2)");
        }
コード例 #9
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "VoucherNumber",
                table: "Vouchers");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_VoucherDates",
                table: "Vouchers",
                sql: "ActiveFrom < ActiveTo");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_ReservationDates",
                table: "Reservations",
                sql: "TimeFrom < TimeTo");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_FeedbackRating",
                table: "Feedback",
                sql: "Rating >= 0 AND Rating <= 5");

            migrationBuilder.AddColumn <string>(
                name: "Code",
                table: "Vouchers",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AlterColumn <string>(
                name: "Code",
                table: "Tables",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "MenuItems",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "PhoneNumber",
                table: "Customers",
                maxLength: 15,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);
        }
コード例 #10
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "Created",
                table: "Members");

            migrationBuilder.DropColumn(
                name: "CreatedBy",
                table: "Members");

            migrationBuilder.DropColumn(
                name: "LastModified",
                table: "Members");

            migrationBuilder.DropColumn(
                name: "LastModifiedBy",
                table: "Members");

            migrationBuilder.DropColumn(
                name: "Created",
                table: "Invites");

            migrationBuilder.DropColumn(
                name: "CreatedBy",
                table: "Invites");

            migrationBuilder.DropColumn(
                name: "LastModified",
                table: "Invites");

            migrationBuilder.DropColumn(
                name: "LastModifiedBy",
                table: "Invites");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_Teams_Number_Enum_Constraint",
                table: "Teams",
                sql: "[Number] IN(0, 1)");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_Matches_Generator_Enum_Constraint",
                table: "Matches",
                sql: "[Generator] IN(0, 1, 2, 3)");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_Matches_Status_Enum_Constraint",
                table: "Matches",
                sql: "[Status] IN(0, 1, 2, 3, 4)");
        }
コード例 #11
0
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.CreateCheckConstraint(
         name: "CK_Student_YearResult",
         table: "Students",
         sql: "YearResult Between 0 and 20");
 }
コード例 #12
0
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.CreateCheckConstraint(
         name: "CK_DeliveryInfoTable_AddressValueColumn",
         table: "DeliveryInfoTable",
         sql: "[AddressValue] >= 1 AND [AddressValue] <=2");
 }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.CreateCheckConstraint(
         name: "CK_Publications_Type_Enum_Constraint",
         table: "Publications",
         sql: "[Type] IN(0, 1)");
 }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.CreateCheckConstraint(
         name: "CK_Ratings_Value",
         table: "Ratings",
         sql: "[Value] BETWEEN 1 AND 5");
 }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "CK_AspNetUsers_Gender_Enum_Constraint",
                table: "AspNetUsers");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_AspNetUsers_Gender_Enum_Constraint",
                table: "AspNetUsers",
                sql: "[Gender] IN(1, 2)");

            migrationBuilder.AddColumn <DateTime>(
                name: "DateTime",
                table: "Shares",
                type: "datetime2",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn <DateTime>(
                name: "DateTime",
                table: "Publications",
                type: "datetime2",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
        }
コード例 #16
0
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.CreateCheckConstraint(
         name: "CK_UserFollowing_TargetId",
         table: "Followings",
         sql: "[TargetId] <> [ObserverId]");
 }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.CreateCheckConstraint(
         name: "constraint_edition",
         table: "Edition",
         sql: "'name' = 'paperback' OR 'name' = 'e-book' OR 'name' = 'hardback' OR 'name' = 'audio'");
 }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_InvoiceItems_CarePackageDetails_CarePackageDetailId",
                table: "InvoiceItems");

            migrationBuilder.DropForeignKey(
                name: "FK_InvoiceItems_CarePackageReclaims_CarePackageReclaimId",
                table: "InvoiceItems");

            migrationBuilder.DropIndex(
                name: "IX_InvoiceItems_CarePackageDetailId",
                table: "InvoiceItems");

            migrationBuilder.DropIndex(
                name: "IX_InvoiceItems_CarePackageReclaimId",
                table: "InvoiceItems");

            migrationBuilder.DropCheckConstraint(
                name: "CK_InvoiceItems_ClaimCollector",
                table: "InvoiceItems");

            migrationBuilder.DropColumn(
                name: "CarePackageDetailId",
                table: "InvoiceItems");

            migrationBuilder.DropColumn(
                name: "CarePackageReclaimId",
                table: "InvoiceItems");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_InvoiceItems_ClaimCollector",
                table: "InvoiceItems",
                sql: "\"ClaimCollector\" IN (0, 1, 2)");

            migrationBuilder.AlterColumn <int>(
                name: "ClaimCollector",
                table: "InvoiceItems",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldNullable: true);

            migrationBuilder.AddColumn <bool>(
                name: "IsReclaim",
                table: "InvoiceItems",
                type: "boolean",
                nullable: false,
                defaultValueSql: "false");

            migrationBuilder.AddColumn <Guid>(
                name: "PackageId",
                table: "InvoiceItems",
                type: "uuid",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
        }
コード例 #19
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Vinculo_Item_ItensId",
                table: "Vinculo");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Item",
                table: "Item");

            migrationBuilder.DropCheckConstraint(
                name: "CK_Item_Type_Enum_Constraint",
                table: "Item");

            migrationBuilder.RenameTable(
                name: "Item",
                newName: "Itens");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_Itens_Type_Enum_Constraint",
                table: "Itens",
                sql: "[Type] IN(1, 2, 3)");

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "User",
                type: "varchar(120)",
                maxLength: 120,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "Itens",
                type: "varchar(120)",
                maxLength: 120,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_Itens",
                table: "Itens",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_Vinculo_Itens_ItensId",
                table: "Vinculo",
                column: "ItensId",
                principalTable: "Itens",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
コード例 #20
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            // Refer to comments on AddCheckContraintToPhoneNumberTable migration.
            migrationBuilder.Sql("UPDATE Address SET AddressType = NULL WHERE AddressType NOT IN ('Home', 'Office')");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_Address_AddressType",
                table: "Address",
                sql: "AddressType IN ('Home', 'Office')");
        }
コード例 #21
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "CK_InvoiceItems_ClaimCollector",
                table: "InvoiceItems");

            migrationBuilder.DropCheckConstraint(
                name: "CK_CarePackageReclaims_SubType",
                table: "CarePackageReclaims");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_InvoiceItems_ClaimCollector",
                table: "InvoiceItems",
                sql: "\"ClaimCollector\" IN (0, 1, 2)");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_CarePackageReclaims_SubType",
                table: "CarePackageReclaims",
                sql: "\"SubType\" IN (0, 1, 2, 3)");
        }
コード例 #22
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "CK_Notifications_Type_Enum_Constraint",
                table: "Notifications");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_Notifications_Type_Enum_Constraint",
                table: "Notifications",
                sql: "[Type] IN(0, 1, 2)");
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "constraint_history_check_valid_event_type",
                table: "History");

            migrationBuilder.CreateCheckConstraint(
                name: "constraint_history_check_valid_event_type",
                table: "History",
                sql: "EventType in ('RequirementAdded','RequirementDeleted','RequirementVoided','RequirementUnvoided','RequirementPreserved','TagVoided','TagUnvoided','TagCreated','TagDeleted','PreservationStarted','PreservationCompleted','IntervalChanged','JourneyChanged','StepChanged','TransferredManually','TransferredAutomatically','ActionAdded','ActionClosed')");
        }
コード例 #24
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "CK_AspNetUsers_Gender_Enum_Constraint",
                table: "AspNetUsers");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_AspNetUsers_Gender_Enum_Constraint",
                table: "AspNetUsers",
                sql: "[Gender] IN(0, 1, 2)");
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "constraint_requirement_type_check_icon",
                table: "RequirementTypes");

            migrationBuilder.CreateCheckConstraint(
                name: "constraint_requirement_type_check_icon",
                table: "RequirementTypes",
                sql: "Icon in ('Other','Area','Battery','Bearings','Electrical','Heating','Installation','Measure','Nitrogen','Power','Pressure','Rotate')");
        }
コード例 #26
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "CK_PayrunHistories_Type",
                table: "PayrunHistories");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_PayrunHistories_Type",
                table: "PayrunHistories",
                sql: "\"Type\" IN (1, 2, 3)");
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateCheckConstraint(
                name: "CH_PayeeID2",
                table: "Payee",
                sql: "PayeeID >= 1000");

            migrationBuilder.CreateCheckConstraint(
                name: "CH_CustomerID2",
                table: "Customer",
                sql: "CustomerID >= 1000");

            migrationBuilder.CreateCheckConstraint(
                name: "CH_CustomerPostCode2",
                table: "Customer",
                sql: "PostCode >= 1000");

            migrationBuilder.CreateCheckConstraint(
                name: "CH_BillPayID2",
                table: "BillPay",
                sql: "BillPayID >= 1000");

            migrationBuilder.CreateCheckConstraint(
                name: "CH_BillAmount",
                table: "BillPay",
                sql: "Amount > 0");

            migrationBuilder.CreateCheckConstraint(
                name: "CH_AccountNumber2",
                table: "Account",
                sql: "AccountNumber >= 1000");
        }
コード例 #28
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateCheckConstraint(
                name: "constraint_pages_positive",
                table: "Book",
                sql: "'pages' > 0");

            migrationBuilder.AddColumn <int>(
                name: "Pages",
                table: "Book",
                nullable: false,
                defaultValue: 0);
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            // It is important to make sure the existing values of the PhoneNumberType respects
            // the newly added constraint, else the following CreateCheckConstraint method will fail.
            // This is done in a more straight forward manner for demo purposes, in production environment,
            // there would probably be more logic involved to handle existing data.
            migrationBuilder.Sql("UPDATE PhoneNumber SET PhoneNumberType = NULL WHERE PhoneNumberType NOT IN ('Mobile', 'Home', 'Office')");

            migrationBuilder.CreateCheckConstraint(
                name: "CK_PhoneNumber_PhoneNumberType",
                table: "PhoneNumber",
                sql: "PhoneNumberType IN ('Mobile', 'Home', 'Office')");
        }
コード例 #30
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateCheckConstraint(
                name: "prop_ctx",
                table: "Blogs",
                sql: "new_property IN ('1', '2')");

            migrationBuilder.AddColumn <string>(
                name: "NewProperty",
                table: "Blogs",
                maxLength: 100,
                nullable: true);
        }