From 755e5e521bb13ea788c132cf5fd9b28269e5f1fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommy=20=C3=96man?= Date: Fri, 11 Feb 2022 11:24:43 +0100 Subject: [PATCH] DBchanges causing problems --- ...20220210222657_StockGroupTable.Designer.cs | 212 +++++++++++ .../20220210222657_StockGroupTable.cs | 340 ++++++++++++++++++ .../Migrations/StockContextModelSnapshot.cs | 22 +- DatamodelLibrary/StockContext.cs | 2 +- 4 files changed, 573 insertions(+), 3 deletions(-) create mode 100644 DatamodelLibrary/Migrations/20220210222657_StockGroupTable.Designer.cs create mode 100644 DatamodelLibrary/Migrations/20220210222657_StockGroupTable.cs diff --git a/DatamodelLibrary/Migrations/20220210222657_StockGroupTable.Designer.cs b/DatamodelLibrary/Migrations/20220210222657_StockGroupTable.Designer.cs new file mode 100644 index 0000000..790d57e --- /dev/null +++ b/DatamodelLibrary/Migrations/20220210222657_StockGroupTable.Designer.cs @@ -0,0 +1,212 @@ +// +using System; +using DatamodelLibrary; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace DatamodelLibrary.Migrations +{ + [DbContext(typeof(StockContext))] + [Migration("20220210222657_StockGroupTable")] + partial class StockGroupTable + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.6"); + + modelBuilder.Entity("DataDomain.Address", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Destination") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Nation") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Street") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Street2") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Zipcode") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Addresses"); + }); + + modelBuilder.Entity("DataDomain.BackupRegister", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BackedUp") + .HasColumnType("TEXT"); + + b.Property("BackupDbName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("BackupPath") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("DbName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("BackupRegings"); + }); + + modelBuilder.Entity("DataDomain.Person", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AccountNo") + .HasColumnType("INTEGER"); + + b.Property("Born") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ClearingNo") + .HasColumnType("INTEGER"); + + b.Property("Comments") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HomeAddress") + .HasColumnType("INTEGER"); + + b.Property("InvoiceAddress") + .HasColumnType("INTEGER"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("NickName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("DataDomain.PersonStock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PersonId") + .HasColumnType("INTEGER"); + + b.Property("StockId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("PersonStocks"); + }); + + modelBuilder.Entity("DataDomain.StockGroupModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("StockGroup") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StockName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("StockGroups"); + }); + + modelBuilder.Entity("DataDomain.StockMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ActAmount") + .HasColumnType("INTEGER"); + + b.Property("ActDate") + .HasColumnType("TEXT"); + + b.Property("ActValue") + .HasColumnType("TEXT"); + + b.Property("BuyDate") + .HasColumnType("TEXT"); + + b.Property("BuyValue") + .HasColumnType("TEXT"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PostAmount") + .HasColumnType("INTEGER"); + + b.Property("SoldDate") + .HasColumnType("TEXT"); + + b.Property("SoldStockPrice") + .HasColumnType("TEXT"); + + b.Property("SoldValue") + .HasColumnType("TEXT"); + + b.Property("StockExtId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StockId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Stocks"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DatamodelLibrary/Migrations/20220210222657_StockGroupTable.cs b/DatamodelLibrary/Migrations/20220210222657_StockGroupTable.cs new file mode 100644 index 0000000..357d861 --- /dev/null +++ b/DatamodelLibrary/Migrations/20220210222657_StockGroupTable.cs @@ -0,0 +1,340 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace DatamodelLibrary.Migrations +{ + public partial class StockGroupTable : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "GroupName", + table: "StockGroups"); + + migrationBuilder.AlterColumn( + name: "StockId", + table: "Stocks", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "StockExtId", + table: "Stocks", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Comment", + table: "Stocks", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "StockName", + table: "StockGroups", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AddColumn( + name: "StockGroup", + table: "StockGroups", + type: "TEXT", + nullable: false, + defaultValue: ""); + + migrationBuilder.AlterColumn( + name: "Comment", + table: "PersonStocks", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "NickName", + table: "Persons", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "LastName", + table: "Persons", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "FirstName", + table: "Persons", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Comments", + table: "Persons", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Born", + table: "Persons", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "DbName", + table: "BackupRegings", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "BackupPath", + table: "BackupRegings", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "BackupDbName", + table: "BackupRegings", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Street2", + table: "Addresses", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Street", + table: "Addresses", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Nation", + table: "Addresses", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Destination", + table: "Addresses", + type: "TEXT", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "TEXT", + oldNullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "StockGroup", + table: "StockGroups"); + + migrationBuilder.AlterColumn( + name: "StockId", + table: "Stocks", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "StockExtId", + table: "Stocks", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "Comment", + table: "Stocks", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "StockName", + table: "StockGroups", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AddColumn( + name: "GroupName", + table: "StockGroups", + type: "TEXT", + nullable: true); + + migrationBuilder.AlterColumn( + name: "Comment", + table: "PersonStocks", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "NickName", + table: "Persons", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "LastName", + table: "Persons", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "FirstName", + table: "Persons", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "Comments", + table: "Persons", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "Born", + table: "Persons", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "DbName", + table: "BackupRegings", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "BackupPath", + table: "BackupRegings", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "BackupDbName", + table: "BackupRegings", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "Street2", + table: "Addresses", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "Street", + table: "Addresses", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "Nation", + table: "Addresses", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "Destination", + table: "Addresses", + type: "TEXT", + nullable: true, + oldClrType: typeof(string), + oldType: "TEXT"); + } + } +} diff --git a/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs b/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs index e43a9f1..5e1ce8c 100644 --- a/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs +++ b/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs @@ -23,15 +23,19 @@ namespace DatamodelLibrary.Migrations .HasColumnType("INTEGER"); b.Property("Destination") + .IsRequired() .HasColumnType("TEXT"); b.Property("Nation") + .IsRequired() .HasColumnType("TEXT"); b.Property("Street") + .IsRequired() .HasColumnType("TEXT"); b.Property("Street2") + .IsRequired() .HasColumnType("TEXT"); b.Property("Zipcode") @@ -52,12 +56,15 @@ namespace DatamodelLibrary.Migrations .HasColumnType("TEXT"); b.Property("BackupDbName") + .IsRequired() .HasColumnType("TEXT"); b.Property("BackupPath") + .IsRequired() .HasColumnType("TEXT"); b.Property("DbName") + .IsRequired() .HasColumnType("TEXT"); b.HasKey("Id"); @@ -75,15 +82,18 @@ namespace DatamodelLibrary.Migrations .HasColumnType("INTEGER"); b.Property("Born") + .IsRequired() .HasColumnType("TEXT"); b.Property("ClearingNo") .HasColumnType("INTEGER"); b.Property("Comments") + .IsRequired() .HasColumnType("TEXT"); b.Property("FirstName") + .IsRequired() .HasColumnType("TEXT"); b.Property("HomeAddress") @@ -93,9 +103,11 @@ namespace DatamodelLibrary.Migrations .HasColumnType("INTEGER"); b.Property("LastName") + .IsRequired() .HasColumnType("TEXT"); b.Property("NickName") + .IsRequired() .HasColumnType("TEXT"); b.HasKey("Id"); @@ -110,6 +122,7 @@ namespace DatamodelLibrary.Migrations .HasColumnType("INTEGER"); b.Property("Comment") + .IsRequired() .HasColumnType("TEXT"); b.Property("PersonId") @@ -123,16 +136,18 @@ namespace DatamodelLibrary.Migrations b.ToTable("PersonStocks"); }); - modelBuilder.Entity("DataDomain.ShareModel", b => + modelBuilder.Entity("DataDomain.StockGroupModel", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); - b.Property("GroupName") + b.Property("StockGroup") + .IsRequired() .HasColumnType("TEXT"); b.Property("StockName") + .IsRequired() .HasColumnType("TEXT"); b.HasKey("Id"); @@ -162,6 +177,7 @@ namespace DatamodelLibrary.Migrations .HasColumnType("TEXT"); b.Property("Comment") + .IsRequired() .HasColumnType("TEXT"); b.Property("PostAmount") @@ -177,9 +193,11 @@ namespace DatamodelLibrary.Migrations .HasColumnType("TEXT"); b.Property("StockExtId") + .IsRequired() .HasColumnType("TEXT"); b.Property("StockId") + .IsRequired() .HasColumnType("TEXT"); b.HasKey("Id"); diff --git a/DatamodelLibrary/StockContext.cs b/DatamodelLibrary/StockContext.cs index fad847f..4e2fe2b 100644 --- a/DatamodelLibrary/StockContext.cs +++ b/DatamodelLibrary/StockContext.cs @@ -15,7 +15,7 @@ namespace DatamodelLibrary public DbSet
Addresses { get; set; } public DbSet PersonStocks { get; set; } public DbSet BackupRegings { get; set; } - public DbSet StockGroups { get; set; } + public DbSet StockGroups { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder options) => options.UseSqlite(@"Data Source=.\Stocks.db");