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