Initial commit

This commit is contained in:
GuiNerd
2019-11-27 18:42:43 -03:00
commit 5fd7176543
1714 changed files with 171249 additions and 0 deletions

View File

@ -0,0 +1,167 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SitePi;
namespace SitePi.Migrations
{
[DbContext(typeof(AppContext))]
[Migration("20191022151100_1")]
partial class _1
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("SitePi.Models.Bot", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("FileBytes");
b.Property<string>("FileName");
b.Property<string>("Name")
.IsRequired();
b.Property<float>("PercentageA");
b.Property<float>("PercentageB");
b.Property<float>("PercentageC");
b.Property<float>("PercentageD");
b.Property<int>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Bots");
});
modelBuilder.Entity("SitePi.Models.Choice", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("ProfileId");
b.Property<int>("QuestionId");
b.Property<string>("Text")
.IsRequired();
b.HasKey("Id");
b.HasIndex("ProfileId");
b.HasIndex("QuestionId");
b.ToTable("Choices");
});
modelBuilder.Entity("SitePi.Models.Profile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired();
b.HasKey("Id");
b.ToTable("Profiles");
});
modelBuilder.Entity("SitePi.Models.Question", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("QuizId");
b.Property<string>("Text")
.IsRequired();
b.HasKey("Id");
b.HasIndex("QuizId");
b.ToTable("Questions");
});
modelBuilder.Entity("SitePi.Models.Quiz", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired();
b.HasKey("Id");
b.ToTable("Quizzes");
});
modelBuilder.Entity("SitePi.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(100);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(25);
b.Property<string>("PasswordHash")
.IsRequired()
.HasMaxLength(45);
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("SitePi.Models.Bot", b =>
{
b.HasOne("SitePi.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("SitePi.Models.Choice", b =>
{
b.HasOne("SitePi.Models.Profile", "Profile")
.WithMany()
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("SitePi.Models.Question", "Question")
.WithMany("Choices")
.HasForeignKey("QuestionId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("SitePi.Models.Question", b =>
{
b.HasOne("SitePi.Models.Quiz", "Quiz")
.WithMany("Questions")
.HasForeignKey("QuizId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,166 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace SitePi.Migrations
{
public partial class _1 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Profiles",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Profiles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Quizzes",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Quizzes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(maxLength: 25, nullable: false),
Email = table.Column<string>(maxLength: 100, nullable: false),
PasswordHash = table.Column<string>(maxLength: 45, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Questions",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Text = table.Column<string>(nullable: false),
QuizId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Questions", x => x.Id);
table.ForeignKey(
name: "FK_Questions_Quizzes_QuizId",
column: x => x.QuizId,
principalTable: "Quizzes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Bots",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(nullable: false),
UserId = table.Column<int>(nullable: false),
FileBytes = table.Column<string>(nullable: true),
FileName = table.Column<string>(nullable: true),
PercentageA = table.Column<float>(nullable: false),
PercentageB = table.Column<float>(nullable: false),
PercentageC = table.Column<float>(nullable: false),
PercentageD = table.Column<float>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Bots", x => x.Id);
table.ForeignKey(
name: "FK_Bots_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Choices",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Text = table.Column<string>(nullable: false),
QuestionId = table.Column<int>(nullable: false),
ProfileId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Choices", x => x.Id);
table.ForeignKey(
name: "FK_Choices_Profiles_ProfileId",
column: x => x.ProfileId,
principalTable: "Profiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Choices_Questions_QuestionId",
column: x => x.QuestionId,
principalTable: "Questions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Bots_UserId",
table: "Bots",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_Choices_ProfileId",
table: "Choices",
column: "ProfileId");
migrationBuilder.CreateIndex(
name: "IX_Choices_QuestionId",
table: "Choices",
column: "QuestionId");
migrationBuilder.CreateIndex(
name: "IX_Questions_QuizId",
table: "Questions",
column: "QuizId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Bots");
migrationBuilder.DropTable(
name: "Choices");
migrationBuilder.DropTable(
name: "Users");
migrationBuilder.DropTable(
name: "Profiles");
migrationBuilder.DropTable(
name: "Questions");
migrationBuilder.DropTable(
name: "Quizzes");
}
}
}

View File

@ -0,0 +1,165 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SitePi;
namespace SitePi.Migrations
{
[DbContext(typeof(AppContext))]
partial class AppContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("SitePi.Models.Bot", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("FileBytes");
b.Property<string>("FileName");
b.Property<string>("Name")
.IsRequired();
b.Property<float>("PercentageA");
b.Property<float>("PercentageB");
b.Property<float>("PercentageC");
b.Property<float>("PercentageD");
b.Property<int>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Bots");
});
modelBuilder.Entity("SitePi.Models.Choice", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("ProfileId");
b.Property<int>("QuestionId");
b.Property<string>("Text")
.IsRequired();
b.HasKey("Id");
b.HasIndex("ProfileId");
b.HasIndex("QuestionId");
b.ToTable("Choices");
});
modelBuilder.Entity("SitePi.Models.Profile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired();
b.HasKey("Id");
b.ToTable("Profiles");
});
modelBuilder.Entity("SitePi.Models.Question", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("QuizId");
b.Property<string>("Text")
.IsRequired();
b.HasKey("Id");
b.HasIndex("QuizId");
b.ToTable("Questions");
});
modelBuilder.Entity("SitePi.Models.Quiz", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired();
b.HasKey("Id");
b.ToTable("Quizzes");
});
modelBuilder.Entity("SitePi.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(100);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(25);
b.Property<string>("PasswordHash")
.IsRequired()
.HasMaxLength(45);
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("SitePi.Models.Bot", b =>
{
b.HasOne("SitePi.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("SitePi.Models.Choice", b =>
{
b.HasOne("SitePi.Models.Profile", "Profile")
.WithMany()
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("SitePi.Models.Question", "Question")
.WithMany("Choices")
.HasForeignKey("QuestionId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("SitePi.Models.Question", b =>
{
b.HasOne("SitePi.Models.Quiz", "Quiz")
.WithMany("Questions")
.HasForeignKey("QuizId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}