using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elecciones.Database.Migrations { /// public partial class MakeEstadoGeneralKeyComposite : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropPrimaryKey( name: "PK_EstadosRecuentosGenerales", table: "EstadosRecuentosGenerales"); migrationBuilder.AlterColumn( name: "PorcentajeVotos", table: "ResultadosVotos", type: "decimal(18,4)", precision: 18, scale: 4, nullable: false, oldClrType: typeof(decimal), oldType: "decimal(18,2)"); migrationBuilder.AddColumn( name: "CategoriaId", table: "EstadosRecuentosGenerales", type: "int", nullable: false, defaultValue: 0); migrationBuilder.AlterColumn( name: "VotosRecurridosPorcentaje", table: "EstadosRecuentos", type: "decimal(18,4)", precision: 18, scale: 4, nullable: false, oldClrType: typeof(decimal), oldType: "decimal(18,2)"); migrationBuilder.AlterColumn( name: "VotosNulosPorcentaje", table: "EstadosRecuentos", type: "decimal(18,4)", precision: 18, scale: 4, nullable: false, oldClrType: typeof(decimal), oldType: "decimal(18,2)"); migrationBuilder.AlterColumn( name: "VotosEnBlancoPorcentaje", table: "EstadosRecuentos", type: "decimal(18,4)", precision: 18, scale: 4, nullable: false, oldClrType: typeof(decimal), oldType: "decimal(18,2)"); migrationBuilder.AddPrimaryKey( name: "PK_EstadosRecuentosGenerales", table: "EstadosRecuentosGenerales", columns: new[] { "AmbitoGeograficoId", "CategoriaId" }); migrationBuilder.CreateIndex( name: "IX_EstadosRecuentosGenerales_CategoriaId", table: "EstadosRecuentosGenerales", column: "CategoriaId"); migrationBuilder.AddForeignKey( name: "FK_EstadosRecuentosGenerales_CategoriasElectorales_CategoriaId", table: "EstadosRecuentosGenerales", column: "CategoriaId", principalTable: "CategoriasElectorales", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_EstadosRecuentosGenerales_CategoriasElectorales_CategoriaId", table: "EstadosRecuentosGenerales"); migrationBuilder.DropPrimaryKey( name: "PK_EstadosRecuentosGenerales", table: "EstadosRecuentosGenerales"); migrationBuilder.DropIndex( name: "IX_EstadosRecuentosGenerales_CategoriaId", table: "EstadosRecuentosGenerales"); migrationBuilder.DropColumn( name: "CategoriaId", table: "EstadosRecuentosGenerales"); migrationBuilder.AlterColumn( name: "PorcentajeVotos", table: "ResultadosVotos", type: "decimal(18,2)", nullable: false, oldClrType: typeof(decimal), oldType: "decimal(18,4)", oldPrecision: 18, oldScale: 4); migrationBuilder.AlterColumn( name: "VotosRecurridosPorcentaje", table: "EstadosRecuentos", type: "decimal(18,2)", nullable: false, oldClrType: typeof(decimal), oldType: "decimal(18,4)", oldPrecision: 18, oldScale: 4); migrationBuilder.AlterColumn( name: "VotosNulosPorcentaje", table: "EstadosRecuentos", type: "decimal(18,2)", nullable: false, oldClrType: typeof(decimal), oldType: "decimal(18,4)", oldPrecision: 18, oldScale: 4); migrationBuilder.AlterColumn( name: "VotosEnBlancoPorcentaje", table: "EstadosRecuentos", type: "decimal(18,2)", nullable: false, oldClrType: typeof(decimal), oldType: "decimal(18,4)", oldPrecision: 18, oldScale: 4); migrationBuilder.AddPrimaryKey( name: "PK_EstadosRecuentosGenerales", table: "EstadosRecuentosGenerales", column: "AmbitoGeograficoId"); } } }