using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace line_gestao_api.Migrations { /// public partial class RemoveParcelamento : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "parcelamento_month_values"); migrationBuilder.DropTable( name: "parcelamento_lines"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "parcelamento_lines", columns: table => new { Id = table.Column(type: "uuid", nullable: false), AnoRef = table.Column(type: "integer", nullable: true), Cliente = table.Column(type: "character varying(120)", maxLength: 120, nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), Desconto = table.Column(type: "numeric", nullable: true), Item = table.Column(type: "integer", nullable: true), Linha = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), QtParcelas = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), ValorCheio = table.Column(type: "numeric", nullable: true), ValorComDesconto = table.Column(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(type: "uuid", nullable: false), ParcelamentoLineId = table.Column(type: "uuid", nullable: false), Competencia = table.Column(type: "timestamp with time zone", nullable: false), Valor = table.Column(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); } } }