From f7dc96cd5f0f25e5c2d45d908b8f5bc0ad247d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommy=20=C3=96man?= Date: Sun, 7 Mar 2021 08:39:52 +0100 Subject: [PATCH] Added some migration, address object --- DataDomain/Address.cs | 18 +++ DataDomain/Person.cs | 3 + ...1633_completion_person_address.Designer.cs | 125 ++++++++++++++++++ ...0210306151633_completion_person_address.cs | 65 +++++++++ .../Migrations/StockContextModelSnapshot.cs | 35 +++++ DatamodelLibrary/StockContext.cs | 1 + StockInfo/Stocks.db | Bin 24576 -> 28672 bytes 7 files changed, 247 insertions(+) create mode 100644 DataDomain/Address.cs create mode 100644 DatamodelLibrary/Migrations/20210306151633_completion_person_address.Designer.cs create mode 100644 DatamodelLibrary/Migrations/20210306151633_completion_person_address.cs diff --git a/DataDomain/Address.cs b/DataDomain/Address.cs new file mode 100644 index 0000000..dce8591 --- /dev/null +++ b/DataDomain/Address.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataDomain +{ + public class Address + { + public int Id { get; set; } + public string Gata { get; set; } + public string Gata2 { get; set; } + public int PostNr { get; set; } + public string PostOrt { get; set; } + public string Nation { get; set; } + } +} diff --git a/DataDomain/Person.cs b/DataDomain/Person.cs index 39cf4ca..1b7068d 100644 --- a/DataDomain/Person.cs +++ b/DataDomain/Person.cs @@ -13,5 +13,8 @@ namespace DataDomain public string LastName { get; set; } public string NickName { get; set; } public DateTime? Born { get; set; } + public string Comments { get; set; } + public int HomeAddress { get; set; } + public int InvoiceAddress { get; set; } } } diff --git a/DatamodelLibrary/Migrations/20210306151633_completion_person_address.Designer.cs b/DatamodelLibrary/Migrations/20210306151633_completion_person_address.Designer.cs new file mode 100644 index 0000000..5192534 --- /dev/null +++ b/DatamodelLibrary/Migrations/20210306151633_completion_person_address.Designer.cs @@ -0,0 +1,125 @@ +// +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("20210306151633_completion_person_address")] + partial class completion_person_address + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.3"); + + modelBuilder.Entity("DataDomain.Address", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Gata") + .HasColumnType("TEXT"); + + b.Property("Gata2") + .HasColumnType("TEXT"); + + b.Property("Nation") + .HasColumnType("TEXT"); + + b.Property("PostNr") + .HasColumnType("INTEGER"); + + b.Property("PostOrt") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Addresses"); + }); + + modelBuilder.Entity("DataDomain.Person", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Born") + .HasColumnType("TEXT"); + + b.Property("Comments") + .HasColumnType("TEXT"); + + b.Property("FirstName") + .HasColumnType("TEXT"); + + b.Property("HomeAddress") + .HasColumnType("INTEGER"); + + b.Property("InvoiceAddress") + .HasColumnType("INTEGER"); + + b.Property("LastName") + .HasColumnType("TEXT"); + + b.Property("NickName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Persons"); + }); + + 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") + .HasColumnType("TEXT"); + + b.Property("PostAmount") + .HasColumnType("INTEGER"); + + b.Property("SoldDate") + .HasColumnType("TEXT"); + + b.Property("SoldValue") + .HasColumnType("TEXT"); + + b.Property("StockExtId") + .HasColumnType("TEXT"); + + b.Property("StockId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Stocks"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DatamodelLibrary/Migrations/20210306151633_completion_person_address.cs b/DatamodelLibrary/Migrations/20210306151633_completion_person_address.cs new file mode 100644 index 0000000..2078fb3 --- /dev/null +++ b/DatamodelLibrary/Migrations/20210306151633_completion_person_address.cs @@ -0,0 +1,65 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace DatamodelLibrary.Migrations +{ + public partial class completion_person_address : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Comments", + table: "Persons", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "HomeAddress", + table: "Persons", + type: "INTEGER", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "InvoiceAddress", + table: "Persons", + type: "INTEGER", + nullable: false, + defaultValue: 0); + + migrationBuilder.CreateTable( + name: "Addresses", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Gata = table.Column(type: "TEXT", nullable: true), + Gata2 = table.Column(type: "TEXT", nullable: true), + PostNr = table.Column(type: "INTEGER", nullable: false), + PostOrt = table.Column(type: "TEXT", nullable: true), + Nation = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Addresses", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Addresses"); + + migrationBuilder.DropColumn( + name: "Comments", + table: "Persons"); + + migrationBuilder.DropColumn( + name: "HomeAddress", + table: "Persons"); + + migrationBuilder.DropColumn( + name: "InvoiceAddress", + table: "Persons"); + } + } +} diff --git a/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs b/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs index 0e83c2c..e7f4a1b 100644 --- a/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs +++ b/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs @@ -16,6 +16,32 @@ namespace DatamodelLibrary.Migrations modelBuilder .HasAnnotation("ProductVersion", "5.0.3"); + modelBuilder.Entity("DataDomain.Address", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Gata") + .HasColumnType("TEXT"); + + b.Property("Gata2") + .HasColumnType("TEXT"); + + b.Property("Nation") + .HasColumnType("TEXT"); + + b.Property("PostNr") + .HasColumnType("INTEGER"); + + b.Property("PostOrt") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Addresses"); + }); + modelBuilder.Entity("DataDomain.Person", b => { b.Property("Id") @@ -25,9 +51,18 @@ namespace DatamodelLibrary.Migrations b.Property("Born") .HasColumnType("TEXT"); + b.Property("Comments") + .HasColumnType("TEXT"); + b.Property("FirstName") .HasColumnType("TEXT"); + b.Property("HomeAddress") + .HasColumnType("INTEGER"); + + b.Property("InvoiceAddress") + .HasColumnType("INTEGER"); + b.Property("LastName") .HasColumnType("TEXT"); diff --git a/DatamodelLibrary/StockContext.cs b/DatamodelLibrary/StockContext.cs index 3ad6722..608a832 100644 --- a/DatamodelLibrary/StockContext.cs +++ b/DatamodelLibrary/StockContext.cs @@ -12,6 +12,7 @@ namespace DatamodelLibrary { public DbSet Stocks { get; set; } public DbSet Persons { get; set; } + public DbSet
Addresses { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder options) => options.UseSqlite("Data Source=Stocks.db"); diff --git a/StockInfo/Stocks.db b/StockInfo/Stocks.db index d777e287ca6f537b16f6c8261fff4ef37fcbca91..e2c50ea648d05059621e3198adf31c46030a905b 100644 GIT binary patch delta 548 zcmZoTz}WDBae}lU3j+fKI}pPF`$QdMNfrh@_Z7Unj~UoF;~4lZ@vr5|;^Nd|ID_3e$kj2#RUyRD$;VYe2_`=IC$~Na zoTJO5BIBM|lBlE*;u;a6;1}xSqr=Ok00c@PVWY|Myy78#MM?^uej%>zu0aZZ{-~+~ z@{3FSi%PKQ_e(6v%+EuT;N{Y6iezRNmzHL1<(&MM_es5uf|7H7Zf+|6q7O z`8n@n4mLJ6aQJV&#An3F!Nk9gf&T&jy3K+Di};NUn3!Y5jSP$o4U7%U3{4HqjE&=y z^K%PwQbC@KFGwva22zQTNHEni&@-O=KwbrC$W8|SXZ$;XhOFh+)nSfhB-RY3&Cm3u J3>Fy(005@lo6i6M delta 119 zcmZp8z}Rqrae}lUGXnzy8xX?)^F$qEab^ZR_Z7VSKNwiKPciUa;$O@An0F%gsm+1{ zA>5l!aZ56>H0Cg~Pkzq(m_xxY)W?UHOLOxjJ|jjpM*as3{0}w@8eHR_{6Jm>$bZJb P{|v~#!@v2NzLWs~o*W=~