115 lines
4.7 KiB
C#
115 lines
4.7 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace LiteCharms.Infrastructure.Database.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddedPackages : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Package",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
Name = table.Column<string>(type: "text", nullable: false),
|
|
Description = table.Column<string>(type: "text", nullable: false),
|
|
Active = table.Column<bool>(type: "boolean", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Package", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "PackageItem",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
PackageId1 = table.Column<Guid>(type: "uuid", nullable: true),
|
|
PackageId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
ProductPriceId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
Active = table.Column<bool>(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<Guid>(type: "uuid", nullable: false),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
ShoppingCartId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
PackageId = table.Column<Guid>(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");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "PackageItem");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "ShoppingCartPackage");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Package");
|
|
}
|
|
}
|
|
}
|