diff --git a/LootBoxSimulator/Migrations/20241204111540_InitialCreate.Designer.cs b/LootBoxSimulator/Migrations/20241204111540_InitialCreate.Designer.cs new file mode 100644 index 0000000..a07306a --- /dev/null +++ b/LootBoxSimulator/Migrations/20241204111540_InitialCreate.Designer.cs @@ -0,0 +1,117 @@ +// +using System; +using LootBoxSimulator.Models.DAO; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace LootBoxSimulator.Migrations +{ + [DbContext(typeof(RemoteDatabaseContext))] + [Migration("20241204111540_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("LootBoxSimulator.Models.DAO.CategoryDao", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Categories"); + }); + + modelBuilder.Entity("LootBoxSimulator.Models.DAO.ItemDao", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CategoryId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RateId") + .HasColumnType("integer"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.HasIndex("RateId"); + + b.ToTable("Items"); + }); + + modelBuilder.Entity("LootBoxSimulator.Models.DAO.RateDao", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Color") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Rate") + .HasColumnType("numeric"); + + b.HasKey("Id"); + + b.ToTable("Rates"); + }); + + modelBuilder.Entity("LootBoxSimulator.Models.DAO.ItemDao", b => + { + b.HasOne("LootBoxSimulator.Models.DAO.CategoryDao", "Category") + .WithMany() + .HasForeignKey("CategoryId"); + + b.HasOne("LootBoxSimulator.Models.DAO.RateDao", "Rate") + .WithMany() + .HasForeignKey("RateId"); + + b.Navigation("Category"); + + b.Navigation("Rate"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/LootBoxSimulator/Migrations/20241204111540_InitialCreate.cs b/LootBoxSimulator/Migrations/20241204111540_InitialCreate.cs new file mode 100644 index 0000000..573ec7d --- /dev/null +++ b/LootBoxSimulator/Migrations/20241204111540_InitialCreate.cs @@ -0,0 +1,92 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace LootBoxSimulator.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Categories", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Categories", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Rates", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false), + Rate = table.Column(type: "numeric", nullable: false), + Color = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Rates", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Items", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false), + Url = table.Column(type: "text", nullable: false), + CategoryId = table.Column(type: "integer", nullable: true), + RateId = table.Column(type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Items", x => x.Id); + table.ForeignKey( + name: "FK_Items_Categories_CategoryId", + column: x => x.CategoryId, + principalTable: "Categories", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Items_Rates_RateId", + column: x => x.RateId, + principalTable: "Rates", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_Items_CategoryId", + table: "Items", + column: "CategoryId"); + + migrationBuilder.CreateIndex( + name: "IX_Items_RateId", + table: "Items", + column: "RateId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Items"); + + migrationBuilder.DropTable( + name: "Categories"); + + migrationBuilder.DropTable( + name: "Rates"); + } + } +} diff --git a/LootBoxSimulator/Migrations/20241204111858_AddDescripForItem.Designer.cs b/LootBoxSimulator/Migrations/20241204111858_AddDescripForItem.Designer.cs new file mode 100644 index 0000000..95b5626 --- /dev/null +++ b/LootBoxSimulator/Migrations/20241204111858_AddDescripForItem.Designer.cs @@ -0,0 +1,121 @@ +// +using System; +using LootBoxSimulator.Models.DAO; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace LootBoxSimulator.Migrations +{ + [DbContext(typeof(RemoteDatabaseContext))] + [Migration("20241204111858_AddDescripForItem")] + partial class AddDescripForItem + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("LootBoxSimulator.Models.DAO.CategoryDao", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Categories"); + }); + + modelBuilder.Entity("LootBoxSimulator.Models.DAO.ItemDao", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CategoryId") + .HasColumnType("integer"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RateId") + .HasColumnType("integer"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.HasIndex("RateId"); + + b.ToTable("Items"); + }); + + modelBuilder.Entity("LootBoxSimulator.Models.DAO.RateDao", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Color") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Rate") + .HasColumnType("numeric"); + + b.HasKey("Id"); + + b.ToTable("Rates"); + }); + + modelBuilder.Entity("LootBoxSimulator.Models.DAO.ItemDao", b => + { + b.HasOne("LootBoxSimulator.Models.DAO.CategoryDao", "Category") + .WithMany() + .HasForeignKey("CategoryId"); + + b.HasOne("LootBoxSimulator.Models.DAO.RateDao", "Rate") + .WithMany() + .HasForeignKey("RateId"); + + b.Navigation("Category"); + + b.Navigation("Rate"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/LootBoxSimulator/Migrations/20241204111858_AddDescripForItem.cs b/LootBoxSimulator/Migrations/20241204111858_AddDescripForItem.cs new file mode 100644 index 0000000..43939f1 --- /dev/null +++ b/LootBoxSimulator/Migrations/20241204111858_AddDescripForItem.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace LootBoxSimulator.Migrations +{ + /// + public partial class AddDescripForItem : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Description", + table: "Items", + type: "text", + nullable: false, + defaultValue: ""); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Description", + table: "Items"); + } + } +}