using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Entidades.Migrations { /// public partial class Ahora_saque_el_identity : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "DEFECTO", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), DESCRIPCION = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), ESTAARREGLADO = table.Column(type: "bit", nullable: false), COSTO = table.Column(type: "decimal(12,2)", nullable: false), PAGAINQUILINO = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK__DEFECTO__3214EC27E043B726", x => x.ID); }); migrationBuilder.CreateTable( name: "GARANTIA", columns: table => new { DNI = table.Column(type: "bigint", nullable: false), LUGARTRABAJO = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), DOMICILIOLABORAL = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), CUIL = table.Column(type: "bigint", nullable: false), NOMBRE = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), APELLIDO = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), EMAIL = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), CELULAR = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), DOMICILIO = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), CONTRASENA = table.Column(type: "varbinary(64)", maxLength: 64, nullable: true) }, constraints: table => { table.PrimaryKey("PK__GARANTIA__C035B8DC8E6BAB11", x => x.DNI); }); migrationBuilder.CreateTable( name: "GRUPO", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), NOMBRE = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: false) }, constraints: table => { table.PrimaryKey("PK__GRUPO__3214EC2778FB625D", x => x.ID); }); migrationBuilder.CreateTable( name: "INQUILINO", columns: table => new { DNI = table.Column(type: "bigint", nullable: false), CUIL = table.Column(type: "bigint", nullable: false), NOMBRE = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), APELLIDO = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), EMAIL = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), CELULAR = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), DOMICILIO = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), CONTRASENA = table.Column(type: "varbinary(64)", maxLength: 64, nullable: true) }, constraints: table => { table.PrimaryKey("PK__INQUILIN__C035B8DC051D254F", x => x.DNI); }); migrationBuilder.CreateTable( name: "PROPIETARIO", columns: table => new { DNI = table.Column(type: "bigint", nullable: false), CUIL = table.Column(type: "bigint", nullable: false), NOMBRE = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), APELLIDO = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), EMAIL = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), CELULAR = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), DOMICILIO = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), CONTRASENA = table.Column(type: "varbinary(64)", maxLength: 64, nullable: true) }, constraints: table => { table.PrimaryKey("PK__PROPIETA__C035B8DC136518F4", x => x.DNI); }); migrationBuilder.CreateTable( name: "RECIBO", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), MES = table.Column(type: "int", nullable: false), MONTO = table.Column(type: "decimal(12,2)", nullable: false) }, constraints: table => { table.PrimaryKey("PK__RECIBO__3214EC277135BC90", x => x.ID); }); migrationBuilder.CreateTable( name: "ROL", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), DESCIPCION = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: false) }, constraints: table => { table.PrimaryKey("PK__ROL__3214EC27DE6A34BE", x => x.ID); }); migrationBuilder.CreateTable( name: "SERVICIO", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), DESCRIPCION = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false) }, constraints: table => { table.PrimaryKey("PK__SERVICIO__3214EC27468ADAA2", x => x.ID); }); migrationBuilder.CreateTable( name: "GRUPO_GARANTIA", columns: table => new { IDGRUPO = table.Column(type: "int", nullable: false), DNIGARANTIA = table.Column(type: "bigint", nullable: false) }, constraints: table => { table.PrimaryKey("PK__GRUPO_GA__F9F1F0A3A5F02DDF", x => new { x.IDGRUPO, x.DNIGARANTIA }); table.ForeignKey( name: "FK__GRUPO_GAR__DNIGA__46B27FE2", column: x => x.DNIGARANTIA, principalTable: "GARANTIA", principalColumn: "DNI"); table.ForeignKey( name: "FK__GRUPO_GAR__IDGRU__45BE5BA9", column: x => x.IDGRUPO, principalTable: "GRUPO", principalColumn: "ID"); }); migrationBuilder.CreateTable( name: "GRUPO_INQUILINO", columns: table => new { IDGRUPO = table.Column(type: "int", nullable: false), DNIINQUILINO = table.Column(type: "bigint", nullable: false) }, constraints: table => { table.PrimaryKey("PK__GRUPO_IN__FC8CB8C5DC668E46", x => new { x.IDGRUPO, x.DNIINQUILINO }); table.ForeignKey( name: "FK__GRUPO_INQ__DNIIN__40058253", column: x => x.DNIINQUILINO, principalTable: "INQUILINO", principalColumn: "DNI"); table.ForeignKey( name: "FK__GRUPO_INQ__IDGRU__3F115E1A", column: x => x.IDGRUPO, principalTable: "GRUPO", principalColumn: "ID"); }); migrationBuilder.CreateTable( name: "GRUPO_PROPIETARIO", columns: table => new { IDGRUPO = table.Column(type: "int", nullable: false), DNIPROPIETARIO = table.Column(type: "bigint", nullable: false) }, constraints: table => { table.PrimaryKey("PK__GRUPO_PR__D5806AB6196637D1", x => new { x.IDGRUPO, x.DNIPROPIETARIO }); table.ForeignKey( name: "FK__GRUPO_PRO__DNIPR__4A8310C6", column: x => x.DNIPROPIETARIO, principalTable: "PROPIETARIO", principalColumn: "DNI"); table.ForeignKey( name: "FK__GRUPO_PRO__IDGRU__498EEC8D", column: x => x.IDGRUPO, principalTable: "GRUPO", principalColumn: "ID"); }); migrationBuilder.CreateTable( name: "PROPIEDADES", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), DNI = table.Column(type: "bigint", nullable: true), UBICACION = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), CANTHABITACIONES = table.Column(type: "int", nullable: true), TIENECOCINA = table.Column(type: "bit", nullable: true), PISO = table.Column(type: "int", nullable: true), LETRA = table.Column(type: "varchar(2)", unicode: false, maxLength: 2, nullable: true) }, constraints: table => { table.PrimaryKey("PK__PROPIEDA__3214EC2739D8661A", x => x.ID); table.ForeignKey( name: "FK__PROPIEDADES__DNI__44FF419A", column: x => x.DNI, principalTable: "PROPIETARIO", principalColumn: "DNI"); }); migrationBuilder.CreateTable( name: "CANON", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), MES = table.Column(type: "int", nullable: false), MONTO = table.Column(type: "decimal(12,2)", nullable: false), PAGADO = table.Column(type: "bit", nullable: false), IDRECIBO = table.Column(type: "int", nullable: true) }, constraints: table => { table.PrimaryKey("PK__CANON__3214EC27DAD9CBBD", x => x.ID); table.ForeignKey( name: "FK__CANON__IDRECIBO__540C7B00", column: x => x.IDRECIBO, principalTable: "RECIBO", principalColumn: "ID"); }); migrationBuilder.CreateTable( name: "GRUPO_ROL", columns: table => new { IDGRUPO = table.Column(type: "int", nullable: false), IDROL = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK__GRUPO_RO__5035D4A88EFB1AF1", x => new { x.IDGRUPO, x.IDROL }); table.ForeignKey( name: "FK__GRUPO_ROL__IDGRU__3B40CD36", column: x => x.IDGRUPO, principalTable: "GRUPO", principalColumn: "ID"); table.ForeignKey( name: "FK__GRUPO_ROL__IDROL__3C34F16F", column: x => x.IDROL, principalTable: "ROL", principalColumn: "ID"); }); migrationBuilder.CreateTable( name: "CONTRATO", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), FECHAINICIO = table.Column(type: "datetime", nullable: false), INDICEACTUALIZACION = table.Column(type: "decimal(12,2)", nullable: false), MONTO = table.Column(type: "decimal(12,2)", nullable: false), DURACIONMESES = table.Column(type: "int", nullable: false), DNIINQUILINO = table.Column(type: "bigint", nullable: true), DNIPROPIETARIO = table.Column(type: "bigint", nullable: true), IDPROPIEDAD = table.Column(type: "int", nullable: true) }, constraints: table => { table.PrimaryKey("PK__CONTRATO__3214EC27314E1A88", x => x.ID); table.ForeignKey( name: "FK__CONTRATO__DNIINQ__01142BA1", column: x => x.DNIINQUILINO, principalTable: "INQUILINO", principalColumn: "DNI"); table.ForeignKey( name: "FK__CONTRATO__DNIPRO__02084FDA", column: x => x.DNIPROPIETARIO, principalTable: "PROPIETARIO", principalColumn: "DNI"); table.ForeignKey( name: "FK__CONTRATO__IDPROP__02FC7413", column: x => x.IDPROPIEDAD, principalTable: "PROPIEDADES", principalColumn: "ID"); }); migrationBuilder.CreateTable( name: "SERVICIO_PROPIEDADES", columns: table => new { IDPROPIEDAD = table.Column(type: "int", nullable: true), IDSERVICIO = table.Column(type: "int", nullable: true) }, constraints: table => { table.ForeignKey( name: "FK__SERVICIO___IDPRO__49C3F6B7", column: x => x.IDPROPIEDAD, principalTable: "PROPIEDADES", principalColumn: "ID"); table.ForeignKey( name: "FK__SERVICIO___IDSER__4AB81AF0", column: x => x.IDSERVICIO, principalTable: "SERVICIO", principalColumn: "ID"); }); migrationBuilder.CreateTable( name: "CONTRATO_CANON", columns: table => new { IDCONTRATO = table.Column(type: "int", nullable: false), IDCANON = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK__CONTRATO__EAB1D189E5C1886B", x => new { x.IDCONTRATO, x.IDCANON }); table.ForeignKey( name: "FK__CONTRATO___IDCAN__3493CFA7", column: x => x.IDCANON, principalTable: "CANON", principalColumn: "ID"); table.ForeignKey( name: "FK__CONTRATO___IDCON__339FAB6E", column: x => x.IDCONTRATO, principalTable: "CONTRATO", principalColumn: "ID"); }); migrationBuilder.CreateTable( name: "CONTRATO_DEFECTO", columns: table => new { IDCONTRATO = table.Column(type: "int", nullable: false), IDDEFECTO = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK__CONTRATO__3A449B2F445D3682", x => new { x.IDCONTRATO, x.IDDEFECTO }); table.ForeignKey( name: "FK__CONTRATO___IDCON__2B0A656D", column: x => x.IDCONTRATO, principalTable: "CONTRATO", principalColumn: "ID"); table.ForeignKey( name: "FK__CONTRATO___IDDEF__2BFE89A6", column: x => x.IDDEFECTO, principalTable: "DEFECTO", principalColumn: "ID"); }); migrationBuilder.CreateTable( name: "CONTRATO_GARANTIA", columns: table => new { IDCONTRATO = table.Column(type: "int", nullable: false), DNIGARANTIA = table.Column(type: "bigint", nullable: false) }, constraints: table => { table.PrimaryKey("PK__CONTRATO__08D9A618A2AF4EE5", x => new { x.IDCONTRATO, x.DNIGARANTIA }); table.ForeignKey( name: "FK__CONTRATO___DNIGA__282DF8C2", column: x => x.DNIGARANTIA, principalTable: "GARANTIA", principalColumn: "DNI"); table.ForeignKey( name: "FK__CONTRATO___IDCON__2739D489", column: x => x.IDCONTRATO, principalTable: "CONTRATO", principalColumn: "ID"); }); migrationBuilder.CreateIndex( name: "IX_CANON_IDRECIBO", table: "CANON", column: "IDRECIBO"); migrationBuilder.CreateIndex( name: "IX_CONTRATO_DNIINQUILINO", table: "CONTRATO", column: "DNIINQUILINO"); migrationBuilder.CreateIndex( name: "IX_CONTRATO_DNIPROPIETARIO", table: "CONTRATO", column: "DNIPROPIETARIO"); migrationBuilder.CreateIndex( name: "IX_CONTRATO_IDPROPIEDAD", table: "CONTRATO", column: "IDPROPIEDAD"); migrationBuilder.CreateIndex( name: "IX_CONTRATO_CANON_IDCANON", table: "CONTRATO_CANON", column: "IDCANON"); migrationBuilder.CreateIndex( name: "IX_CONTRATO_DEFECTO_IDDEFECTO", table: "CONTRATO_DEFECTO", column: "IDDEFECTO"); migrationBuilder.CreateIndex( name: "IX_CONTRATO_GARANTIA_DNIGARANTIA", table: "CONTRATO_GARANTIA", column: "DNIGARANTIA"); migrationBuilder.CreateIndex( name: "UQ__GARANTIA__161CF724C0013CA1", table: "GARANTIA", column: "EMAIL", unique: true); migrationBuilder.CreateIndex( name: "UQ__GARANTIA__6758673E51796017", table: "GARANTIA", column: "CELULAR", unique: true); migrationBuilder.CreateIndex( name: "UQ__GARANTIA__F46C15900DA7BBE1", table: "GARANTIA", column: "CUIL", unique: true); migrationBuilder.CreateIndex( name: "IX_GRUPO_GARANTIA_DNIGARANTIA", table: "GRUPO_GARANTIA", column: "DNIGARANTIA"); migrationBuilder.CreateIndex( name: "IX_GRUPO_INQUILINO_DNIINQUILINO", table: "GRUPO_INQUILINO", column: "DNIINQUILINO"); migrationBuilder.CreateIndex( name: "IX_GRUPO_PROPIETARIO_DNIPROPIETARIO", table: "GRUPO_PROPIETARIO", column: "DNIPROPIETARIO"); migrationBuilder.CreateIndex( name: "IX_GRUPO_ROL_IDROL", table: "GRUPO_ROL", column: "IDROL"); migrationBuilder.CreateIndex( name: "UQ__INQUILIN__161CF724192A8FBF", table: "INQUILINO", column: "EMAIL", unique: true); migrationBuilder.CreateIndex( name: "UQ__INQUILIN__6758673EB3CC90D6", table: "INQUILINO", column: "CELULAR", unique: true); migrationBuilder.CreateIndex( name: "UQ__INQUILIN__F46C1590EF9A325E", table: "INQUILINO", column: "CUIL", unique: true); migrationBuilder.CreateIndex( name: "IX_PROPIEDADES_DNI", table: "PROPIEDADES", column: "DNI"); migrationBuilder.CreateIndex( name: "UQ__PROPIETA__161CF7246E3AA1B6", table: "PROPIETARIO", column: "EMAIL", unique: true); migrationBuilder.CreateIndex( name: "UQ__PROPIETA__6758673E211BCB21", table: "PROPIETARIO", column: "CELULAR", unique: true); migrationBuilder.CreateIndex( name: "UQ__PROPIETA__F46C15901A8D2463", table: "PROPIETARIO", column: "CUIL", unique: true); migrationBuilder.CreateIndex( name: "UQ__SERVICIO__794449EF1A4F44FF", table: "SERVICIO", column: "DESCRIPCION", unique: true); migrationBuilder.CreateIndex( name: "IX_SERVICIO_PROPIEDADES_IDPROPIEDAD", table: "SERVICIO_PROPIEDADES", column: "IDPROPIEDAD"); migrationBuilder.CreateIndex( name: "IX_SERVICIO_PROPIEDADES_IDSERVICIO", table: "SERVICIO_PROPIEDADES", column: "IDSERVICIO"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "CONTRATO_CANON"); migrationBuilder.DropTable( name: "CONTRATO_DEFECTO"); migrationBuilder.DropTable( name: "CONTRATO_GARANTIA"); migrationBuilder.DropTable( name: "GRUPO_GARANTIA"); migrationBuilder.DropTable( name: "GRUPO_INQUILINO"); migrationBuilder.DropTable( name: "GRUPO_PROPIETARIO"); migrationBuilder.DropTable( name: "GRUPO_ROL"); migrationBuilder.DropTable( name: "SERVICIO_PROPIEDADES"); migrationBuilder.DropTable( name: "CANON"); migrationBuilder.DropTable( name: "DEFECTO"); migrationBuilder.DropTable( name: "CONTRATO"); migrationBuilder.DropTable( name: "GARANTIA"); migrationBuilder.DropTable( name: "GRUPO"); migrationBuilder.DropTable( name: "ROL"); migrationBuilder.DropTable( name: "SERVICIO"); migrationBuilder.DropTable( name: "RECIBO"); migrationBuilder.DropTable( name: "INQUILINO"); migrationBuilder.DropTable( name: "PROPIEDADES"); migrationBuilder.DropTable( name: "PROPIETARIO"); } } }