using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SistemaGestionAcademias.Migrations { /// public partial class MigracionInicial : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Categorias", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Nombre = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), Descripcion = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), Estado = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Categorias", x => x.Id); }); migrationBuilder.CreateTable( name: "Instructores", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Nombres = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), Apellidos = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), Telefono = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), Correo = table.Column(type: "nvarchar(max)", nullable: false), Especialidad = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Instructores", x => x.Id); }); migrationBuilder.CreateTable( name: "Actividades", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Nombre = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), Descripcion = table.Column(type: "nvarchar(max)", nullable: true), FechaInicio = table.Column(type: "datetime2", nullable: false), FechaFin = table.Column(type: "datetime2", nullable: false), Activo = table.Column(type: "bit", nullable: false), CategoriaId = table.Column(type: "int", nullable: false), InstructorId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Actividades", x => x.Id); table.ForeignKey( name: "FK_Actividades_Categorias_CategoriaId", column: x => x.CategoriaId, principalTable: "Categorias", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Actividades_Instructores_InstructorId", column: x => x.InstructorId, principalTable: "Instructores", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Actividades_CategoriaId", table: "Actividades", column: "CategoriaId"); migrationBuilder.CreateIndex( name: "IX_Actividades_InstructorId", table: "Actividades", column: "InstructorId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Actividades"); migrationBuilder.DropTable( name: "Categorias"); migrationBuilder.DropTable( name: "Instructores"); } } }