Exemplo n.º 1
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterTable(
                name: "blogs",
                comment: "Blogs managed on the web site.");

            migrationBuilder.AlterColumn <string>(
                name: "Url",
                table: "blogs",
                type: "varchar(200)",
                maxLength: 200,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AddColumn <decimal>(
                name: "Rating",
                table: "blogs",
                type: "decimal(5,2)",
                nullable: false,
                defaultValue: 0m);

            migrationBuilder.AddColumn <decimal>(
                name: "Score",
                table: "blogs",
                type: "decimal(18,2)",
                nullable: false,
                defaultValue: 0m);
        }
        public static MigrationBuilder DisableChangeTrackingForTable(this MigrationBuilder migrationBuilder, string name, string?schema = null)
        {
            migrationBuilder.AlterTable(name: name, schema: schema)
            .OldAnnotation(SqlChangeTrackingAnnotationNames.Enabled, true);

            return(migrationBuilder);
        }
Exemplo n.º 3
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DeleteData(
                table: "other-entity",
                keyColumn: "Id",
                keyValue: new Guid("de7f49b9-20c7-4898-a2fd-8b408af30613"));

            migrationBuilder.AlterTable(
                name: "BlogAuthorTable",
                comment: "作者");

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "BlogAuthorTable",
                type: "longtext CHARACTER SET utf8mb4",
                nullable: false,
                comment: "名字",
                oldClrType: typeof(string),
                oldType: "longtext CHARACTER SET utf8mb4");

            migrationBuilder.InsertData(
                table: "other-entity",
                columns: new[] { "Id", "TestString" },
                values: new object[] { new Guid("46d68bbb-0865-4b78-bf7b-0476c77917de"), "46d68bbb08654b78bf7b0476c77917de" });
        }
        public static MigrationBuilder EnableChangeTrackingForTable(this MigrationBuilder migrationBuilder, string name, string?schema = null, bool trackColumns = false)
        {
            migrationBuilder.AlterTable(name: name, schema: schema)
            .Annotation(SqlChangeTrackingAnnotationNames.Enabled, true)
            .Annotation(SqlChangeTrackingAnnotationNames.TrackColumns, trackColumns);

            return(migrationBuilder);
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AuthorizationLogs");

            migrationBuilder.AlterTable(
                name: "Users",
                oldComment: "사용자");

            migrationBuilder.AlterTable(
                name: "RefreshToken",
                oldComment: "리프레시 토큰");

            migrationBuilder.AlterColumn <DateTimeOffset>(
                name: "Created",
                table: "RefreshToken",
                type: "datetimeoffset",
                nullable: false,
                comment: "작성시각",
                oldClrType: typeof(DateTimeOffset),
                oldDefaultValue: new DateTimeOffset(new DateTime(2020, 9, 3, 8, 8, 20, 103, DateTimeKind.Unspecified).AddTicks(837), new TimeSpan(0, 0, 0, 0, 0)),
                oldComment: "작성시각");
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterTable(
                name: "Users",
                comment: "사용자");

            migrationBuilder.AlterTable(
                name: "RefreshToken",
                comment: "리프레시 토큰");

            migrationBuilder.AlterColumn <DateTimeOffset>(
                name: "Created",
                table: "RefreshToken",
                nullable: false,
                defaultValue: new DateTimeOffset(new DateTime(2020, 9, 3, 8, 8, 20, 103, DateTimeKind.Unspecified).AddTicks(837), new TimeSpan(0, 0, 0, 0, 0)),
                comment: "작성시각",
                oldClrType: typeof(DateTimeOffset),
                oldType: "datetimeoffset",
                oldComment: "작성시각");

            migrationBuilder.CreateTable(
                name: "AuthorizationLogs",
                columns: table => new
            {
                Id        = table.Column <string>(maxLength: 36, nullable: false, comment: "식별자"),
                Username  = table.Column <string>(maxLength: 100, nullable: false, comment: "사용자 계정이름"),
                IsSuccess = table.Column <bool>(nullable: false, defaultValue: false, comment: "성공여부"),
                IpAddress = table.Column <string>(maxLength: 100, nullable: true, comment: "아이피 주소"),
                Hostname  = table.Column <string>(maxLength: 100, nullable: true, comment: "기기명칭"),
                CreatedAt = table.Column <DateTimeOffset>(nullable: false, defaultValue: new DateTimeOffset(new DateTime(2020, 9, 3, 8, 8, 20, 111, DateTimeKind.Unspecified).AddTicks(3985), new TimeSpan(0, 0, 0, 0, 0)), comment: "작성시각")
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AuthorizationLogs", x => x.Id);
            },
                comment: "인증로그");
        }
