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

97 lines
4.1 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace line_gestao_api.Migrations
{
/// <inheritdoc />
public partial class RemoveParcelamento : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "parcelamento_month_values");
migrationBuilder.DropTable(
name: "parcelamento_lines");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "parcelamento_lines",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
AnoRef = table.Column<int>(type: "integer", nullable: true),
Cliente = table.Column<string>(type: "character varying(120)", maxLength: 120, 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: true),
Linha = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true),
QtParcelas = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true),
ValorCheio = table.Column<decimal>(type: "numeric", nullable: true),
ValorComDesconto = table.Column<decimal>(type: "numeric", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_parcelamento_lines", x => x.Id);
});
migrationBuilder.CreateTable(
name: "parcelamento_month_values",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ParcelamentoLineId = table.Column<Guid>(type: "uuid", nullable: false),
Competencia = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Valor = table.Column<decimal>(type: "numeric", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_parcelamento_month_values", x => x.Id);
table.ForeignKey(
name: "FK_parcelamento_month_values_parcelamento_lines_ParcelamentoLi~",
column: x => x.ParcelamentoLineId,
principalTable: "parcelamento_lines",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_parcelamento_lines_AnoRef",
table: "parcelamento_lines",
column: "AnoRef");
migrationBuilder.CreateIndex(
name: "IX_parcelamento_lines_Cliente",
table: "parcelamento_lines",
column: "Cliente");
migrationBuilder.CreateIndex(
name: "IX_parcelamento_lines_Linha",
table: "parcelamento_lines",
column: "Linha");
migrationBuilder.CreateIndex(
name: "IX_parcelamento_month_values_Competencia",
table: "parcelamento_month_values",
column: "Competencia");
migrationBuilder.CreateIndex(
name: "IX_parcelamento_month_values_ParcelamentoLineId",
table: "parcelamento_month_values",
column: "ParcelamentoLineId");
migrationBuilder.CreateIndex(
name: "IX_parcelamento_month_values_ParcelamentoLineId_Competencia",
table: "parcelamento_month_values",
columns: new[] { "ParcelamentoLineId", "Competencia" },
unique: true);
}
}
}