using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace LiteCharms.Infrastructure.Database.Migrations { /// public partial class AddedPackages : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Package", columns: table => new { Id = table.Column(type: "uuid", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), Name = table.Column(type: "text", nullable: false), Description = table.Column(type: "text", nullable: false), Active = table.Column(type: "boolean", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Package", x => x.Id); }); migrationBuilder.CreateTable( name: "PackageItem", columns: table => new { Id = table.Column(type: "uuid", nullable: false), PackageId1 = table.Column(type: "uuid", nullable: true), PackageId = table.Column(type: "uuid", nullable: false), ProductPriceId = table.Column(type: "uuid", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), Active = table.Column(type: "boolean", nullable: false) }, constraints: table => { table.PrimaryKey("PK_PackageItem", x => x.Id); table.ForeignKey( name: "FK_PackageItem_Package_PackageId", column: x => x.PackageId, principalTable: "Package", principalColumn: "Id"); table.ForeignKey( name: "FK_PackageItem_Package_PackageId1", column: x => x.PackageId1, principalTable: "Package", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "ShoppingCartPackage", columns: table => new { Id = table.Column(type: "uuid", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), ShoppingCartId = table.Column(type: "uuid", nullable: false), PackageId = table.Column(type: "uuid", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ShoppingCartPackage", x => x.Id); table.ForeignKey( name: "FK_ShoppingCartPackage_Package_PackageId", column: x => x.PackageId, principalTable: "Package", principalColumn: "Id"); table.ForeignKey( name: "FK_ShoppingCartPackage_ShoppingCart_ShoppingCartId", column: x => x.ShoppingCartId, principalTable: "ShoppingCart", principalColumn: "Id"); }); migrationBuilder.CreateIndex( name: "IX_PackageItem_PackageId", table: "PackageItem", column: "PackageId"); migrationBuilder.CreateIndex( name: "IX_PackageItem_PackageId1", table: "PackageItem", column: "PackageId1"); migrationBuilder.CreateIndex( name: "IX_ShoppingCartPackage_PackageId", table: "ShoppingCartPackage", column: "PackageId"); migrationBuilder.CreateIndex( name: "IX_ShoppingCartPackage_ShoppingCartId", table: "ShoppingCartPackage", column: "ShoppingCartId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "PackageItem"); migrationBuilder.DropTable( name: "ShoppingCartPackage"); migrationBuilder.DropTable( name: "Package"); } } }