Exemplo n.º 7
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "Rating",
                table: "blogs");

            migrationBuilder.DropColumn(
                name: "Score",
                table: "blogs");

            migrationBuilder.AlterTable(
                name: "blogs",
                oldComment: "Blogs managed on the web site.");

            migrationBuilder.AlterColumn <string>(
                name: "Url",
                table: "blogs",
                type: "nvarchar(max)",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(200)",
                oldMaxLength: 200,
                oldNullable: true);
        }
Exemplo n.º 8
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterDatabase()
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterTable(
                name: "Users")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterTable(
                name: "ShoppingLists")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterTable(
                name: "ShoppingListPermission")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Username",
                table: "Users",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Token",
                table: "Users",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Role",
                table: "Users",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "PasswordHash",
                table: "Users",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "LastName",
                table: "Users",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "FirstName",
                table: "Users",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "EMail",
                table: "Users",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Id",
                table: "Users",
                type: "varchar(255)",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(255)")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn <bool>(
                name: "IsVerified",
                table: "Users",
                type: "tinyint(1)",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AlterColumn <string>(
                name: "SyncId",
                table: "ShoppingLists",
                type: "varchar(255)",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(255)")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "UserId",
                table: "ShoppingListPermission",
                type: "varchar(255)",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(255)")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "ShoppingListId",
                table: "ShoppingListPermission",
                type: "varchar(255)",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(255)")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "EMailVerificationToken",
                columns: table => new
            {
                Id             = table.Column <string>(type: "varchar(255)", nullable: false),
                UserId         = table.Column <string>(type: "varchar(255)", nullable: true),
                UrlCode        = table.Column <string>(type: "longtext", nullable: true),
                ExpirationTime = table.Column <DateTime>(type: "datetime(6)", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_EMailVerificationToken", x => x.Id);
                table.ForeignKey(
                    name: "FK_EMailVerificationToken_Users_UserId",
                    column: x => x.UserId,
                    principalTable: "Users",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Restrict);
            });

            migrationBuilder.CreateIndex(
                name: "IX_EMailVerificationToken_UserId",
                table: "EMailVerificationToken",
                column: "UserId");
        }
Exemplo n.º 9
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "EMailVerificationToken");

            migrationBuilder.DropColumn(
                name: "IsVerified",
                table: "Users");

            migrationBuilder.AlterDatabase()
            .Annotation("MySql:CharSet", "utf8mb4")
            .OldAnnotation("MySql:CharSetDelegation", DelegationModes.ApplyToAll);

            migrationBuilder.AlterTable(
                name: "Users")
            .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterTable(
                name: "ShoppingLists")
            .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterTable(
                name: "ShoppingListPermission")
            .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Username",
                table: "Users",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Token",
                table: "Users",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Role",
                table: "Users",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "PasswordHash",
                table: "Users",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "LastName",
                table: "Users",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "FirstName",
                table: "Users",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "EMail",
                table: "Users",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Id",
                table: "Users",
                type: "varchar(255)",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(255)")
            .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "SyncId",
                table: "ShoppingLists",
                type: "varchar(255)",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(255)")
            .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "UserId",
                table: "ShoppingListPermission",
                type: "varchar(255)",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(255)")
            .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "ShoppingListId",
                table: "ShoppingListPermission",
                type: "varchar(255)",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(255)")
            .Annotation("MySql:CharSet", "utf8mb4");
        }
