DBchanges causing problems

This commit is contained in:
2022-02-11 11:24:43 +01:00
parent 02d8762ee0
commit 755e5e521b
4 changed files with 573 additions and 3 deletions

View File

@ -0,0 +1,212 @@
// <auto-generated />
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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Destination")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Nation")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Street")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Street2")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Zipcode")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Addresses");
});
modelBuilder.Entity("DataDomain.BackupRegister", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("BackedUp")
.HasColumnType("TEXT");
b.Property<string>("BackupDbName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("BackupPath")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("DbName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("BackupRegings");
});
modelBuilder.Entity("DataDomain.Person", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("AccountNo")
.HasColumnType("INTEGER");
b.Property<string>("Born")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ClearingNo")
.HasColumnType("INTEGER");
b.Property<string>("Comments")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("HomeAddress")
.HasColumnType("INTEGER");
b.Property<int>("InvoiceAddress")
.HasColumnType("INTEGER");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("NickName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Persons");
});
modelBuilder.Entity("DataDomain.PersonStock", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Comment")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PersonId")
.HasColumnType("INTEGER");
b.Property<int>("StockId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("PersonStocks");
});
modelBuilder.Entity("DataDomain.StockGroupModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("StockGroup")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("StockName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("StockGroups");
});
modelBuilder.Entity("DataDomain.StockMember", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("ActAmount")
.HasColumnType("INTEGER");
b.Property<DateTime?>("ActDate")
.HasColumnType("TEXT");
b.Property<decimal>("ActValue")
.HasColumnType("TEXT");
b.Property<DateTime>("BuyDate")
.HasColumnType("TEXT");
b.Property<decimal>("BuyValue")
.HasColumnType("TEXT");
b.Property<string>("Comment")
.IsRequired()
.HasColumnType("TEXT");
b.Property<long>("PostAmount")
.HasColumnType("INTEGER");
b.Property<DateTime?>("SoldDate")
.HasColumnType("TEXT");
b.Property<decimal>("SoldStockPrice")
.HasColumnType("TEXT");
b.Property<decimal?>("SoldValue")
.HasColumnType("TEXT");
b.Property<string>("StockExtId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("StockId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Stocks");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -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<string>(
name: "StockId",
table: "Stocks",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "StockExtId",
table: "Stocks",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Comment",
table: "Stocks",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "StockName",
table: "StockGroups",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AddColumn<string>(
name: "StockGroup",
table: "StockGroups",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AlterColumn<string>(
name: "Comment",
table: "PersonStocks",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "NickName",
table: "Persons",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "LastName",
table: "Persons",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "FirstName",
table: "Persons",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Comments",
table: "Persons",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Born",
table: "Persons",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "DbName",
table: "BackupRegings",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "BackupPath",
table: "BackupRegings",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "BackupDbName",
table: "BackupRegings",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Street2",
table: "Addresses",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Street",
table: "Addresses",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Nation",
table: "Addresses",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
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<string>(
name: "StockId",
table: "Stocks",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "StockExtId",
table: "Stocks",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "Comment",
table: "Stocks",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "StockName",
table: "StockGroups",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AddColumn<string>(
name: "GroupName",
table: "StockGroups",
type: "TEXT",
nullable: true);
migrationBuilder.AlterColumn<string>(
name: "Comment",
table: "PersonStocks",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "NickName",
table: "Persons",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "LastName",
table: "Persons",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "FirstName",
table: "Persons",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "Comments",
table: "Persons",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "Born",
table: "Persons",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "DbName",
table: "BackupRegings",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "BackupPath",
table: "BackupRegings",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "BackupDbName",
table: "BackupRegings",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "Street2",
table: "Addresses",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "Street",
table: "Addresses",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "Nation",
table: "Addresses",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<string>(
name: "Destination",
table: "Addresses",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
}
}
}

View File

@ -23,15 +23,19 @@ namespace DatamodelLibrary.Migrations
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<string>("Destination") b.Property<string>("Destination")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("Nation") b.Property<string>("Nation")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("Street") b.Property<string>("Street")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("Street2") b.Property<string>("Street2")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int>("Zipcode") b.Property<int>("Zipcode")
@ -52,12 +56,15 @@ namespace DatamodelLibrary.Migrations
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("BackupDbName") b.Property<string>("BackupDbName")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("BackupPath") b.Property<string>("BackupPath")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("DbName") b.Property<string>("DbName")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -75,15 +82,18 @@ namespace DatamodelLibrary.Migrations
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<string>("Born") b.Property<string>("Born")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int>("ClearingNo") b.Property<int>("ClearingNo")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<string>("Comments") b.Property<string>("Comments")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("FirstName") b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int>("HomeAddress") b.Property<int>("HomeAddress")
@ -93,9 +103,11 @@ namespace DatamodelLibrary.Migrations
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<string>("LastName") b.Property<string>("LastName")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("NickName") b.Property<string>("NickName")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -110,6 +122,7 @@ namespace DatamodelLibrary.Migrations
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<string>("Comment") b.Property<string>("Comment")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int>("PersonId") b.Property<int>("PersonId")
@ -123,16 +136,18 @@ namespace DatamodelLibrary.Migrations
b.ToTable("PersonStocks"); b.ToTable("PersonStocks");
}); });
modelBuilder.Entity("DataDomain.ShareModel", b => modelBuilder.Entity("DataDomain.StockGroupModel", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<string>("GroupName") b.Property<string>("StockGroup")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("StockName") b.Property<string>("StockName")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -162,6 +177,7 @@ namespace DatamodelLibrary.Migrations
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("Comment") b.Property<string>("Comment")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<long>("PostAmount") b.Property<long>("PostAmount")
@ -177,9 +193,11 @@ namespace DatamodelLibrary.Migrations
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("StockExtId") b.Property<string>("StockExtId")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("StockId") b.Property<string>("StockId")
.IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");

View File

@ -15,7 +15,7 @@ namespace DatamodelLibrary
public DbSet<Address> Addresses { get; set; } public DbSet<Address> Addresses { get; set; }
public DbSet<PersonStock> PersonStocks { get; set; } public DbSet<PersonStock> PersonStocks { get; set; }
public DbSet<BackupRegister> BackupRegings { get; set; } public DbSet<BackupRegister> BackupRegings { get; set; }
public DbSet<ShareModel> StockGroups { get; set; } public DbSet<StockGroupModel> StockGroups { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options) protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite(@"Data Source=.\Stocks.db"); => options.UseSqlite(@"Data Source=.\Stocks.db");