New Migration

This commit is contained in:
GuiNerd
2019-09-22 09:00:10 -03:00
parent 07230df64b
commit f9c65d9a91
33 changed files with 1199 additions and 198 deletions

View File

@ -1,84 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace GerenciaProjetos.Migrations
{
public partial class _2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<TimeSpan>(
name: "TempoGasto",
table: "DesenvolvedorRequisito",
nullable: false,
defaultValue: new TimeSpan(0, 0, 0, 0, 0));
migrationBuilder.AddColumn<int>(
name: "CriadorId",
table: "Bugs",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<DateTime>(
name: "DataCadastro",
table: "Bugs",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<bool>(
name: "FoiResolvido",
table: "Bugs",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<string>(
name: "Prioridade",
table: "Bugs",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Bugs_CriadorId",
table: "Bugs",
column: "CriadorId");
migrationBuilder.AddForeignKey(
name: "FK_Bugs_Desenvolvedores_CriadorId",
table: "Bugs",
column: "CriadorId",
principalTable: "Desenvolvedores",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Bugs_Desenvolvedores_CriadorId",
table: "Bugs");
migrationBuilder.DropIndex(
name: "IX_Bugs_CriadorId",
table: "Bugs");
migrationBuilder.DropColumn(
name: "TempoGasto",
table: "DesenvolvedorRequisito");
migrationBuilder.DropColumn(
name: "CriadorId",
table: "Bugs");
migrationBuilder.DropColumn(
name: "DataCadastro",
table: "Bugs");
migrationBuilder.DropColumn(
name: "FoiResolvido",
table: "Bugs");
migrationBuilder.DropColumn(
name: "Prioridade",
table: "Bugs");
}
}
}

View File

@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace GerenciaProjetos.Migrations
{
[DbContext(typeof(GerenciaContext))]
[Migration("20190921210546_1")]
[Migration("20190922115736_1")]
partial class _1
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -21,11 +21,26 @@ namespace GerenciaProjetos.Migrations
modelBuilder.Entity("GerenciaProjetos.Models.Bug", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("CriadorId");
b.Property<DateTime>("DataCadastro");
b.Property<int>("DesenvolvedorId");
b.Property<bool>("FoiResolvido");
b.Property<string>("Prioridade");
b.Property<int>("RequisitoId");
b.HasKey("DesenvolvedorId", "RequisitoId");
b.HasKey("Id");
b.HasIndex("CriadorId");
b.HasIndex("DesenvolvedorId");
b.HasIndex("RequisitoId");
@ -131,6 +146,11 @@ namespace GerenciaProjetos.Migrations
modelBuilder.Entity("GerenciaProjetos.Models.Bug", b =>
{
b.HasOne("GerenciaProjetos.Models.Desenvolvedor", "Criador")
.WithMany()
.HasForeignKey("CriadorId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("GerenciaProjetos.Models.Desenvolvedor", "Desenvolvedor")
.WithMany()
.HasForeignKey("DesenvolvedorId")

View File

@ -91,12 +91,24 @@ namespace GerenciaProjetos.Migrations
name: "Bugs",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DesenvolvedorId = table.Column<int>(nullable: false),
RequisitoId = table.Column<int>(nullable: false)
RequisitoId = table.Column<int>(nullable: false),
Prioridade = table.Column<string>(nullable: true),
DataCadastro = table.Column<DateTime>(nullable: false),
CriadorId = table.Column<int>(nullable: false),
FoiResolvido = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Bugs", x => new { x.DesenvolvedorId, x.RequisitoId });
table.PrimaryKey("PK_Bugs", x => x.Id);
table.ForeignKey(
name: "FK_Bugs_Desenvolvedores_CriadorId",
column: x => x.CriadorId,
principalTable: "Desenvolvedores",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Bugs_Desenvolvedores_DesenvolvedorId",
column: x => x.DesenvolvedorId,
@ -135,6 +147,16 @@ namespace GerenciaProjetos.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Bugs_CriadorId",
table: "Bugs",
column: "CriadorId");
migrationBuilder.CreateIndex(
name: "IX_Bugs_DesenvolvedorId",
table: "Bugs",
column: "DesenvolvedorId");
migrationBuilder.CreateIndex(
name: "IX_Bugs_RequisitoId",
table: "Bugs",

View File

@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace GerenciaProjetos.Migrations
{
[DbContext(typeof(GerenciaContext))]
[Migration("20190921210818_2")]
[Migration("20190922115947_2")]
partial class _2
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -21,22 +21,27 @@ namespace GerenciaProjetos.Migrations
modelBuilder.Entity("GerenciaProjetos.Models.Bug", b =>
{
b.Property<int>("DesenvolvedorId");
b.Property<int>("RequisitoId");
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("CriadorId");
b.Property<DateTime>("DataCadastro");
b.Property<int>("DesenvolvedorId");
b.Property<bool>("FoiResolvido");
b.Property<string>("Prioridade");
b.HasKey("DesenvolvedorId", "RequisitoId");
b.Property<int>("RequisitoId");
b.HasKey("Id");
b.HasIndex("CriadorId");
b.HasIndex("DesenvolvedorId");
b.HasIndex("RequisitoId");
b.ToTable("Bugs");

View File

@ -0,0 +1,24 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace GerenciaProjetos.Migrations
{
public partial class _2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<TimeSpan>(
name: "TempoGasto",
table: "DesenvolvedorRequisito",
nullable: false,
defaultValue: new TimeSpan(0, 0, 0, 0, 0));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "TempoGasto",
table: "DesenvolvedorRequisito");
}
}
}

View File

@ -19,22 +19,27 @@ namespace GerenciaProjetos.Migrations
modelBuilder.Entity("GerenciaProjetos.Models.Bug", b =>
{
b.Property<int>("DesenvolvedorId");
b.Property<int>("RequisitoId");
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("CriadorId");
b.Property<DateTime>("DataCadastro");
b.Property<int>("DesenvolvedorId");
b.Property<bool>("FoiResolvido");
b.Property<string>("Prioridade");
b.HasKey("DesenvolvedorId", "RequisitoId");
b.Property<int>("RequisitoId");
b.HasKey("Id");
b.HasIndex("CriadorId");
b.HasIndex("DesenvolvedorId");
b.HasIndex("RequisitoId");
b.ToTable("Bugs");