| | | 1 | | using System; |
| | | 2 | | using Microsoft.EntityFrameworkCore.Metadata; |
| | | 3 | | using Microsoft.EntityFrameworkCore.Migrations; |
| | | 4 | | |
| | | 5 | | #nullable disable |
| | | 6 | | |
| | | 7 | | namespace OzonRepositories.Migrations.OzonIdentityOrder |
| | | 8 | | { |
| | | 9 | | /// <inheritdoc /> |
| | | 10 | | public partial class Baseline : Migration |
| | | 11 | | { |
| | | 12 | | /// <inheritdoc /> |
| | | 13 | | protected override void Up(MigrationBuilder migrationBuilder) |
| | | 14 | | { |
| | 0 | 15 | | migrationBuilder.AlterDatabase() |
| | 0 | 16 | | .Annotation("MySql:CharSet", "utf8mb4"); |
| | | 17 | | |
| | 0 | 18 | | migrationBuilder.CreateTable( |
| | 0 | 19 | | name: "AspNetRoles", |
| | 0 | 20 | | columns: table => new |
| | 0 | 21 | | { |
| | 0 | 22 | | Id = table.Column<string>(type: "varchar(255)", nullable: false) |
| | 0 | 23 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 24 | | Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true) |
| | 0 | 25 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 26 | | NormalizedName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true) |
| | 0 | 27 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 28 | | ConcurrencyStamp = table.Column<string>(type: "longtext", nullable: true) |
| | 0 | 29 | | .Annotation("MySql:CharSet", "utf8mb4") |
| | 0 | 30 | | }, |
| | 0 | 31 | | constraints: table => |
| | 0 | 32 | | { |
| | 0 | 33 | | table.PrimaryKey("PK_AspNetRoles", x => x.Id); |
| | 0 | 34 | | }) |
| | 0 | 35 | | .Annotation("MySql:CharSet", "utf8mb4"); |
| | | 36 | | |
| | 0 | 37 | | migrationBuilder.CreateTable( |
| | 0 | 38 | | name: "AspNetUsers", |
| | 0 | 39 | | columns: table => new |
| | 0 | 40 | | { |
| | 0 | 41 | | Id = table.Column<string>(type: "varchar(255)", nullable: false) |
| | 0 | 42 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 43 | | AccessProfileId = table.Column<int>(type: "int", nullable: true), |
| | 0 | 44 | | IsAdminApproved = table.Column<bool>(type: "tinyint(1)", nullable: false), |
| | 0 | 45 | | AdminApprovedAtUtc = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
| | 0 | 46 | | AdminApprovedBy = table.Column<string>(type: "longtext", nullable: true) |
| | 0 | 47 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 48 | | GoogleDisplayName = table.Column<string>(type: "longtext", nullable: true) |
| | 0 | 49 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 50 | | GoogleAvatarUrl = table.Column<string>(type: "longtext", nullable: true) |
| | 0 | 51 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 52 | | Discriminator = table.Column<string>(type: "varchar(21)", maxLength: 21, nullable: false) |
| | 0 | 53 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 54 | | UserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true) |
| | 0 | 55 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 56 | | NormalizedUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true) |
| | 0 | 57 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 58 | | Email = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true) |
| | 0 | 59 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 60 | | NormalizedEmail = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true) |
| | 0 | 61 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 62 | | EmailConfirmed = table.Column<bool>(type: "tinyint(1)", nullable: false), |
| | 0 | 63 | | PasswordHash = table.Column<string>(type: "longtext", nullable: true) |
| | 0 | 64 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 65 | | SecurityStamp = table.Column<string>(type: "longtext", nullable: true) |
| | 0 | 66 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 67 | | ConcurrencyStamp = table.Column<string>(type: "longtext", nullable: true) |
| | 0 | 68 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 69 | | PhoneNumber = table.Column<string>(type: "longtext", nullable: true) |
| | 0 | 70 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 71 | | PhoneNumberConfirmed = table.Column<bool>(type: "tinyint(1)", nullable: false), |
| | 0 | 72 | | TwoFactorEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false), |
| | 0 | 73 | | LockoutEnd = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true), |
| | 0 | 74 | | LockoutEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false), |
| | 0 | 75 | | AccessFailedCount = table.Column<int>(type: "int", nullable: false) |
| | 0 | 76 | | }, |
| | 0 | 77 | | constraints: table => |
| | 0 | 78 | | { |
| | 0 | 79 | | table.PrimaryKey("PK_AspNetUsers", x => x.Id); |
| | 0 | 80 | | table.ForeignKey( |
| | 0 | 81 | | name: "FK_AspNetUsers_AccessProfiles_AccessProfileId", |
| | 0 | 82 | | column: x => x.AccessProfileId, |
| | 0 | 83 | | principalTable: "AccessProfiles", |
| | 0 | 84 | | principalColumn: "Id", |
| | 0 | 85 | | onDelete: ReferentialAction.SetNull); |
| | 0 | 86 | | }) |
| | 0 | 87 | | .Annotation("MySql:CharSet", "utf8mb4"); |
| | | 88 | | |
| | 0 | 89 | | migrationBuilder.CreateTable( |
| | 0 | 90 | | name: "AspNetRoleClaims", |
| | 0 | 91 | | columns: table => new |
| | 0 | 92 | | { |
| | 0 | 93 | | Id = table.Column<int>(type: "int", nullable: false) |
| | 0 | 94 | | .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), |
| | 0 | 95 | | RoleId = table.Column<string>(type: "varchar(255)", nullable: false) |
| | 0 | 96 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 97 | | ClaimType = table.Column<string>(type: "longtext", nullable: true) |
| | 0 | 98 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 99 | | ClaimValue = table.Column<string>(type: "longtext", nullable: true) |
| | 0 | 100 | | .Annotation("MySql:CharSet", "utf8mb4") |
| | 0 | 101 | | }, |
| | 0 | 102 | | constraints: table => |
| | 0 | 103 | | { |
| | 0 | 104 | | table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); |
| | 0 | 105 | | table.ForeignKey( |
| | 0 | 106 | | name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", |
| | 0 | 107 | | column: x => x.RoleId, |
| | 0 | 108 | | principalTable: "AspNetRoles", |
| | 0 | 109 | | principalColumn: "Id", |
| | 0 | 110 | | onDelete: ReferentialAction.Cascade); |
| | 0 | 111 | | }) |
| | 0 | 112 | | .Annotation("MySql:CharSet", "utf8mb4"); |
| | | 113 | | |
| | 0 | 114 | | migrationBuilder.CreateTable( |
| | 0 | 115 | | name: "AspNetUserClaims", |
| | 0 | 116 | | columns: table => new |
| | 0 | 117 | | { |
| | 0 | 118 | | Id = table.Column<int>(type: "int", nullable: false) |
| | 0 | 119 | | .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), |
| | 0 | 120 | | UserId = table.Column<string>(type: "varchar(255)", nullable: false) |
| | 0 | 121 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 122 | | ClaimType = table.Column<string>(type: "longtext", nullable: true) |
| | 0 | 123 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 124 | | ClaimValue = table.Column<string>(type: "longtext", nullable: true) |
| | 0 | 125 | | .Annotation("MySql:CharSet", "utf8mb4") |
| | 0 | 126 | | }, |
| | 0 | 127 | | constraints: table => |
| | 0 | 128 | | { |
| | 0 | 129 | | table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); |
| | 0 | 130 | | table.ForeignKey( |
| | 0 | 131 | | name: "FK_AspNetUserClaims_AspNetUsers_UserId", |
| | 0 | 132 | | column: x => x.UserId, |
| | 0 | 133 | | principalTable: "AspNetUsers", |
| | 0 | 134 | | principalColumn: "Id", |
| | 0 | 135 | | onDelete: ReferentialAction.Cascade); |
| | 0 | 136 | | }) |
| | 0 | 137 | | .Annotation("MySql:CharSet", "utf8mb4"); |
| | | 138 | | |
| | 0 | 139 | | migrationBuilder.CreateTable( |
| | 0 | 140 | | name: "AspNetUserLogins", |
| | 0 | 141 | | columns: table => new |
| | 0 | 142 | | { |
| | 0 | 143 | | LoginProvider = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false) |
| | 0 | 144 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 145 | | ProviderKey = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false) |
| | 0 | 146 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 147 | | ProviderDisplayName = table.Column<string>(type: "longtext", nullable: true) |
| | 0 | 148 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 149 | | UserId = table.Column<string>(type: "varchar(255)", nullable: false) |
| | 0 | 150 | | .Annotation("MySql:CharSet", "utf8mb4") |
| | 0 | 151 | | }, |
| | 0 | 152 | | constraints: table => |
| | 0 | 153 | | { |
| | 0 | 154 | | table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); |
| | 0 | 155 | | table.ForeignKey( |
| | 0 | 156 | | name: "FK_AspNetUserLogins_AspNetUsers_UserId", |
| | 0 | 157 | | column: x => x.UserId, |
| | 0 | 158 | | principalTable: "AspNetUsers", |
| | 0 | 159 | | principalColumn: "Id", |
| | 0 | 160 | | onDelete: ReferentialAction.Cascade); |
| | 0 | 161 | | }) |
| | 0 | 162 | | .Annotation("MySql:CharSet", "utf8mb4"); |
| | | 163 | | |
| | 0 | 164 | | migrationBuilder.CreateTable( |
| | 0 | 165 | | name: "AspNetUserRoles", |
| | 0 | 166 | | columns: table => new |
| | 0 | 167 | | { |
| | 0 | 168 | | UserId = table.Column<string>(type: "varchar(255)", nullable: false) |
| | 0 | 169 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 170 | | RoleId = table.Column<string>(type: "varchar(255)", nullable: false) |
| | 0 | 171 | | .Annotation("MySql:CharSet", "utf8mb4") |
| | 0 | 172 | | }, |
| | 0 | 173 | | constraints: table => |
| | 0 | 174 | | { |
| | 0 | 175 | | table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); |
| | 0 | 176 | | table.ForeignKey( |
| | 0 | 177 | | name: "FK_AspNetUserRoles_AspNetRoles_RoleId", |
| | 0 | 178 | | column: x => x.RoleId, |
| | 0 | 179 | | principalTable: "AspNetRoles", |
| | 0 | 180 | | principalColumn: "Id", |
| | 0 | 181 | | onDelete: ReferentialAction.Cascade); |
| | 0 | 182 | | table.ForeignKey( |
| | 0 | 183 | | name: "FK_AspNetUserRoles_AspNetUsers_UserId", |
| | 0 | 184 | | column: x => x.UserId, |
| | 0 | 185 | | principalTable: "AspNetUsers", |
| | 0 | 186 | | principalColumn: "Id", |
| | 0 | 187 | | onDelete: ReferentialAction.Cascade); |
| | 0 | 188 | | }) |
| | 0 | 189 | | .Annotation("MySql:CharSet", "utf8mb4"); |
| | | 190 | | |
| | 0 | 191 | | migrationBuilder.CreateTable( |
| | 0 | 192 | | name: "AspNetUserTokens", |
| | 0 | 193 | | columns: table => new |
| | 0 | 194 | | { |
| | 0 | 195 | | UserId = table.Column<string>(type: "varchar(255)", nullable: false) |
| | 0 | 196 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 197 | | LoginProvider = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false) |
| | 0 | 198 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 199 | | Name = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false) |
| | 0 | 200 | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | 0 | 201 | | Value = table.Column<string>(type: "longtext", nullable: true) |
| | 0 | 202 | | .Annotation("MySql:CharSet", "utf8mb4") |
| | 0 | 203 | | }, |
| | 0 | 204 | | constraints: table => |
| | 0 | 205 | | { |
| | 0 | 206 | | table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); |
| | 0 | 207 | | table.ForeignKey( |
| | 0 | 208 | | name: "FK_AspNetUserTokens_AspNetUsers_UserId", |
| | 0 | 209 | | column: x => x.UserId, |
| | 0 | 210 | | principalTable: "AspNetUsers", |
| | 0 | 211 | | principalColumn: "Id", |
| | 0 | 212 | | onDelete: ReferentialAction.Cascade); |
| | 0 | 213 | | }) |
| | 0 | 214 | | .Annotation("MySql:CharSet", "utf8mb4"); |
| | | 215 | | |
| | 0 | 216 | | migrationBuilder.CreateIndex( |
| | 0 | 217 | | name: "IX_AspNetRoleClaims_RoleId", |
| | 0 | 218 | | table: "AspNetRoleClaims", |
| | 0 | 219 | | column: "RoleId"); |
| | | 220 | | |
| | 0 | 221 | | migrationBuilder.CreateIndex( |
| | 0 | 222 | | name: "RoleNameIndex", |
| | 0 | 223 | | table: "AspNetRoles", |
| | 0 | 224 | | column: "NormalizedName", |
| | 0 | 225 | | unique: true); |
| | | 226 | | |
| | 0 | 227 | | migrationBuilder.CreateIndex( |
| | 0 | 228 | | name: "IX_AspNetUserClaims_UserId", |
| | 0 | 229 | | table: "AspNetUserClaims", |
| | 0 | 230 | | column: "UserId"); |
| | | 231 | | |
| | 0 | 232 | | migrationBuilder.CreateIndex( |
| | 0 | 233 | | name: "IX_AspNetUserLogins_UserId", |
| | 0 | 234 | | table: "AspNetUserLogins", |
| | 0 | 235 | | column: "UserId"); |
| | | 236 | | |
| | 0 | 237 | | migrationBuilder.CreateIndex( |
| | 0 | 238 | | name: "IX_AspNetUserRoles_RoleId", |
| | 0 | 239 | | table: "AspNetUserRoles", |
| | 0 | 240 | | column: "RoleId"); |
| | | 241 | | |
| | 0 | 242 | | migrationBuilder.CreateIndex( |
| | 0 | 243 | | name: "EmailIndex", |
| | 0 | 244 | | table: "AspNetUsers", |
| | 0 | 245 | | column: "NormalizedEmail"); |
| | | 246 | | |
| | 0 | 247 | | migrationBuilder.CreateIndex( |
| | 0 | 248 | | name: "IX_AspNetUsers_AccessProfileId", |
| | 0 | 249 | | table: "AspNetUsers", |
| | 0 | 250 | | column: "AccessProfileId"); |
| | | 251 | | |
| | 0 | 252 | | migrationBuilder.CreateIndex( |
| | 0 | 253 | | name: "UserNameIndex", |
| | 0 | 254 | | table: "AspNetUsers", |
| | 0 | 255 | | column: "NormalizedUserName", |
| | 0 | 256 | | unique: true); |
| | 0 | 257 | | } |
| | | 258 | | |
| | | 259 | | /// <inheritdoc /> |
| | | 260 | | protected override void Down(MigrationBuilder migrationBuilder) |
| | | 261 | | { |
| | 0 | 262 | | migrationBuilder.DropTable( |
| | 0 | 263 | | name: "AspNetRoleClaims"); |
| | | 264 | | |
| | 0 | 265 | | migrationBuilder.DropTable( |
| | 0 | 266 | | name: "AspNetUserClaims"); |
| | | 267 | | |
| | 0 | 268 | | migrationBuilder.DropTable( |
| | 0 | 269 | | name: "AspNetUserLogins"); |
| | | 270 | | |
| | 0 | 271 | | migrationBuilder.DropTable( |
| | 0 | 272 | | name: "AspNetUserRoles"); |
| | | 273 | | |
| | 0 | 274 | | migrationBuilder.DropTable( |
| | 0 | 275 | | name: "AspNetUserTokens"); |
| | | 276 | | |
| | 0 | 277 | | migrationBuilder.DropTable( |
| | 0 | 278 | | name: "AspNetRoles"); |
| | | 279 | | |
| | 0 | 280 | | migrationBuilder.DropTable( |
| | 0 | 281 | | name: "AspNetUsers"); |
| | 0 | 282 | | } |
| | | 283 | | } |
| | | 284 | | } |