using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace line_gestao_api.Migrations { /// public partial class AddParcelamentosTables : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ParcelamentoLines", columns: table => new { Id = table.Column(type: "uuid", nullable: false), TenantId = table.Column(type: "uuid", nullable: false), AnoRef = table.Column(type: "integer", nullable: true), Item = table.Column(type: "integer", nullable: true), Linha = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), Cliente = table.Column(type: "character varying(120)", maxLength: 120, nullable: true), QtParcelas = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), ParcelaAtual = table.Column(type: "integer", nullable: true), TotalParcelas = table.Column(type: "integer", nullable: true), ValorCheio = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), Desconto = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), ValorComDesconto = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ParcelamentoLines", x => x.Id); }); migrationBuilder.CreateTable( name: "ParcelamentoMonthValues", columns: table => new { Id = table.Column(type: "uuid", nullable: false), TenantId = table.Column(type: "uuid", nullable: false), ParcelamentoLineId = table.Column(type: "uuid", nullable: false), Competencia = table.Column(type: "date", nullable: false), Valor = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", 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_AnoRef_Item", table: "ParcelamentoLines", columns: new[] { "AnoRef", "Item" }, unique: true); migrationBuilder.CreateIndex( name: "IX_ParcelamentoLines_Linha", table: "ParcelamentoLines", column: "Linha"); migrationBuilder.CreateIndex( name: "IX_ParcelamentoLines_TenantId", table: "ParcelamentoLines", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_ParcelamentoMonthValues_ParcelamentoLineId_Competencia", table: "ParcelamentoMonthValues", columns: new[] { "ParcelamentoLineId", "Competencia" }, unique: true); migrationBuilder.CreateIndex( name: "IX_ParcelamentoMonthValues_TenantId", table: "ParcelamentoMonthValues", column: "TenantId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ParcelamentoMonthValues"); migrationBuilder.DropTable( name: "ParcelamentoLines"); } } }