using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace GrossesMitainesAPI.Migrations { public partial class InitialDb : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AspNetRoles", columns: table => new { Id = table.Column(type: "nvarchar(450)", nullable: false), Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_AspNetRoles", x => x.Id); }); migrationBuilder.CreateTable( name: "AspNetUsers", columns: table => new { Id = table.Column(type: "nvarchar(450)", nullable: false), FirstName = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), LastName = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), EmailConfirmed = table.Column(type: "bit", nullable: false), PasswordHash = table.Column(type: "nvarchar(max)", nullable: true), SecurityStamp = table.Column(type: "nvarchar(max)", nullable: true), ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true), PhoneNumber = table.Column(type: "nvarchar(max)", nullable: true), PhoneNumberConfirmed = table.Column(type: "bit", nullable: false), TwoFactorEnabled = table.Column(type: "bit", nullable: false), LockoutEnd = table.Column(type: "datetimeoffset", nullable: true), LockoutEnabled = table.Column(type: "bit", nullable: false), AccessFailedCount = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AspNetUsers", x => x.Id); }); migrationBuilder.CreateTable( name: "Products", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Title = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false), Category = table.Column(type: "nvarchar(max)", nullable: false), Description = table.Column(type: "nvarchar(max)", nullable: false), Price = table.Column(type: "decimal(18,2)", nullable: false), PromoPrice = table.Column(type: "decimal(18,2)", nullable: false), Quantity = table.Column(type: "bigint", nullable: false), Status = table.Column(type: "int", nullable: false), Hits = table.Column(type: "bigint", nullable: false), Sales = table.Column(type: "bigint", nullable: false), LastSale = table.Column(type: "datetime2", nullable: true), LastHit = table.Column(type: "datetime2", nullable: true), ImageName = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Products", x => x.Id); }); migrationBuilder.CreateTable( name: "AspNetRoleClaims", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), RoleId = table.Column(type: "nvarchar(450)", nullable: false), ClaimType = table.Column(type: "nvarchar(max)", nullable: true), ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); table.ForeignKey( name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", column: x => x.RoleId, principalTable: "AspNetRoles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Addresses", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), CivicNumber = table.Column(type: "int", nullable: false), Appartment = table.Column(type: "nvarchar(max)", nullable: true), Street = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), City = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), Province = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: false), Country = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), PostalCode = table.Column(type: "nvarchar(max)", nullable: false), InventoryUserId = table.Column(type: "nvarchar(450)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Addresses", x => x.Id); table.ForeignKey( name: "FK_Addresses_AspNetUsers_InventoryUserId", column: x => x.InventoryUserId, principalTable: "AspNetUsers", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "AspNetUserClaims", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), UserId = table.Column(type: "nvarchar(450)", nullable: false), ClaimType = table.Column(type: "nvarchar(max)", nullable: true), ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); table.ForeignKey( name: "FK_AspNetUserClaims_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "AspNetUserLogins", columns: table => new { LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), ProviderKey = table.Column(type: "nvarchar(450)", nullable: false), ProviderDisplayName = table.Column(type: "nvarchar(max)", nullable: true), UserId = table.Column(type: "nvarchar(450)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); table.ForeignKey( name: "FK_AspNetUserLogins_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "AspNetUserRoles", columns: table => new { UserId = table.Column(type: "nvarchar(450)", nullable: false), RoleId = table.Column(type: "nvarchar(450)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); table.ForeignKey( name: "FK_AspNetUserRoles_AspNetRoles_RoleId", column: x => x.RoleId, principalTable: "AspNetRoles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_AspNetUserRoles_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "AspNetUserTokens", columns: table => new { UserId = table.Column(type: "nvarchar(450)", nullable: false), LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), Name = table.Column(type: "nvarchar(450)", nullable: false), Value = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); table.ForeignKey( name: "FK_AspNetUserTokens_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Invoices", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), FirstName = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), LastName = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), PhoneNumber = table.Column(type: "nvarchar(max)", nullable: false), EmailAddress = table.Column(type: "nvarchar(max)", nullable: false), LinkedAccountId = table.Column(type: "nvarchar(450)", nullable: true), PurchaseDate = table.Column(type: "datetime2", nullable: false), ShippingAddressId = table.Column(type: "int", nullable: false), Status = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Invoices", x => x.Id); table.ForeignKey( name: "FK_Invoices_Addresses_ShippingAddressId", column: x => x.ShippingAddressId, principalTable: "Addresses", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Invoices_AspNetUsers_LinkedAccountId", column: x => x.LinkedAccountId, principalTable: "AspNetUsers", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "ProductInvoice", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ProductId = table.Column(type: "int", nullable: false), Quantity = table.Column(type: "bigint", nullable: false), InvoiceModelId = table.Column(type: "int", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ProductInvoice", x => x.Id); table.ForeignKey( name: "FK_ProductInvoice_Invoices_InvoiceModelId", column: x => x.InvoiceModelId, principalTable: "Invoices", principalColumn: "Id"); table.ForeignKey( name: "FK_ProductInvoice_Products_ProductId", column: x => x.ProductId, principalTable: "Products", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.InsertData( table: "AspNetRoles", columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" }, values: new object[,] { { "1b7b9c55-c746-493a-a24f-3d5ca937298e", "ea9b728b-01ce-41db-a0b8-267b641c38c8", "Client", "CLIENT" }, { "c9e08b20-d8a5-473f-9f52-572eb23c12af", "9708e256-7f72-43a3-9981-3d46a496efef", "Administrateur", "ADMINISTRATEUR" } }); migrationBuilder.InsertData( table: "AspNetUsers", columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FirstName", "LastName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName" }, values: new object[] { "ecf7503a-591c-454e-a824-048e10bd0474", 0, "6ecf4a66-157e-4a5c-a6ba-84c0d8df9d8f", "admin@admin.com", false, "Roger", "Admin", false, null, "ADMIN@ADMIN.COM", "ADMIN", "AQAAAAEAACcQAAAAELk80UgvLbSDu3xg805PHJkdcTaFrtU/wZOBkOdJFw9ji5gpPe6G3lTu2FF1ysj7eg==", null, false, "eb2a7531-4487-4a67-9601-adfc03a601cf", false, "Admin" }); migrationBuilder.InsertData( table: "Products", columns: new[] { "Id", "Category", "Description", "Hits", "ImageName", "LastHit", "LastSale", "Price", "PromoPrice", "Quantity", "Sales", "Status", "Title" }, values: new object[,] { { 1, "Linge", "Pour faire votre propre bonhomme de 1837, comme dans le bon vieux temps.", 0L, "ceintureflechee", null, null, 85.86m, 29.99m, 1L, 0L, 4, "Ceinture flèchée" }, { 2, "Linge", "Parce que ça sent la coupe!", 0L, "pantouflesCH", null, null, 15.64m, 9.99m, 54L, 0L, 0, "Pantoufles du Canadien en Phentex" }, { 3, "Homme", "On ne lui ferait pas mal, en tout cas!!", 0L, "jeanlucmongrain", null, null, 1453.12m, 999.99m, 1L, 0L, 3, "Jean-Luc Mongrain" }, { 4, "Linge", "Tellement simple et comfortable.", 0L, "tshirt", null, null, 12.12m, 9.99m, 143L, 0L, 0, "T-Shirt" }, { 5, "Vêtement d'extérieur", "Deux pour un!", 0L, "mitaines", null, null, 8.18m, 6.99m, 1423L, 0L, 0, "Mitaines" }, { 6, "Vêtement d'extérieur", "Deux pour un!", 0L, "foulard", null, null, 10.56m, 8.99m, 14L, 0L, 4, "Foulard" }, { 7, "Sous-Vêtement", "Pour garder le p'tit bout au chaud.", 0L, "kokin", null, null, 15.45m, 12.99m, 144L, 0L, 4, "Jock-Strap en phentex" }, { 8, "Sous-Vêtement", "Pour garder l'absence de p'tit bout au chaud.", 0L, "kokin", null, null, 15.45m, 12.99m, 224L, 0L, 4, "Jock-Strap féminin en phentex" }, { 9, "Alien", "En chiffon.", 0L, "bibi", null, null, 1045.45m, 1023.99m, 1L, 0L, 3, "Bibi" }, { 10, "Vêtement d'extérieur", "En chiffon.", 0L, "tuque", null, null, 15.45m, 12.99m, 1L, 0L, 0, "Tuque en laine" }, { 11, "Vêtement d'extérieur", "Pour se faire taper dessus avec une poêle à frire tout en restant au chaud.", 0L, "bonhomme", null, null, 145.45m, 123.99m, 1L, 0L, 4, "Habit de Bonhomme Carnaval" }, { 12, "Autre", "Pour se pêter la fiole avec style.", 0L, "gauze", null, null, 145.45m, 123.99m, 0L, 0L, 1, "Gauze en phentex" }, { 13, "Homme", "En chiffon.", 0L, "jesus", null, null, 145.45m, 123.99m, 1L, 0L, 3, "Petit Jésus de plâtre" }, { 14, "Autre", "À écouter dans l'habit de Bonhomme Carnaval tant que possible.", 0L, "vhs", null, null, 3.45m, 1.99m, 164363L, 0L, 3, "VHS de la Guerre des Tuques" }, { 15, "Linge", "(N'est pas réellement pare-balle).", 0L, "chandailquetaine", null, null, 1435.45m, 1223.99m, 18L, 0L, 3, "Gilet pare-balle en laine" }, { 16, "Autre", "Pour s'éffoirer le nez dedans.", 0L, "doudou", null, null, 14.45m, 13.99m, 14L, 0L, 0, "Doudou" }, { 17, "Vêtements d'extérieur", "Pour avoir l'air thug en hiver.", 0L, "mitaines2", null, null, 9.45m, 8.99m, 16L, 0L, 0, "Mitaines pas de doigts" } }); migrationBuilder.InsertData( table: "AspNetUserRoles", columns: new[] { "RoleId", "UserId" }, values: new object[] { "1b7b9c55-c746-493a-a24f-3d5ca937298e", "ecf7503a-591c-454e-a824-048e10bd0474" }); migrationBuilder.InsertData( table: "AspNetUserRoles", columns: new[] { "RoleId", "UserId" }, values: new object[] { "c9e08b20-d8a5-473f-9f52-572eb23c12af", "ecf7503a-591c-454e-a824-048e10bd0474" }); migrationBuilder.CreateIndex( name: "IX_Addresses_InventoryUserId", table: "Addresses", column: "InventoryUserId"); migrationBuilder.CreateIndex( name: "IX_AspNetRoleClaims_RoleId", table: "AspNetRoleClaims", column: "RoleId"); migrationBuilder.CreateIndex( name: "RoleNameIndex", table: "AspNetRoles", column: "NormalizedName", unique: true, filter: "[NormalizedName] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AspNetUserClaims_UserId", table: "AspNetUserClaims", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_AspNetUserLogins_UserId", table: "AspNetUserLogins", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_AspNetUserRoles_RoleId", table: "AspNetUserRoles", column: "RoleId"); migrationBuilder.CreateIndex( name: "EmailIndex", table: "AspNetUsers", column: "NormalizedEmail"); migrationBuilder.CreateIndex( name: "UserNameIndex", table: "AspNetUsers", column: "NormalizedUserName", unique: true, filter: "[NormalizedUserName] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_Invoices_LinkedAccountId", table: "Invoices", column: "LinkedAccountId"); migrationBuilder.CreateIndex( name: "IX_Invoices_ShippingAddressId", table: "Invoices", column: "ShippingAddressId"); migrationBuilder.CreateIndex( name: "IX_ProductInvoice_InvoiceModelId", table: "ProductInvoice", column: "InvoiceModelId"); migrationBuilder.CreateIndex( name: "IX_ProductInvoice_ProductId", table: "ProductInvoice", column: "ProductId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AspNetRoleClaims"); migrationBuilder.DropTable( name: "AspNetUserClaims"); migrationBuilder.DropTable( name: "AspNetUserLogins"); migrationBuilder.DropTable( name: "AspNetUserRoles"); migrationBuilder.DropTable( name: "AspNetUserTokens"); migrationBuilder.DropTable( name: "ProductInvoice"); migrationBuilder.DropTable( name: "AspNetRoles"); migrationBuilder.DropTable( name: "Invoices"); migrationBuilder.DropTable( name: "Products"); migrationBuilder.DropTable( name: "Addresses"); migrationBuilder.DropTable( name: "AspNetUsers"); } } }