155 lines
7.6 KiB
C#
155 lines
7.6 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace LiteCharms.Infrastructure.Database.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Init : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Customer",
|
|
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),
|
|
Company = table.Column<string>(type: "text", nullable: true),
|
|
Name = table.Column<string>(type: "text", nullable: false),
|
|
LastName = table.Column<string>(type: "text", nullable: false),
|
|
Tax = table.Column<string>(type: "text", nullable: true),
|
|
Email = table.Column<string>(type: "text", nullable: false),
|
|
Discord = table.Column<string>(type: "text", nullable: true),
|
|
Slack = table.Column<string>(type: "text", nullable: true),
|
|
LinkedIn = table.Column<string>(type: "text", nullable: true),
|
|
Whatsapp = table.Column<string>(type: "text", nullable: true),
|
|
Website = table.Column<string>(type: "text", nullable: true),
|
|
Phone = table.Column<string>(type: "text", nullable: true),
|
|
Address = table.Column<string>(type: "text", nullable: true),
|
|
City = table.Column<string>(type: "text", nullable: true),
|
|
Region = table.Column<string>(type: "text", nullable: true),
|
|
Country = table.Column<string>(type: "text", nullable: true),
|
|
PostalCode = table.Column<string>(type: "text", nullable: true),
|
|
Active = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Customer", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Lead",
|
|
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),
|
|
GoogleClickId = table.Column<string>(type: "text", nullable: true),
|
|
WebClickId = table.Column<string>(type: "text", nullable: true),
|
|
AppClickId = table.Column<string>(type: "text", nullable: true),
|
|
CampaignId = table.Column<long>(type: "bigint", nullable: true),
|
|
AdGroupId = table.Column<long>(type: "bigint", nullable: true),
|
|
AdName = table.Column<long>(type: "bigint", nullable: true),
|
|
TargetId = table.Column<long>(type: "bigint", nullable: true),
|
|
FeedItemId = table.Column<long>(type: "bigint", nullable: true),
|
|
ClickLocation = table.Column<string>(type: "text", nullable: true),
|
|
AttribusionHash = table.Column<string>(type: "text", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Lead", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Order",
|
|
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),
|
|
LeadId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
ProductId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
ProductPriceId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Status = table.Column<int>(type: "integer", nullable: false),
|
|
Notes = table.Column<string>(type: "jsonb", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Order", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "OrderRefund",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
OrderId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Reason = table.Column<string>(type: "text", nullable: false),
|
|
Amount = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_OrderRefund", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Product",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Name = table.Column<string>(type: "text", nullable: false),
|
|
Description = table.Column<string>(type: "text", nullable: false),
|
|
Active = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Product", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "ProductPrice",
|
|
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),
|
|
ProductId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Price = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false),
|
|
Discount = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false),
|
|
Active = table.Column<bool>(type: "boolean", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_ProductPrice", x => x.Id);
|
|
});
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Customer");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Lead");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Order");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "OrderRefund");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Product");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "ProductPrice");
|
|
}
|
|
}
|
|
}
|