using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace LiteCharms.Features.TechShop.Postgres.Migrations { /// public partial class FixedLeadCustomerRelationship : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Leads_Customer_CustomerId", table: "Leads"); migrationBuilder.DropForeignKey( name: "FK_Leads_Customers_CustomerId1", table: "Leads"); migrationBuilder.DropForeignKey( name: "FK_ShoppingCartItems_ProductPrices_ProductPriceId1", table: "ShoppingCartItems"); migrationBuilder.DropForeignKey( name: "FK_ShoppingCartItems_ShoppingCarts_ShoppingCartId1", table: "ShoppingCartItems"); migrationBuilder.DropTable( name: "Customer"); migrationBuilder.DropIndex( name: "IX_ShoppingCartItems_ProductPriceId1", table: "ShoppingCartItems"); migrationBuilder.DropIndex( name: "IX_ShoppingCartItems_ShoppingCartId1", table: "ShoppingCartItems"); migrationBuilder.DropIndex( name: "IX_Leads_CustomerId1", table: "Leads"); migrationBuilder.DropColumn( name: "ProductPriceId1", table: "ShoppingCartItems"); migrationBuilder.DropColumn( name: "ShoppingCartId1", table: "ShoppingCartItems"); migrationBuilder.DropColumn( name: "CustomerId1", table: "Leads"); migrationBuilder.AddForeignKey( name: "FK_Leads_Customers_CustomerId", table: "Leads", column: "CustomerId", principalTable: "Customers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Leads_Customers_CustomerId", table: "Leads"); migrationBuilder.AddColumn( name: "ProductPriceId1", table: "ShoppingCartItems", type: "uuid", nullable: true); migrationBuilder.AddColumn( name: "ShoppingCartId1", table: "ShoppingCartItems", type: "uuid", nullable: true); migrationBuilder.AddColumn( name: "CustomerId1", table: "Leads", type: "uuid", nullable: true); migrationBuilder.CreateTable( name: "Customer", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Active = table.Column(type: "boolean", nullable: false), Address = table.Column(type: "text", nullable: true), City = table.Column(type: "text", nullable: true), Company = table.Column(type: "text", nullable: true), Country = table.Column(type: "text", nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), Discord = table.Column(type: "text", nullable: true), Email = table.Column(type: "text", nullable: true), LastName = table.Column(type: "text", nullable: true), LinkedIn = table.Column(type: "text", nullable: true), Name = table.Column(type: "text", nullable: true), Phone = table.Column(type: "text", nullable: true), PostalCode = table.Column(type: "text", nullable: true), Region = table.Column(type: "text", nullable: true), Slack = table.Column(type: "text", nullable: true), Tax = table.Column(type: "text", nullable: true), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), Website = table.Column(type: "text", nullable: true), Whatsapp = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Customer", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_ShoppingCartItems_ProductPriceId1", table: "ShoppingCartItems", column: "ProductPriceId1"); migrationBuilder.CreateIndex( name: "IX_ShoppingCartItems_ShoppingCartId1", table: "ShoppingCartItems", column: "ShoppingCartId1"); migrationBuilder.CreateIndex( name: "IX_Leads_CustomerId1", table: "Leads", column: "CustomerId1"); migrationBuilder.AddForeignKey( name: "FK_Leads_Customer_CustomerId", table: "Leads", column: "CustomerId", principalTable: "Customer", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_Leads_Customers_CustomerId1", table: "Leads", column: "CustomerId1", principalTable: "Customers", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_ShoppingCartItems_ProductPrices_ProductPriceId1", table: "ShoppingCartItems", column: "ProductPriceId1", principalTable: "ProductPrices", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_ShoppingCartItems_ShoppingCarts_ShoppingCartId1", table: "ShoppingCartItems", column: "ShoppingCartId1", principalTable: "ShoppingCarts", principalColumn: "Id"); } } }