line-gestao-api/Migrations/20260113133045_RemoveParcel...

89 lines
3.8 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace line_gestao_api.Migrations
{
/// <inheritdoc />
public partial class RemoveParcelamentoV2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ParcelamentoMonthValues");
migrationBuilder.DropTable(
name: "ParcelamentoLines");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ParcelamentoLines",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Ano = table.Column<int>(type: "integer", nullable: false),
Cliente = table.Column<string>(type: "text", nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Desconto = table.Column<decimal>(type: "numeric", nullable: true),
Item = table.Column<int>(type: "integer", nullable: false),
Linha = table.Column<string>(type: "text", nullable: true),
QtParcelas = table.Column<string>(type: "text", nullable: true),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
ValorCheio = table.Column<decimal>(type: "numeric", nullable: true),
ValorComDesconto = table.Column<decimal>(type: "numeric", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ParcelamentoLines", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ParcelamentoMonthValues",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ParcelamentoLineId = table.Column<Guid>(type: "uuid", nullable: false),
Ano = table.Column<int>(type: "integer", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Mes = table.Column<int>(type: "integer", nullable: false),
Valor = table.Column<decimal>(type: "numeric", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ParcelamentoMonthValues", x => x.Id);
table.ForeignKey(
name: "FK_ParcelamentoMonthValues_ParcelamentoLines_ParcelamentoLineId",
column: x => x.ParcelamentoLineId,
principalTable: "ParcelamentoLines",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ParcelamentoLines_Cliente",
table: "ParcelamentoLines",
column: "Cliente");
migrationBuilder.CreateIndex(
name: "IX_ParcelamentoLines_Linha",
table: "ParcelamentoLines",
column: "Linha");
migrationBuilder.CreateIndex(
name: "IX_ParcelamentoMonthValues_Ano_Mes",
table: "ParcelamentoMonthValues",
columns: new[] { "Ano", "Mes" });
migrationBuilder.CreateIndex(
name: "IX_ParcelamentoMonthValues_ParcelamentoLineId",
table: "ParcelamentoMonthValues",
column: "ParcelamentoLineId");
}
}
}