Exemplo n.º 10
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterDatabase()
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterTable(
                name: "SysUser")
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterTable(
                name: "SysRole")
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterTable(
                name: "SysRelation")
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterTable(
                name: "SysMenu")
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterTable(
                name: "SysDept")
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Salt",
                table: "SysUser",
                type: "varchar(6)",
                maxLength: 6,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(6)",
                oldMaxLength: 6)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "RoleIds",
                table: "SysUser",
                type: "varchar(72)",
                maxLength: 72,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(72)",
                oldMaxLength: 72,
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Phone",
                table: "SysUser",
                type: "varchar(11)",
                maxLength: 11,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(11)",
                oldMaxLength: 11,
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Password",
                table: "SysUser",
                type: "varchar(32)",
                maxLength: 32,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(32)",
                oldMaxLength: 32)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "SysUser",
                type: "varchar(16)",
                maxLength: 16,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(16)",
                oldMaxLength: 16)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Email",
                table: "SysUser",
                type: "varchar(32)",
                maxLength: 32,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(32)",
                oldMaxLength: 32,
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Avatar",
                table: "SysUser",
                type: "varchar(64)",
                maxLength: 64,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(64)",
                oldMaxLength: 64,
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Account",
                table: "SysUser",
                type: "varchar(16)",
                maxLength: 16,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(16)",
                oldMaxLength: 16)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Tips",
                table: "SysRole",
                type: "varchar(64)",
                maxLength: 64,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(64)",
                oldMaxLength: 64,
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "SysRole",
                type: "varchar(32)",
                maxLength: 32,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(32)",
                oldMaxLength: 32)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Url",
                table: "SysMenu",
                type: "varchar(64)",
                maxLength: 64,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(64)",
                oldMaxLength: 64,
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Tips",
                table: "SysMenu",
                type: "varchar(32)",
                maxLength: 32,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(32)",
                oldMaxLength: 32,
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "PCodes",
                table: "SysMenu",
                type: "varchar(128)",
                maxLength: 128,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(128)",
                oldMaxLength: 128,
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "PCode",
                table: "SysMenu",
                type: "varchar(16)",
                maxLength: 16,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(16)",
                oldMaxLength: 16,
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "SysMenu",
                type: "varchar(16)",
                maxLength: 16,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(16)",
                oldMaxLength: 16)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Icon",
                table: "SysMenu",
                type: "varchar(16)",
                maxLength: 16,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(16)",
                oldMaxLength: 16,
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Component",
                table: "SysMenu",
                type: "varchar(64)",
                maxLength: 64,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(64)",
                oldMaxLength: 64,
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Code",
                table: "SysMenu",
                type: "varchar(16)",
                maxLength: 16,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(16)",
                oldMaxLength: 16)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Tips",
                table: "SysDept",
                type: "varchar(64)",
                maxLength: 64,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(64)",
                oldMaxLength: 64,
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "SimpleName",
                table: "SysDept",
                type: "varchar(16)",
                maxLength: 16,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(16)",
                oldMaxLength: 16)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "Pids",
                table: "SysDept",
                type: "varchar(80)",
                maxLength: 80,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(80)",
                oldMaxLength: 80,
                oldNullable: true)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn <string>(
                name: "FullName",
                table: "SysDept",
                type: "varchar(32)",
                maxLength: 32,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(32)",
                oldMaxLength: 32)
            .Annotation("MySql:CharSet", "utf8mb4 ")
            .OldAnnotation("MySql:CharSet", "utf8mb4");
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_SYS_USER",
                table: "SYS_USER");

            migrationBuilder.DropColumn(
                name: "Age",
                table: "SYS_USER");

            migrationBuilder.RenameTable(
                name: "SYS_USER",
                newName: "Users");

            migrationBuilder.RenameColumn(
                name: "ID",
                table: "Users",
                newName: "Id");

            migrationBuilder.RenameColumn(
                name: "USER_PWD",
                table: "Users",
                newName: "UserPwd");

            migrationBuilder.RenameColumn(
                name: "USER_NAME",
                table: "Users",
                newName: "UserName");

            migrationBuilder.AlterTable(
                name: "Users",
                oldComment: "用户表");

            migrationBuilder.AlterColumn <string>(
                name: "Id",
                table: "Users",
                type: "nvarchar(450)",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(128)");

            migrationBuilder.AlterColumn <string>(
                name: "UserPwd",
                table: "Users",
                type: "nvarchar(max)",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(128)");

            migrationBuilder.AlterColumn <string>(
                name: "UserName",
                table: "Users",
                type: "nvarchar(max)",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(128)",
                oldNullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_Users",
                table: "Users",
                column: "Id");
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterTable(
                name: "BillArchive",
                schema: "Sadad",
                comment: "Descripe the payment history for Conditional Booklet and Invitation");

            migrationBuilder.AlterTable(
                name: "SupplierCombinedDetail",
                schema: "Offer",
                comment: "Descripe the Details for suppliers [Offer owner and Combined]");

            migrationBuilder.AlterColumn <string>(
                name: "TenderReferenceNumber",
                schema: "Sadad",
                table: "BillArchive",
                maxLength: 100,
                nullable: true,
                comment: "Related Tender Reference Number",
                oldClrType: typeof(string),
                oldType: "nvarchar(100)",
                oldMaxLength: 100,
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "TenderId",
                schema: "Sadad",
                table: "BillArchive",
                nullable: false,
                comment: "Define the related Tender",
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AlterColumn <string>(
                name: "SupplierNumber",
                schema: "Sadad",
                table: "BillArchive",
                maxLength: 20,
                nullable: true,
                comment: "Define Supplier Commercial Number",
                oldClrType: typeof(string),
                oldType: "nvarchar(20)",
                oldMaxLength: 20,
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "InvitationId",
                schema: "Sadad",
                table: "BillArchive",
                nullable: true,
                comment: "This refere the invitation ",
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "ConditionsBookletID",
                schema: "Sadad",
                table: "BillArchive",
                nullable: true,
                comment: "Define the reference to Conditions Booklet",
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "BillInvoiceNumber",
                schema: "Sadad",
                table: "BillArchive",
                maxLength: 50,
                nullable: true,
                comment: "Define the number of Bill",
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "AgencyCode",
                schema: "Sadad",
                table: "BillArchive",
                maxLength: 50,
                nullable: true,
                comment: "Define the Code for the agency that own the Tender",
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "Id",
                schema: "Sadad",
                table: "BillArchive",
                nullable: false,
                comment: "Define  the Identity  for the table ",
                oldClrType: typeof(int),
                oldType: "int")
            .Annotation("SqlServer:Identity", "1, 1")
            .OldAnnotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AlterColumn <bool>(
                name: "IsZakatValidDate",
                schema: "Offer",
                table: "SupplierCombinedDetail",
                nullable: false,
                comment: "Define   if the Zakat Certificate  is Valid ",
                oldClrType: typeof(bool),
                oldType: "bit");

            migrationBuilder.AlterColumn <bool>(
                name: "IsZakatAttached",
                schema: "Offer",
                table: "SupplierCombinedDetail",
                nullable: false,
                comment: "Define  if the Zakat Certificate Copy  is Attached with offer papers ",
                oldClrType: typeof(bool),
                oldType: "bit");

            migrationBuilder.AlterColumn <bool>(
                name: "IsSpecificationValidDate",
                schema: "Offer",
                table: "SupplierCombinedDetail",
                nullable: true,
                comment: "Define   if the Specification Certificate  is Valid ",
                oldClrType: typeof(bool),
                oldType: "bit",
                oldNullable: true);

            migrationBuilder.AlterColumn <bool>(
                name: "IsSpecificationAttached",
                schema: "Offer",
                table: "SupplierCombinedDetail",
                nullable: true,
                comment: "Define  if the Specification Copy is Attached with offer papers",
                oldClrType: typeof(bool),
                oldType: "bit",
                oldNullable: true);

            migrationBuilder.AlterColumn <bool>(
                name: "IsSocialInsuranceAttached",
                schema: "Offer",
                table: "SupplierCombinedDetail",
                nullable: true,
                comment: "Define  if the Specification Insurance Copy  is Attached with offer papers ",
                oldClrType: typeof(bool),
                oldType: "bit",
                oldNullable: true);

            migrationBuilder.AlterColumn <bool>(
                name: "IsSaudizationValidDate",
                schema: "Offer",
                table: "SupplierCombinedDetail",
                nullable: true,
                comment: "Define   if the Saudization Copy   Is Still valid",
                oldClrType: typeof(bool),
                oldType: "bit",
                oldNullable: true);

            migrationBuilder.AlterColumn <bool>(
                name: "IsSaudizationAttached",
                schema: "Offer",
                table: "SupplierCombinedDetail",
                nullable: true,
                comment: "Define  if the Saudization Copy is Attached with offer papers",
                oldClrType: typeof(bool),
                oldType: "bit",
                oldNullable: true);

            migrationBuilder.AlterColumn <bool>(
                name: "IsCommercialRegisterValid",
                schema: "Offer",
                table: "SupplierCombinedDetail",
                nullable: true,
                comment: "Define   if the Commercial Registeration    is Valid  ",
                oldClrType: typeof(bool),
                oldType: "bit",
                oldNullable: true);

            migrationBuilder.AlterColumn <bool>(
                name: "IsCommercialRegisterAttached",
                schema: "Offer",
                table: "SupplierCombinedDetail",
                nullable: true,
                comment: "Define  if the Commercial Registeration number Copy is Attached with offer papers",
                oldClrType: typeof(bool),
                oldType: "bit",
                oldNullable: true);

            migrationBuilder.AlterColumn <bool>(
                name: "IsChamberJoiningValid",
                schema: "Offer",
                table: "SupplierCombinedDetail",
                nullable: true,
                comment: "Define   if the Chamber Join  Is Still valid",
                oldClrType: typeof(bool),
                oldType: "bit",
                oldNullable: true);

            migrationBuilder.AlterColumn <bool>(
                name: "IsChamberJoiningAttached",
                schema: "Offer",
                table: "SupplierCombinedDetail",
                nullable: true,
                comment: "Define  if the Chamber Join Request is Attached with offer papers",
                oldClrType: typeof(bool),
                oldType: "bit",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "CombinedId",
                schema: "Offer",
                table: "SupplierCombinedDetail",
                nullable: false,
                comment: "Define  the supplier who applied for the tender",
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AlterColumn <int>(
                name: "CombinedDetailId",
                schema: "Offer",
                table: "SupplierCombinedDetail",
                nullable: false,
                comment: "Define  the Identity  for the table ",
                oldClrType: typeof(int),
                oldType: "int")
            .Annotation("SqlServer:Identity", "1, 1")
            .OldAnnotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AddColumn <decimal>(
                name: "OfferPriceAfterLocalContent",
                schema: "Offer",
                table: "Offer",
                nullable: true);

            migrationBuilder.AddColumn <decimal>(
                name: "OfferPriceAfterPreference",
                schema: "Offer",
                table: "Offer",
                nullable: true);

            migrationBuilder.AddColumn <decimal>(
                name: "PricePreferancePercentage",
                schema: "Offer",
                table: "Offer",
                nullable: true);

            migrationBuilder.AddColumn <bool>(
                name: "isBindedToMandatoryList",
                schema: "Offer",
                table: "Offer",
                nullable: false,
                defaultValue: false);

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 31, 14, 26, 18, 187, DateTimeKind.Local).AddTicks(2839));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 31, 14, 26, 18, 187, DateTimeKind.Local).AddTicks(3581));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 31, 14, 26, 18, 187, DateTimeKind.Local).AddTicks(3602));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 4,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 31, 14, 26, 18, 187, DateTimeKind.Local).AddTicks(3603));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 5,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 31, 14, 26, 18, 187, DateTimeKind.Local).AddTicks(3605));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 6,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 31, 14, 26, 18, 187, DateTimeKind.Local).AddTicks(3606));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 7,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 31, 14, 26, 18, 187, DateTimeKind.Local).AddTicks(3607));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 8,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 31, 14, 26, 18, 187, DateTimeKind.Local).AddTicks(3608));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 9,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 31, 14, 26, 18, 187, DateTimeKind.Local).AddTicks(3610));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 10,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 31, 14, 26, 18, 187, DateTimeKind.Local).AddTicks(3611));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 11,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 31, 14, 26, 18, 187, DateTimeKind.Local).AddTicks(3612));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 12,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 31, 14, 26, 18, 187, DateTimeKind.Local).AddTicks(3613));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 13,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 31, 14, 26, 18, 187, DateTimeKind.Local).AddTicks(3615));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "UserRole",
                keyColumn: "UserRoleId",
                keyValue: 100,
                column: "IsCombinedRole",
                value: true);
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterTable(
                name: "SupplierPreQualificationDocument",
                schema: "Qualification",
                comment: "Define the Documents applied from the supplier  Qualification");

            migrationBuilder.AlterTable(
                name: "SupplierPreQualificationAttachment",
                schema: "Qualification",
                comment: "Define the Attachments needed for the Qualification");

            migrationBuilder.AlterTable(
                name: "SupplierTenderQuantityTable",
                schema: "Offer",
                comment: "Define the Quantity Table for Supplier to Apply his offer");

            migrationBuilder.AlterColumn <string>(
                name: "SupplierId",
                schema: "Qualification",
                table: "SupplierPreQualificationDocument",
                nullable: true,
                comment: "The supplier Commercial Registeration Number ",
                oldClrType: typeof(string),
                oldType: "nvarchar(20)",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "StatusId",
                schema: "Qualification",
                table: "SupplierPreQualificationDocument",
                nullable: true,
                comment: "Define the status of the request",
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "RejectionReason",
                schema: "Qualification",
                table: "SupplierPreQualificationDocument",
                nullable: true,
                comment: "Define the Rejection Reason if the request was rejected",
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "PreQualificationResult",
                schema: "Qualification",
                table: "SupplierPreQualificationDocument",
                nullable: true,
                comment: "Define result of evaluation the supplier files ",
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "PreQualificationId",
                schema: "Qualification",
                table: "SupplierPreQualificationDocument",
                nullable: false,
                comment: "Define the related Qualification",
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AlterColumn <string>(
                name: "FileNetReferenceId",
                schema: "Qualification",
                table: "SupplierPreQualificationAttachment",
                maxLength: 1024,
                nullable: true,
                comment: "Define the reference id from file net system",
                oldClrType: typeof(string),
                oldType: "nvarchar(1024)",
                oldMaxLength: 1024,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "FileName",
                schema: "Qualification",
                table: "SupplierPreQualificationAttachment",
                maxLength: 1024,
                nullable: true,
                comment: "Define name of the attachment",
                oldClrType: typeof(string),
                oldType: "nvarchar(1024)",
                oldMaxLength: 1024,
                oldNullable: true);

            migrationBuilder.AlterColumn <int>(
                name: "AttachmentId",
                schema: "Qualification",
                table: "SupplierPreQualificationAttachment",
                nullable: false,
                comment: "Define  the Identity  for the table",
                oldClrType: typeof(int),
                oldType: "int")
            .Annotation("SqlServer:Identity", "1, 1")
            .OldAnnotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AlterColumn <long>(
                name: "TenederQuantityId",
                schema: "Offer",
                table: "SupplierTenderQuantityTable",
                nullable: true,
                comment: "Define releated Tender Quantity table",
                oldClrType: typeof(long),
                oldType: "bigint",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                schema: "Offer",
                table: "SupplierTenderQuantityTable",
                nullable: false,
                comment: "Define  Name of  the table",
                oldClrType: typeof(string),
                oldType: "nvarchar(max)");

            migrationBuilder.AlterColumn <decimal>(
                name: "AdjustedTotalVAT",
                schema: "Offer",
                table: "SupplierTenderQuantityTable",
                nullable: false,
                comment: "Not Used",
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)");

            migrationBuilder.AlterColumn <string>(
                name: "AdjustedTotalPrice",
                schema: "Offer",
                table: "SupplierTenderQuantityTable",
                nullable: true,
                comment: "Not Used",
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "AdjustedTotalDiscount",
                schema: "Offer",
                table: "SupplierTenderQuantityTable",
                nullable: true,
                comment: "Not Used",
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <long>(
                name: "Id",
                schema: "Offer",
                table: "SupplierTenderQuantityTable",
                nullable: false,
                comment: "Define  the Identity  for the table",
                oldClrType: typeof(long),
                oldType: "bigint")
            .Annotation("SqlServer:Identity", "1, 1")
            .OldAnnotation("SqlServer:Identity", "1, 1");

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 23, 16, 21, 19, 767, DateTimeKind.Local).AddTicks(1134));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 23, 16, 21, 19, 767, DateTimeKind.Local).AddTicks(2487));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 23, 16, 21, 19, 767, DateTimeKind.Local).AddTicks(2520));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 4,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 23, 16, 21, 19, 767, DateTimeKind.Local).AddTicks(2522));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 5,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 23, 16, 21, 19, 767, DateTimeKind.Local).AddTicks(2524));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 6,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 23, 16, 21, 19, 767, DateTimeKind.Local).AddTicks(2525));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 7,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 23, 16, 21, 19, 767, DateTimeKind.Local).AddTicks(2526));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 8,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 23, 16, 21, 19, 767, DateTimeKind.Local).AddTicks(2527));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 9,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 23, 16, 21, 19, 767, DateTimeKind.Local).AddTicks(2528));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 10,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 23, 16, 21, 19, 767, DateTimeKind.Local).AddTicks(2529));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 11,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 23, 16, 21, 19, 767, DateTimeKind.Local).AddTicks(2530));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 12,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 23, 16, 21, 19, 767, DateTimeKind.Local).AddTicks(2531));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "TenderType",
                keyColumn: "TenderTypeId",
                keyValue: 13,
                column: "CreatedAt",
                value: new DateTime(2021, 3, 23, 16, 21, 19, 767, DateTimeKind.Local).AddTicks(2532));

            migrationBuilder.UpdateData(
                schema: "LookUps",
                table: "UserRole",
                keyColumn: "UserRoleId",
                keyValue: 100,
                column: "IsCombinedRole",
                value: true);
        }
Exemplo n.º 14
0
 public override AlterOperationBuilder <AlterTableOperation> AlterTable(string name, string schema = null, string comment = null, string oldComment = null)
 {
     return(_migrationBuilder.AlterTable(name, schema, comment, oldComment));
 }