Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ConsoleApp1/CargaHoras.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class CargaHoras
{
public int CargaHorasId { get; set; }
public int UsuarioId { get; set; }
public virtual Usuario Usuario { get; set; }
public int ProyectoId { get; set; }
public virtual Proyecto Proyecto { get; set; }
public decimal HorasTrabajadas { get; set; }
public string Descripcion { get; set; }
public DateTime Fecha { get; set; }
}
19 changes: 19 additions & 0 deletions ConsoleApp1/ConsoleApp1.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.13">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
143 changes: 143 additions & 0 deletions ConsoleApp1/Migrations/20231101125250_v1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 105 additions & 0 deletions ConsoleApp1/Migrations/20231101125250_v1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace ConsoleApp1.Migrations
{
/// <inheritdoc />
public partial class v1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Proyectos",
columns: table => new
{
ProyectoId = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Nombre = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Proyectos", x => x.ProyectoId);
});

migrationBuilder.CreateTable(
name: "Usuarios",
columns: table => new
{
UsuarioId = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Nombre = table.Column<string>(type: "nvarchar(max)", nullable: false),
ProyectoId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Usuarios", x => x.UsuarioId);
table.ForeignKey(
name: "FK_Usuarios_Proyectos_ProyectoId",
column: x => x.ProyectoId,
principalTable: "Proyectos",
principalColumn: "ProyectoId",
onDelete: ReferentialAction.Restrict);
});

migrationBuilder.CreateTable(
name: "CargasHoras",
columns: table => new
{
CargaHorasId = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
UsuarioId = table.Column<int>(type: "int", nullable: false),
ProyectoId = table.Column<int>(type: "int", nullable: false),
HorasTrabajadas = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
Descripcion = table.Column<string>(type: "nvarchar(max)", nullable: false),
Fecha = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CargasHoras", x => x.CargaHorasId);
table.ForeignKey(
name: "FK_CargasHoras_Proyectos_ProyectoId",
column: x => x.ProyectoId,
principalTable: "Proyectos",
principalColumn: "ProyectoId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CargasHoras_Usuarios_UsuarioId",
column: x => x.UsuarioId,
principalTable: "Usuarios",
principalColumn: "UsuarioId",
onDelete: ReferentialAction.Restrict);
});

migrationBuilder.CreateIndex(
name: "IX_CargasHoras_ProyectoId",
table: "CargasHoras",
column: "ProyectoId");

migrationBuilder.CreateIndex(
name: "IX_CargasHoras_UsuarioId",
table: "CargasHoras",
column: "UsuarioId");

migrationBuilder.CreateIndex(
name: "IX_Usuarios_ProyectoId",
table: "Usuarios",
column: "ProyectoId");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CargasHoras");

migrationBuilder.DropTable(
name: "Usuarios");

migrationBuilder.DropTable(
name: "Proyectos");
}
}
}
Loading