DB added and more

This commit is contained in:
2021-10-28 17:03:15 -04:00
parent b56ca46363
commit 28fbc4598e
20 changed files with 453 additions and 21 deletions

View File

@@ -0,0 +1,91 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using TOOHUCardAPI.Data;
namespace TOOHUCardAPI.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20211028202203_initial")]
partial class initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.11");
modelBuilder.Entity("TOOHUCardAPI.Data.Models.EncodedCardGroup", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("EncodedString")
.HasColumnType("TEXT");
b.Property<string>("UserSteamId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserSteamId");
b.ToTable("EncodedCardGroup");
});
modelBuilder.Entity("TOOHUCardAPI.Data.Models.User", b =>
{
b.Property<string>("SteamId")
.HasColumnType("TEXT");
b.Property<DateTime>("EndTime")
.HasColumnType("TEXT");
b.Property<DateTime>("KeySaveDate")
.HasColumnType("TEXT");
b.Property<int>("KeyTotal")
.HasColumnType("INTEGER");
b.Property<string>("LevelList")
.HasColumnType("TEXT");
b.Property<int>("MaxTeamWave")
.HasColumnType("INTEGER");
b.Property<int>("MaxWave")
.HasColumnType("INTEGER");
b.Property<int>("PetLevel")
.HasColumnType("INTEGER");
b.Property<int>("Point")
.HasColumnType("INTEGER");
b.Property<bool>("Vip")
.HasColumnType("INTEGER");
b.HasKey("SteamId");
b.ToTable("Users");
});
modelBuilder.Entity("TOOHUCardAPI.Data.Models.EncodedCardGroup", b =>
{
b.HasOne("TOOHUCardAPI.Data.Models.User", null)
.WithMany("EncodedCardGroups")
.HasForeignKey("UserSteamId");
});
modelBuilder.Entity("TOOHUCardAPI.Data.Models.User", b =>
{
b.Navigation("EncodedCardGroups");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,65 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace TOOHUCardAPI.Migrations
{
public partial class initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
SteamId = table.Column<string>(type: "TEXT", nullable: false),
MaxWave = table.Column<int>(type: "INTEGER", nullable: false),
MaxTeamWave = table.Column<int>(type: "INTEGER", nullable: false),
PetLevel = table.Column<int>(type: "INTEGER", nullable: false),
EndTime = table.Column<DateTime>(type: "TEXT", nullable: false),
KeyTotal = table.Column<int>(type: "INTEGER", nullable: false),
KeySaveDate = table.Column<DateTime>(type: "TEXT", nullable: false),
Vip = table.Column<bool>(type: "INTEGER", nullable: false),
Point = table.Column<int>(type: "INTEGER", nullable: false),
LevelList = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.SteamId);
});
migrationBuilder.CreateTable(
name: "EncodedCardGroup",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
EncodedString = table.Column<string>(type: "TEXT", nullable: true),
UserSteamId = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EncodedCardGroup", x => x.Id);
table.ForeignKey(
name: "FK_EncodedCardGroup_Users_UserSteamId",
column: x => x.UserSteamId,
principalTable: "Users",
principalColumn: "SteamId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_EncodedCardGroup_UserSteamId",
table: "EncodedCardGroup",
column: "UserSteamId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EncodedCardGroup");
migrationBuilder.DropTable(
name: "Users");
}
}
}

View File

@@ -0,0 +1,89 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using TOOHUCardAPI.Data;
namespace TOOHUCardAPI.Migrations
{
[DbContext(typeof(AppDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.11");
modelBuilder.Entity("TOOHUCardAPI.Data.Models.EncodedCardGroup", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("EncodedString")
.HasColumnType("TEXT");
b.Property<string>("UserSteamId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserSteamId");
b.ToTable("EncodedCardGroup");
});
modelBuilder.Entity("TOOHUCardAPI.Data.Models.User", b =>
{
b.Property<string>("SteamId")
.HasColumnType("TEXT");
b.Property<DateTime>("EndTime")
.HasColumnType("TEXT");
b.Property<DateTime>("KeySaveDate")
.HasColumnType("TEXT");
b.Property<int>("KeyTotal")
.HasColumnType("INTEGER");
b.Property<string>("LevelList")
.HasColumnType("TEXT");
b.Property<int>("MaxTeamWave")
.HasColumnType("INTEGER");
b.Property<int>("MaxWave")
.HasColumnType("INTEGER");
b.Property<int>("PetLevel")
.HasColumnType("INTEGER");
b.Property<int>("Point")
.HasColumnType("INTEGER");
b.Property<bool>("Vip")
.HasColumnType("INTEGER");
b.HasKey("SteamId");
b.ToTable("Users");
});
modelBuilder.Entity("TOOHUCardAPI.Data.Models.EncodedCardGroup", b =>
{
b.HasOne("TOOHUCardAPI.Data.Models.User", null)
.WithMany("EncodedCardGroups")
.HasForeignKey("UserSteamId");
});
modelBuilder.Entity("TOOHUCardAPI.Data.Models.User", b =>
{
b.Navigation("EncodedCardGroups");
});
#pragma warning restore 612, 618
}
}
}