DRAB/Pcm.Db/PcmDbContext.cs
2025-07-11 00:18:14 +02:00

9865 lines
349 KiB
C#

using Microsoft.EntityFrameworkCore;
using Pcm.Db.Entities;
namespace Pcm.Db;
public class PcmDbContext : DbContext
{
public PcmDbContext()
{
}
public PcmDbContext(DbContextOptions<PcmDbContext> options)
: base(options)
{
}
public virtual DbSet<Akwizytor> Akwizytorzy { get; set; }
public virtual DbSet<Artykul> Artykuly { get; set; }
public virtual DbSet<Asort> Asortymenty { get; set; }
public virtual DbSet<Bank> Banki { get; set; }
public virtual DbSet<Blokadum> Blokady { get; set; }
public virtual DbSet<CentrStanZgody> CentrStanZgodies { get; set; }
public virtual DbSet<Cza> Czas { get; set; }
public virtual DbSet<DefinicjaKodu> DefinicjaKodus { get; set; }
public virtual DbSet<Dok> Dokumenty { get; set; }
public virtual DbSet<DokDodKth> DokDodKths { get; set; }
public virtual DbSet<DokKasa> DokKasas { get; set; }
public virtual DbSet<DokKontoBankowe> DokKontaBankowe { get; set; }
public virtual DbSet<DokKontr> DokKontr { get; set; }
public virtual DbSet<DokKur> DokKurs { get; set; }
public virtual DbSet<DokPunkty> DokPunkty { get; set; }
public virtual DbSet<DokWalutum> DokWaluta { get; set; }
public virtual DbSet<DostProd> DostProds { get; set; }
public virtual DbSet<Dostawca> Dostawcy { get; set; }
public virtual DbSet<DzienRozl> DzienRozls { get; set; }
public virtual DbSet<DzienRozlParam> DzienRozlParams { get; set; }
public virtual DbSet<FormZgod> FormZgods { get; set; }
public virtual DbSet<FormaPlatnPos7> FormaPlatnPos7s { get; set; }
public virtual DbSet<FormaPlatnosci> FormaPlatnoscis { get; set; }
public virtual DbSet<GrWartosc> GrWartoscs { get; set; }
public virtual DbSet<GrupaAkcyzowa> GrupaAkcyzowas { get; set; }
public virtual DbSet<GrupaTow> GrupaTows { get; set; }
public virtual DbSet<GrupaUz> GrupaUzs { get; set; }
public virtual DbSet<HarmCeny> HarmCenies { get; set; }
public virtual DbSet<HarmCykl> HarmCykls { get; set; }
public virtual DbSet<HarmHarm> HarmHarms { get; set; }
public virtual DbSet<HarmWpi> HarmWpis { get; set; }
public virtual DbSet<Istw> Istws { get; set; }
public virtual DbSet<Jm> Jms { get; set; }
public virtual DbSet<KartaLoj> KartaLojs { get; set; }
public virtual DbSet<KasKod> KasKods { get; set; }
public virtual DbSet<KasPar> KasPars { get; set; }
public virtual DbSet<KasTow> KasTows { get; set; }
public virtual DbSet<Kasa> Kasas { get; set; }
public virtual DbSet<KasaFormaPlatn> KasaFormaPlatns { get; set; }
public virtual DbSet<KatParam> KatParams { get; set; }
public virtual DbSet<Kategorium> Kategoria { get; set; }
public virtual DbSet<KodDod> KodDods { get; set; }
public virtual DbSet<KodWazony> KodWazonies { get; set; }
public virtual DbSet<Komentarz> Komentarzs { get; set; }
public virtual DbSet<Konfig> Konfig { get; set; }
public virtual DbSet<KontoBankowe> KontoBankowes { get; set; }
public virtual DbSet<KontoBankoweKontr> KontoBankoweKontrs { get; set; }
public virtual DbSet<KontoLoj> KontoLojs { get; set; }
public virtual DbSet<KontrOpi> KontrOpis { get; set; }
public virtual DbSet<Kontrahent> Kontrahents { get; set; }
public virtual DbSet<Kraj> Krajs { get; set; }
public virtual DbSet<KrajStawka> KrajStawkas { get; set; }
public virtual DbSet<KthParWartosc> KthParWartoscs { get; set; }
public virtual DbSet<KthParam> KthParams { get; set; }
public virtual DbSet<KthTypO> KthTypOs { get; set; }
public virtual DbSet<KthWartosc> KthWartoscs { get; set; }
public virtual DbSet<KursWaluty> KursWaluties { get; set; }
public virtual DbSet<LiniaLotnicza> LiniaLotniczas { get; set; }
public virtual DbSet<LogOperation> LogOperations { get; set; }
public virtual DbSet<LogTypeDef> LogTypeDefs { get; set; }
public virtual DbSet<LogValChangeNum> LogValChangeNums { get; set; }
public virtual DbSet<LogValChangeTxt> LogValChangeTxts { get; set; }
public virtual DbSet<Lotnisko> Lotniskos { get; set; }
public virtual DbSet<Magazyn> Magazyns { get; set; }
public virtual DbSet<MarZakre> MarZakres { get; set; }
public virtual DbSet<Marzownik> Marzowniks { get; set; }
public virtual DbSet<Notatki> Notatkis { get; set; }
public virtual DbSet<NrRej> NrRejs { get; set; }
public virtual DbSet<NrRejKartum> NrRejKarta { get; set; }
public virtual DbSet<NumDok> NumDoks { get; set; }
public virtual DbSet<NumMag> NumMags { get; set; }
public virtual DbSet<OdbProd> OdbProds { get; set; }
public virtual DbSet<Odbiorca> Odbiorcas { get; set; }
public virtual DbSet<OfKod> OfKods { get; set; }
public virtual DbSet<OfSlownik> OfSlowniks { get; set; }
public virtual DbSet<Ofertum> Oferta { get; set; }
public virtual DbSet<OpisZdarzLoj> OpisZdarzLojs { get; set; }
public virtual DbSet<Oplatum> Oplata { get; set; }
public virtual DbSet<Osoba> Osobas { get; set; }
public virtual DbSet<Panel> Panels { get; set; }
public virtual DbSet<PanelParam> PanelParams { get; set; }
public virtual DbSet<ParBon> ParBons { get; set; }
public virtual DbSet<ParPunkty> ParPunkties { get; set; }
public virtual DbSet<ParWalutum> ParWaluta { get; set; }
public virtual DbSet<ParWartosc> ParWartoscs { get; set; }
public virtual DbSet<Paragon> Paragony { get; set; }
public virtual DbSet<Parametr> Parametry { get; set; }
public virtual DbSet<Partium> Partie { get; set; }
public virtual DbSet<PcfUser> PcfUsers { get; set; }
public virtual DbSet<Ph> Phs { get; set; }
public virtual DbSet<Phdane> Phdanes { get; set; }
public virtual DbSet<PhodbDane> PhodbDanes { get; set; }
public virtual DbSet<Phodbiorca> Phodbiorcas { get; set; }
public virtual DbSet<Phrozliczenie> Phrozliczenies { get; set; }
public virtual DbSet<PolMag> PolMags { get; set; }
public virtual DbSet<PolParam> PolParams { get; set; }
public virtual DbSet<Polityka> Politykas { get; set; }
public virtual DbSet<PowKontLoj> PowKontLojs { get; set; }
public virtual DbSet<Powiadomienie> Powiadomienies { get; set; }
public virtual DbSet<PowiadomienieParam> PowiadomienieParams { get; set; }
public virtual DbSet<Powiazanie> Powiazanies { get; set; }
public virtual DbSet<PowiazanieSklep> PowiazanieSkleps { get; set; }
public virtual DbSet<PowiazanieUz> PowiazanieUzs { get; set; }
public virtual DbSet<PowiazanieUzNaSklep> PowiazanieUzNaSkleps { get; set; }
public virtual DbSet<PozAkcyza> PozAkcyzas { get; set; }
public virtual DbSet<PozDok> PozDoks { get; set; }
public virtual DbSet<PozPar> PozPars { get; set; }
public virtual DbSet<PozParSzczeg> PozParSzczegs { get; set; }
public virtual DbSet<PozWz> PozWzs { get; set; }
public virtual DbSet<Profil> Profils { get; set; }
public virtual DbSet<ProfilKasa> ProfilKasas { get; set; }
public virtual DbSet<ProfilKonfig> ProfilKonfigs { get; set; }
public virtual DbSet<PrtMag> PrtMags { get; set; }
public virtual DbSet<Przydzial> Przydzials { get; set; }
public virtual DbSet<RapWartPocz> RapWartPoczs { get; set; }
public virtual DbSet<RapWartPoczDane> RapWartPoczDanes { get; set; }
public virtual DbSet<Regula> Regulas { get; set; }
public virtual DbSet<RegulaAsort> RegulaAsorts { get; set; }
public virtual DbSet<RegulaDok> RegulaDoks { get; set; }
public virtual DbSet<RegulaDokSzczeg> RegulaDokSzczegs { get; set; }
public virtual DbSet<RegulaKod> RegulaKods { get; set; }
public virtual DbSet<RegulaPar> RegulaPars { get; set; }
public virtual DbSet<RegulaParSzczeg> RegulaParSzczegs { get; set; }
public virtual DbSet<RegulaParam> RegulaParams { get; set; }
public virtual DbSet<RegulaPozDok> RegulaPozDoks { get; set; }
public virtual DbSet<RegulaPozDokSzczeg> RegulaPozDokSzczegs { get; set; }
public virtual DbSet<RegulaPozPar> RegulaPozPars { get; set; }
public virtual DbSet<RegulaPozParSzczeg> RegulaPozParSzczegs { get; set; }
public virtual DbSet<RegulaProg> RegulaProgs { get; set; }
public virtual DbSet<RegulaSklep> RegulaSkleps { get; set; }
public virtual DbSet<RegulaTowar> RegulaTowars { get; set; }
public virtual DbSet<Rola> Rolas { get; set; }
public virtual DbSet<RozPrtMag> RozPrtMags { get; set; }
public virtual DbSet<RozbicieDok> RozbicieDoks { get; set; }
public virtual DbSet<Rozlicza> Rozliczas { get; set; }
public virtual DbSet<RozliczeniePartii> RozliczeniePartiis { get; set; }
public virtual DbSet<Sesja> Sesjas { get; set; }
public virtual DbSet<SesjaAktywna> SesjaAktywnas { get; set; }
public virtual DbSet<SkladnikDefinicjiKodu> SkladnikDefinicjiKodus { get; set; }
public virtual DbSet<SkladnikWzorca> SkladnikWzorcas { get; set; }
public virtual DbSet<Sklep> Skleps { get; set; }
public virtual DbSet<SklepArtykul> SklepArtykuls { get; set; }
public virtual DbSet<SklepBank> SklepBanks { get; set; }
public virtual DbSet<SklepDefinicjaKodu> SklepDefinicjaKodus { get; set; }
public virtual DbSet<SklepDok> SklepDoks { get; set; }
public virtual DbSet<SklepDokDodKth> SklepDokDodKths { get; set; }
public virtual DbSet<SklepDokKur> SklepDokKurs { get; set; }
public virtual DbSet<SklepDokPunkty> SklepDokPunkties { get; set; }
public virtual DbSet<SklepDokWalutum> SklepDokWaluta { get; set; }
public virtual DbSet<SklepDost> SklepDosts { get; set; }
public virtual DbSet<SklepDzienRozl> SklepDzienRozls { get; set; }
public virtual DbSet<SklepDzienRozlParam> SklepDzienRozlParams { get; set; }
public virtual DbSet<SklepFlagi> SklepFlagis { get; set; }
public virtual DbSet<SklepFormZgod> SklepFormZgods { get; set; }
public virtual DbSet<SklepFormaPlatnPos7> SklepFormaPlatnPos7s { get; set; }
public virtual DbSet<SklepGrupaAkcyzowa> SklepGrupaAkcyzowas { get; set; }
public virtual DbSet<SklepGrupaUz> SklepGrupaUzs { get; set; }
public virtual DbSet<SklepIstw> SklepIstws { get; set; }
public virtual DbSet<SklepKartaLoj> SklepKartaLojs { get; set; }
public virtual DbSet<SklepKasa> SklepKasas { get; set; }
public virtual DbSet<SklepKasaFormaPlatn> SklepKasaFormaPlatns { get; set; }
public virtual DbSet<SklepKontoBankowe> SklepKontoBankowes { get; set; }
public virtual DbSet<SklepKontoBankoweKontr> SklepKontoBankoweKontrs { get; set; }
public virtual DbSet<SklepKontoLoj> SklepKontoLojs { get; set; }
public virtual DbSet<SklepKontr> SklepKontrs { get; set; }
public virtual DbSet<SklepKontrOpi> SklepKontrOpis { get; set; }
public virtual DbSet<SklepKontrSklep> SklepKontrSkleps { get; set; }
public virtual DbSet<SklepKthPrzydzial> SklepKthPrzydzials { get; set; }
public virtual DbSet<SklepKthTypO> SklepKthTypOs { get; set; }
public virtual DbSet<SklepMagazyn> SklepMagazyns { get; set; }
public virtual DbSet<SklepNarzDost> SklepNarzDosts { get; set; }
public virtual DbSet<SklepNotatki> SklepNotatkis { get; set; }
public virtual DbSet<SklepNrRej> SklepNrRejs { get; set; }
public virtual DbSet<SklepNrRejKartum> SklepNrRejKarta { get; set; }
public virtual DbSet<SklepOplatum> SklepOplata { get; set; }
public virtual DbSet<SklepPanel> SklepPanels { get; set; }
public virtual DbSet<SklepPanelParam> SklepPanelParams { get; set; }
public virtual DbSet<SklepParBon> SklepParBons { get; set; }
public virtual DbSet<SklepParPunkty> SklepParPunkties { get; set; }
public virtual DbSet<SklepParWalutum> SklepParWaluta { get; set; }
public virtual DbSet<SklepParagon> SklepParagons { get; set; }
public virtual DbSet<SklepPartium> SklepPartia { get; set; }
public virtual DbSet<SklepPowKontLoj> SklepPowKontLojs { get; set; }
public virtual DbSet<SklepPowiazanieUz> SklepPowiazanieUzs { get; set; }
public virtual DbSet<SklepPozAkcyza> SklepPozAkcyzas { get; set; }
public virtual DbSet<SklepPozDok> SklepPozDoks { get; set; }
public virtual DbSet<SklepPozPar> SklepPozPars { get; set; }
public virtual DbSet<SklepPozParSzczeg> SklepPozParSzczegs { get; set; }
public virtual DbSet<SklepProfil> SklepProfils { get; set; }
public virtual DbSet<SklepProfilKonfig> SklepProfilKonfigs { get; set; }
public virtual DbSet<SklepPrtMag> SklepPrtMags { get; set; }
public virtual DbSet<SklepPrzydzial> SklepPrzydzials { get; set; }
public virtual DbSet<SklepRapWartPocz> SklepRapWartPoczs { get; set; }
public virtual DbSet<SklepRapWartPoczDane> SklepRapWartPoczDanes { get; set; }
public virtual DbSet<SklepRegula> SklepRegulas { get; set; }
public virtual DbSet<SklepRegulaAsort> SklepRegulaAsorts { get; set; }
public virtual DbSet<SklepRegulaDok> SklepRegulaDoks { get; set; }
public virtual DbSet<SklepRegulaDokSzczeg> SklepRegulaDokSzczegs { get; set; }
public virtual DbSet<SklepRegulaPar> SklepRegulaPars { get; set; }
public virtual DbSet<SklepRegulaParSzczeg> SklepRegulaParSzczegs { get; set; }
public virtual DbSet<SklepRegulaParam> SklepRegulaParams { get; set; }
public virtual DbSet<SklepRegulaPozDok> SklepRegulaPozDoks { get; set; }
public virtual DbSet<SklepRegulaPozDokSzczeg> SklepRegulaPozDokSzczegs { get; set; }
public virtual DbSet<SklepRegulaPozPar> SklepRegulaPozPars { get; set; }
public virtual DbSet<SklepRegulaPozParSzczeg> SklepRegulaPozParSzczegs { get; set; }
public virtual DbSet<SklepRegulaTowar> SklepRegulaTowars { get; set; }
public virtual DbSet<SklepRola> SklepRolas { get; set; }
public virtual DbSet<SklepRozPrtMag> SklepRozPrtMags { get; set; }
public virtual DbSet<SklepRozbicieDok> SklepRozbicieDoks { get; set; }
public virtual DbSet<SklepRozlPartii> SklepRozlPartiis { get; set; }
public virtual DbSet<SklepRozlicza> SklepRozliczas { get; set; }
public virtual DbSet<SklepSkladnikDefinicjiKodu> SklepSkladnikDefinicjiKodus { get; set; }
public virtual DbSet<SklepSkladnikWzorca> SklepSkladnikWzorcas { get; set; }
public virtual DbSet<SklepSklep> SklepSkleps { get; set; }
public virtual DbSet<SklepStanPrtMag> SklepStanPrtMags { get; set; }
public virtual DbSet<SklepSzczegPrtMag> SklepSzczegPrtMags { get; set; }
public virtual DbSet<SklepTekstDok> SklepTekstDoks { get; set; }
public virtual DbSet<SklepTekstPoz> SklepTekstPozs { get; set; }
public virtual DbSet<SklepTekstZgody> SklepTekstZgodies { get; set; }
public virtual DbSet<SklepTowAkcyza> SklepTowAkcyzas { get; set; }
public virtual DbSet<SklepTowDodatek> SklepTowDodateks { get; set; }
public virtual DbSet<SklepTowKod> SklepTowKods { get; set; }
public virtual DbSet<SklepTowPowiazanie> SklepTowPowiazanies { get; set; }
public virtual DbSet<SklepTowStraty> SklepTowStraties { get; set; }
public virtual DbSet<SklepTowar> SklepTowars { get; set; }
public virtual DbSet<SklepTowarSkladnika> SklepTowarSkladnikas { get; set; }
public virtual DbSet<SklepTypO> SklepTypOs { get; set; }
public virtual DbSet<SklepUprawnienie> SklepUprawnienies { get; set; }
public virtual DbSet<SklepUzytkownik> SklepUzytkowniks { get; set; }
public virtual DbSet<SklepWalutum> SklepWaluta { get; set; }
public virtual DbSet<SklepZaleznosc> SklepZaleznoscs { get; set; }
public virtual DbSet<SklepZasob> SklepZasobs { get; set; }
public virtual DbSet<SklepZdarzO> SklepZdarzOs { get; set; }
public virtual DbSet<SklepZdarzOsOpi> SklepZdarzOsOpis { get; set; }
public virtual DbSet<SklepZgodum> SklepZgoda { get; set; }
public virtual DbSet<Sprzedaz> Sprzedazs { get; set; }
public virtual DbSet<StanPrtMag> StanPrtMags { get; set; }
public virtual DbSet<StanZgody> StanZgodies { get; set; }
public virtual DbSet<Struktura73> Struktura73s { get; set; }
public virtual DbSet<Subsy> Subsys { get; set; }
public virtual DbSet<SzczegPrtMag> SzczegPrtMags { get; set; }
public virtual DbSet<TabelaAkcyzowa> TabelaAkcyzowas { get; set; }
public virtual DbSet<TekstDok> TekstDoks { get; set; }
public virtual DbSet<TekstPoz> TekstPozs { get; set; }
public virtual DbSet<TekstZgody> TekstZgodies { get; set; }
public virtual DbSet<TowAkcyza> TowAkcyzas { get; set; }
public virtual DbSet<TowDodatek> TowDodateks { get; set; }
public virtual DbSet<TowKraj> TowKrajs { get; set; }
public virtual DbSet<TowPowiazanie> TowPowiazanies { get; set; }
public virtual DbSet<TowStraty> TowStraties { get; set; }
public virtual DbSet<TowStratyDlaSklepu> TowStratyDlaSklepus { get; set; }
public virtual DbSet<TowWartosc> TowWartoscs { get; set; }
public virtual DbSet<Towar> Towars { get; set; }
public virtual DbSet<TowarSkladnika> TowarSkladnikas { get; set; }
public virtual DbSet<TypO> TypOs { get; set; }
public virtual DbSet<Uprawnienie> Uprawnienies { get; set; }
public virtual DbSet<UprawnienieNaSklep> UprawnienieNaSkleps { get; set; }
public virtual DbSet<UzNaSklep> UzNaSkleps { get; set; }
public virtual DbSet<Uzytkownik> Uzytkowniks { get; set; }
public virtual DbSet<Vat> Vats { get; set; }
public virtual DbSet<Walutum> Waluta { get; set; }
public virtual DbSet<Wersja72> Wersja72s { get; set; }
public virtual DbSet<Wzorzec> Wzorzecs { get; set; }
public virtual DbSet<Zaleznosc> Zaleznoscs { get; set; }
public virtual DbSet<Zasob> Zasobs { get; set; }
public virtual DbSet<ZdarzLoj> ZdarzLojs { get; set; }
public virtual DbSet<ZdarzO> ZdarzOs { get; set; }
public virtual DbSet<ZdarzOsOpi> ZdarzOsOpis { get; set; }
public virtual DbSet<Zgodum> Zgoda { get; set; }
public virtual DbSet<ZlecKomunikat> ZlecKomunikats { get; set; }
public virtual DbSet<ZlecParam> ZlecParams { get; set; }
public virtual DbSet<Zlecenie> Zlecenies { get; set; }
public virtual DbSet<Zmiana> Zmianas { get; set; }
public virtual DbSet<ZmianaTabeli> ZmianaTabelis { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasAnnotation("Relational:Collation", "Polish_CI_AS");
modelBuilder.Entity<Akwizytor>(entity =>
{
entity.HasKey(e => e.AkwId)
.HasName("PK_AKWIZYTOR");
entity.ToTable("Akwizytor");
entity.Property(e => e.AkwId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.Nazwisko)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Opis)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Prowizja).HasColumnType("decimal(10, 4)");
});
modelBuilder.Entity<Artykul>(entity =>
{
entity.HasKey(e => e.ArtId)
.HasName("PK_ARTYKUL");
entity.ToTable("Artykul");
entity.HasIndex(e => e.CentrArtId, "idx_CentrArtId");
entity.Property(e => e.ArtId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ArtNazwa)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.CentrArtId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.GlownyTowId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.GlownyTow)
.WithMany(p => p.Artykuls)
.HasForeignKey(d => d.GlownyTowId)
.HasConstraintName("FK_ARTGLOWNYTOWID");
});
modelBuilder.Entity<Asort>(entity =>
{
entity.HasKey(e => e.AsId)
.HasName("PK_ASORT");
entity.ToTable("Asort");
entity.HasIndex(e => e.CentrAsId, "idx_CentrAsId");
entity.Property(e => e.AsId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrAsId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.HurtRabat).HasColumnType("decimal(10, 4)");
entity.Property(e => e.Marza).HasColumnType("decimal(10, 4)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.NocNarzut).HasColumnType("decimal(10, 4)");
entity.Property(e => e.Param1).HasColumnType("decimal(15, 4)");
});
modelBuilder.Entity<Bank>(entity =>
{
entity.ToTable("Bank");
entity.Property(e => e.BankId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.Adres)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.CentrBankId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.NrRozliBank)
.HasMaxLength(8)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<Blokadum>(entity =>
{
entity.HasKey(e => new { e.SesjaId, e.TowId, e.MagId })
.HasName("PK_BLOKADA");
entity.HasIndex(e => new { e.TowId, e.MagId }, "idx_BlokTowMag");
entity.Property(e => e.SesjaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Ilosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Sesja)
.WithMany(p => p.Blokada)
.HasForeignKey(d => d.SesjaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_BLOKADA_REF_BLOKS_SESJAAKT");
entity.HasOne(d => d.Istw)
.WithMany(p => p.Blokada)
.HasForeignKey(d => new { d.TowId, d.MagId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_BLOKADA_REF_BLOKT_ISTW");
});
modelBuilder.Entity<CentrStanZgody>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.ZgId })
.HasName("PK_CENTRSTANZGODY");
entity.ToTable("CentrStanZgody");
entity.HasIndex(e => e.ZgId, "idx_CESTZG_ZG");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ZgId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DataDec).HasColumnType("datetime");
entity.Property(e => e.Kiedy)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Wersja)
.HasMaxLength(20)
.IsUnicode(false);
entity.HasOne(d => d.Kontr)
.WithMany(p => p.CentrStanZgodies)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_CESTZG_KTH");
entity.HasOne(d => d.Zg)
.WithMany(p => p.CentrStanZgodies)
.HasForeignKey(d => d.ZgId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_CESTZG_ZG");
});
modelBuilder.Entity<Cza>(entity =>
{
entity.HasKey(e => e.CzasId)
.HasName("PK_CZAS");
entity.Property(e => e.CzasId)
.HasColumnType("numeric(9, 0)")
.HasColumnName("CzasID");
entity.Property(e => e.Data).HasColumnType("datetime");
entity.Property(e => e.Dzien).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DzienMiesiaca).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DzienTygodnia).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Miesiac).HasColumnType("numeric(9, 0)");
entity.Property(e => e.MiesiacRoku).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Rok).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tydzien).HasColumnType("numeric(9, 0)");
entity.Property(e => e.TydzienRoku).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Weekend).HasColumnType("numeric(9, 0)");
});
modelBuilder.Entity<DefinicjaKodu>(entity =>
{
entity.HasKey(e => e.Dkid)
.HasName("PK_DEFKODU");
entity.ToTable("DefinicjaKodu");
entity.Property(e => e.Dkid)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd()
.HasColumnName("DKId");
entity.Property(e => e.CentrDkid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("CentrDKId");
entity.Property(e => e.DataDo).HasColumnType("datetime");
entity.Property(e => e.DataOd).HasColumnType("datetime");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<Dok>(entity =>
{
entity.ToTable("Dok");
entity.HasIndex(e => new { e.TypDok, e.Data, e.KolejnyWdniu }, "DokTypDok");
entity.HasIndex(e => e.CentrDokId, "idx_DokCentrDokId");
entity.HasIndex(e => new { e.Data, e.KolejnyWdniu }, "idx_DokDataKolejnyWDniu");
entity.HasIndex(e => e.MagId, "idx_DokMagId");
entity.HasIndex(e => e.NrDok, "idx_DokNrDok");
entity.HasIndex(e => e.UzId, "idx_DokUzId");
entity.HasIndex(e => e.WalId, "idx_DokWal");
entity.HasIndex(e => e.Zmiana, "idx_DokZmiana");
entity.HasIndex(e => e.ZmianaPkt, "idx_DokZmianaPkt");
entity.Property(e => e.DokId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrDokId).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Data).HasColumnType("datetime");
entity.Property(e => e.DataDod).HasColumnType("datetime");
entity.Property(e => e.DataPom).HasColumnType("datetime");
entity.Property(e => e.DoZaplaty).HasColumnType("decimal(15, 4)");
entity.Property(e => e.EksportFk).HasColumnName("EksportFK");
entity.Property(e => e.KolejnyWdniu).HasColumnName("KolejnyWDniu");
entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota1).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota10).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota11).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota12).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota3).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota4).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota5).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota6).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota7).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota8).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota9).HasColumnType("decimal(15, 4)");
entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Netto).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NettoDet).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NettoDetUslugi).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NettoMag).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NettoMagUslugi).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NettoUslugi).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NrDok)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Podatek).HasColumnType("decimal(15, 4)");
entity.Property(e => e.PodatekDet).HasColumnType("decimal(15, 4)");
entity.Property(e => e.PodatekDetUslugi).HasColumnType("decimal(15, 4)");
entity.Property(e => e.PodatekMag).HasColumnType("decimal(15, 4)");
entity.Property(e => e.PodatekMagUslugi).HasColumnType("decimal(15, 4)");
entity.Property(e => e.PodatekUslugi).HasColumnType("decimal(15, 4)");
entity.Property(e => e.RabatProc).HasColumnType("decimal(10, 4)");
entity.Property(e => e.Razem).HasColumnType("decimal(15, 4)");
entity.Property(e => e.UzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.WalId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Zaplacono).HasColumnType("decimal(15, 4)");
entity.Property(e => e.ZaplaconoPodatek).HasColumnType("decimal(15, 4)");
entity.Property(e => e.ZaplaconoWkasie)
.HasColumnType("decimal(15, 4)")
.HasColumnName("ZaplaconoWKasie");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.Property(e => e.ZmianaPkt).HasColumnType("datetime");
entity.HasOne(d => d.Mag)
.WithMany(p => p.Doks)
.HasForeignKey(d => d.MagId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOK_REF_DOKMA_MAGAZYN");
entity.HasOne(d => d.Uz)
.WithMany(p => p.Doks)
.HasForeignKey(d => d.UzId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOK_REF_DOKUZ_UZYTKOWN");
entity.HasOne(d => d.Wal)
.WithMany(p => p.Doks)
.HasForeignKey(d => d.WalId)
.HasConstraintName("FK_DOK_REF_DOKWA_WALUTA");
});
modelBuilder.Entity<DokDodKth>(entity =>
{
entity.HasKey(e => new { e.DokId, e.Znaczenie })
.HasName("PK_DOKDODKTH");
entity.ToTable("DokDodKth");
entity.HasIndex(e => e.KontrId, "idx_DDKth");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Dok)
.WithMany(p => p.DokDodKths)
.HasForeignKey(d => d.DokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOKDODKT_REF_DDK_DOK");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.DokDodKths)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOKDODKT_REF_DKD_KONTRAHE");
});
modelBuilder.Entity<DokKasa>(entity =>
{
entity.HasKey(e => e.DokId)
.HasName("PK_DOKKASA");
entity.ToTable("DokKasa");
entity.HasIndex(e => e.KasaId, "idx_DokKasaId");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KasaId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Dok)
.WithOne(p => p.DokKasa)
.HasForeignKey<DokKasa>(d => d.DokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOKKASA_REF_DOKKA_DOK");
entity.HasOne(d => d.Kasa)
.WithMany(p => p.DokKasas)
.HasForeignKey(d => d.KasaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOKKASA_REF_KASA_KASA");
});
modelBuilder.Entity<DokKontoBankowe>(entity =>
{
entity.HasKey(e => new { e.DokId, e.Kbid });
entity.ToTable("DokKontoBankowe");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kbid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("KBId");
entity.HasOne(d => d.Dok)
.WithMany(p => p.DokKontoBankowes)
.HasForeignKey(d => d.DokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOKKONTOBANK_DOK");
entity.HasOne(d => d.Kb)
.WithMany(p => p.DokKontoBankowes)
.HasForeignKey(d => d.Kbid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOKKONTOBANK_KONTOBANK");
});
modelBuilder.Entity<DokKontr>(entity =>
{
entity.HasKey(e => e.DokId)
.HasName("PK_DOKKONTR");
entity.ToTable("DokKontr");
entity.HasIndex(e => e.KontrId, "idx_DokKontrId");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Dok)
.WithOne(p => p.DokKontr)
.HasForeignKey<DokKontr>(d => d.DokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOKKONTR_REF_DOKKO_DOK");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.DokKontrs)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOKKONTR_REF_KONTR_KONTRAHE");
});
modelBuilder.Entity<DokKur>(entity =>
{
entity.HasKey(e => new { e.DokId, e.Znaczenie })
.HasName("PK_DOKKURS");
entity.HasIndex(e => e.WalId, "idx_DokKursWal");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Data).HasColumnType("datetime");
entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NrTabeli)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.WalId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Dok)
.WithMany(p => p.DokKurs)
.HasForeignKey(d => d.DokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOKKURS_DOK");
entity.HasOne(d => d.Wal)
.WithMany(p => p.DokKurs)
.HasForeignKey(d => d.WalId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOKKURS_WAL");
});
modelBuilder.Entity<DokPunkty>(entity =>
{
entity.HasKey(e => new { e.DokId, e.Typ })
.HasName("PK_DOKPUNKTY");
entity.ToTable("DokPunkty");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kiedy).HasColumnType("datetime");
entity.Property(e => e.Kwota).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Dok)
.WithMany(p => p.DokPunkties)
.HasForeignKey(d => d.DokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOKPUNKT_REF_DOKPK_DOK");
});
modelBuilder.Entity<DokWalutum>(entity =>
{
entity.HasKey(e => new { e.DokId, e.WalId })
.HasName("PK_DOKWALUTA");
entity.HasIndex(e => e.WalId, "idx_WalDok");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.WalId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DokKwota).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
entity.Property(e => e.WalKwota).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Dok)
.WithMany(p => p.DokWaluta)
.HasForeignKey(d => d.DokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOKWALUT_REF_DOKWA_DOK");
entity.HasOne(d => d.Wal)
.WithMany(p => p.DokWaluta)
.HasForeignKey(d => d.WalId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOKWALUT_REF_WALDO_WALUTA");
});
modelBuilder.Entity<DostProd>(entity =>
{
entity.HasKey(e => new { e.DostId, e.ProdId })
.HasName("PK_DOSTPROD");
entity.ToTable("DostProd");
entity.Property(e => e.DostId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ProdId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RabatProd).HasColumnType("decimal(10, 4)");
entity.HasOne(d => d.Dost)
.WithMany(p => p.DostProdDosts)
.HasForeignKey(d => d.DostId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_DostPrKth");
entity.HasOne(d => d.Prod)
.WithMany(p => p.DostProdProds)
.HasForeignKey(d => d.ProdId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_PrDostKth");
});
modelBuilder.Entity<Dostawca>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.TowId })
.HasName("PK_DOSTAWCA");
entity.ToTable("Dostawca");
entity.HasIndex(e => e.TowId, "idx_DostTowId");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CenaZak).HasColumnType("decimal(15, 4)");
entity.Property(e => e.RabatOdWart).HasColumnType("decimal(10, 4)");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.Dostawcas)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOSTAWCA_REF_KTHDO_KONTRAHE");
entity.HasOne(d => d.Tow)
.WithMany(p => p.Dostawcas)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_DOSTAWCA_REF_TOWDO_TOWAR");
});
modelBuilder.Entity<DzienRozl>(entity =>
{
entity.HasKey(e => e.Dzien)
.HasName("PK_DZIENROZL");
entity.ToTable("DzienRozl");
entity.HasIndex(e => e.Zmiana, "idx_DzienZmiana");
entity.Property(e => e.Dzien).HasColumnType("datetime");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<DzienRozlParam>(entity =>
{
entity.HasKey(e => new { e.Dzien, e.Znaczenie })
.HasName("PK_DZIENROZLPARAM");
entity.ToTable("DzienRozlParam");
entity.Property(e => e.Dzien).HasColumnType("datetime");
entity.Property(e => e.Wartosc)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.DzienNavigation)
.WithMany(p => p.DzienRozlParams)
.HasForeignKey(d => d.Dzien)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_DzienRozlPar");
});
modelBuilder.Entity<FormZgod>(entity =>
{
entity.HasKey(e => new { e.TypOsId, e.ZgId })
.HasName("PK_FORMZGOD");
entity.ToTable("FormZgod");
entity.HasIndex(e => e.ZgId, "idx_FMZG_ZGODA");
entity.Property(e => e.TypOsId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ZgId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.TypOs)
.WithMany(p => p.FormZgods)
.HasForeignKey(d => d.TypOsId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_FMZG_TYPOS");
entity.HasOne(d => d.Zg)
.WithMany(p => p.FormZgods)
.HasForeignKey(d => d.ZgId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_FMZG_ZGODA");
});
modelBuilder.Entity<FormaPlatnPos7>(entity =>
{
entity.HasKey(e => e.FormaId);
entity.ToTable("FormaPlatnPos7");
entity.Property(e => e.FormaId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrFormaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kolejnosc).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.SerwisPlatniczy)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<FormaPlatnosci>(entity =>
{
entity.HasKey(e => e.FormaPlat)
.HasName("PK_FORMAPLATNOSCI");
entity.ToTable("FormaPlatnosci");
entity.Property(e => e.FormaPlat).ValueGeneratedNever();
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
});
modelBuilder.Entity<GrWartosc>(entity =>
{
entity.HasKey(e => new { e.GrId, e.ParId, e.Wartosc })
.HasName("PK_GRWARTOSC");
entity.ToTable("GrWartosc");
entity.Property(e => e.GrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Gr)
.WithMany(p => p.GrWartoscs)
.HasForeignKey(d => d.GrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_GRWARTOS_REF_GRWAR_GRUPATOW");
entity.HasOne(d => d.Par)
.WithMany(p => p.GrWartoscs)
.HasForeignKey(d => d.ParId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_GRWARTOS_REF_PARGR_PARAMETR");
});
modelBuilder.Entity<GrupaAkcyzowa>(entity =>
{
entity.HasKey(e => e.GrAkcId)
.HasName("PK_GRUPAAKCYZOWA");
entity.ToTable("GrupaAkcyzowa");
entity.Property(e => e.GrAkcId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.AkcJm)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("AkcJM");
entity.Property(e => e.CentrGrAkcId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DodJm)
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("DodJM");
entity.Property(e => e.IleDodJmwakcJm)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleDodJMWAkcJM");
entity.Property(e => e.Kod)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.OpcjeWzoru)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Opis)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.PrefiksyCn)
.HasMaxLength(255)
.IsUnicode(false)
.HasColumnName("PrefiksyCN");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<GrupaTow>(entity =>
{
entity.HasKey(e => e.GrId)
.HasName("PK_GRUPATOW");
entity.ToTable("GrupaTow");
entity.Property(e => e.GrId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Opis)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
});
modelBuilder.Entity<GrupaUz>(entity =>
{
entity.HasKey(e => e.UzId)
.HasName("PK_GRUPAUZ");
entity.ToTable("GrupaUz");
entity.HasIndex(e => e.RolaId, "idx_Rola");
entity.Property(e => e.UzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RolaId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Rola)
.WithMany(p => p.GrupaUzRolas)
.HasForeignKey(d => d.RolaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_GRUPAUZ_REF_GRROL_UZYTKOWN");
entity.HasOne(d => d.Uz)
.WithOne(p => p.GrupaUzUz)
.HasForeignKey<GrupaUz>(d => d.UzId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_GRUPAUZ_REF_GRUZ_UZYTKOWN");
});
modelBuilder.Entity<HarmCeny>(entity =>
{
entity.HasKey(e => new { e.HarmId, e.TowId })
.HasName("PK_HARMCENY");
entity.ToTable("HarmCeny");
entity.HasIndex(e => e.TowId, "idx_HarmTow");
entity.Property(e => e.HarmId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Cena5).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Cena6).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaDet).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaDod).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaHurt).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaNoc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Inne)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.ProgPromocji).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Harm)
.WithMany(p => p.HarmCenies)
.HasForeignKey(d => d.HarmId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_HARMCENY_REF_HARMC_HARMWPIS");
entity.HasOne(d => d.Tow)
.WithMany(p => p.HarmCenies)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_HARMCENY_REF_HARMT_TOWAR");
});
modelBuilder.Entity<HarmCykl>(entity =>
{
entity.HasKey(e => new { e.HarmId, e.OdDnia, e.OdGodz, e.OdMin })
.HasName("PK_HARMCYKL");
entity.ToTable("HarmCykl");
entity.Property(e => e.HarmId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Harm)
.WithMany(p => p.HarmCykls)
.HasForeignKey(d => d.HarmId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_HARMCYKL");
});
modelBuilder.Entity<HarmHarm>(entity =>
{
entity.HasKey(e => new { e.HarmId, e.Znaczenie })
.HasName("PK_HARMHARM");
entity.ToTable("HarmHarm");
entity.Property(e => e.HarmId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.PoprzHarmId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Harm)
.WithMany(p => p.HarmHarmHarms)
.HasForeignKey(d => d.HarmId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_HARMHARM");
entity.HasOne(d => d.PoprzHarm)
.WithMany(p => p.HarmHarmPoprzHarms)
.HasForeignKey(d => d.PoprzHarmId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_HARMPOPRZHARM");
});
modelBuilder.Entity<HarmWpi>(entity =>
{
entity.HasKey(e => e.HarmId)
.HasName("PK_HARMWPIS");
entity.HasIndex(e => new { e.KrajId, e.HarmId }, "idx_HarmKraj");
entity.HasIndex(e => e.PolId, "idx_HarmPol");
entity.Property(e => e.HarmId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrHarmId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KrajId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Opcje)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.PolId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.WaznyDo).HasColumnType("datetime");
entity.Property(e => e.WaznyOd).HasColumnType("datetime");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Kraj)
.WithMany(p => p.HarmWpis)
.HasForeignKey(d => d.KrajId)
.HasConstraintName("FK_Ref_HarmKraj");
entity.HasOne(d => d.Pol)
.WithMany(p => p.HarmWpis)
.HasForeignKey(d => d.PolId)
.HasConstraintName("FK_HARMWPIS_REF_HARMP_POLITYKA");
});
modelBuilder.Entity<Istw>(entity =>
{
entity.HasKey(e => new { e.TowId, e.MagId })
.HasName("PK_ISTW");
entity.ToTable("Istw");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.BlokadaMag).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaMag).HasColumnType("decimal(15, 4)");
entity.Property(e => e.RezerwacjaMag).HasColumnType("decimal(15, 4)");
entity.Property(e => e.StanMag).HasColumnType("decimal(15, 4)");
entity.Property(e => e.StanMax).HasColumnType("decimal(15, 4)");
entity.Property(e => e.StanMin).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Mag)
.WithMany(p => p.Istws)
.HasForeignKey(d => d.MagId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ISTW_REF_ISTWM_MAGAZYN");
entity.HasOne(d => d.Tow)
.WithMany(p => p.Istws)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ISTW_REF_TOWIS_TOWAR");
});
modelBuilder.Entity<Jm>(entity =>
{
entity.ToTable("JM");
entity.HasIndex(e => e.CentrJmid, "idx_CentrJMId");
entity.Property(e => e.Jmid)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd()
.HasColumnName("JMId");
entity.Property(e => e.CentrJmid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("CentrJMId");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(10)
.IsUnicode(false);
});
modelBuilder.Entity<KartaLoj>(entity =>
{
entity.HasKey(e => e.KartaId)
.HasName("PK_KARTALOJ");
entity.ToTable("KartaLoj");
entity.HasIndex(e => e.KodKarty, "idx_KLoj_KodKarty");
entity.HasIndex(e => e.KontoId, "idx_KLoj_Konto");
entity.Property(e => e.KartaId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrKartaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KodKarty)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.KontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Opis1)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Opis2)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Posiadacz)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Uniewazniono).HasColumnType("datetime");
entity.Property(e => e.WaznaDo).HasColumnType("datetime");
entity.Property(e => e.WaznaOd).HasColumnType("datetime");
entity.HasOne(d => d.Konto)
.WithMany(p => p.KartaLojs)
.HasForeignKey(d => d.KontoId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_KartaKonto");
});
modelBuilder.Entity<KasKod>(entity =>
{
entity.HasKey(e => new { e.KasaId, e.TowId, e.Kolejnosc })
.HasName("PK_KASKOD");
entity.ToTable("KasKod");
entity.HasIndex(e => new { e.TowId, e.Kolejnosc }, "idx_KasKodTow");
entity.Property(e => e.KasaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.IleWkodzie)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleWKodzie");
entity.Property(e => e.KasPrefPlu).HasColumnName("KasPrefPLU");
entity.Property(e => e.Kod)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.KodOpak)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Plu).HasColumnName("PLU");
entity.Property(e => e.Pluopak).HasColumnName("PLUOpak");
entity.Property(e => e.Rezerwa)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Skrot)
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.Kasa)
.WithMany(p => p.KasKods)
.HasForeignKey(d => d.KasaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KASKOD_REF_KASKO_KASA");
entity.HasOne(d => d.Tow)
.WithMany(p => p.KasKods)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KASKOD_REF_KASKO_TOWAR");
});
modelBuilder.Entity<KasPar>(entity =>
{
entity.HasKey(e => new { e.KasaId, e.ParNazwa })
.HasName("PK_KASPAR");
entity.ToTable("KasPar");
entity.Property(e => e.KasaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ParNazwa)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.ParWartosc)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Kasa)
.WithMany(p => p.KasPars)
.HasForeignKey(d => d.KasaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KASPAR_REF_KASPA_KASA");
});
modelBuilder.Entity<KasTow>(entity =>
{
entity.HasKey(e => new { e.KasaId, e.KodWyslany })
.HasName("PK_KASTOW");
entity.ToTable("KasTow");
entity.HasIndex(e => new { e.KasaId, e.Plu, e.DodIndeks }, "idx_KasTowKasaPluDodIndeks");
entity.HasIndex(e => e.TowId, "idx_KasTowTowId");
entity.Property(e => e.KasaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KodWyslany)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Kasa)
.WithMany(p => p.KasTows)
.HasForeignKey(d => d.KasaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KASTOW_REF_KASKO_KASA");
entity.HasOne(d => d.Tow)
.WithMany(p => p.KasTows)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KASTOW_REF_KASTO_TOWAR");
});
modelBuilder.Entity<Kasa>(entity =>
{
entity.ToTable("Kasa");
entity.Property(e => e.KasaId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Stanowisko)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Typ)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.Mag)
.WithMany(p => p.Kasas)
.HasForeignKey(d => d.MagId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KASA_REF_KASAM_MAGAZYN");
});
modelBuilder.Entity<KasaFormaPlatn>(entity =>
{
entity.HasKey(e => new { e.FormaId, e.KasaId });
entity.ToTable("KasaFormaPlatn");
entity.Property(e => e.FormaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KasaId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Forma)
.WithMany(p => p.KasaFormaPlatns)
.HasForeignKey(d => d.FormaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KASAFORMAPLATN_FPP7");
entity.HasOne(d => d.Kasa)
.WithMany(p => p.KasaFormaPlatns)
.HasForeignKey(d => d.KasaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KASAFORMAPLATN_KASA");
});
modelBuilder.Entity<KatParam>(entity =>
{
entity.HasKey(e => new { e.KatId, e.ParId })
.HasName("PK_KATPARAM");
entity.ToTable("KatParam");
entity.HasIndex(e => e.KatId, "idx_KatParKat");
entity.HasIndex(e => e.ParId, "idx_KatParPar");
entity.Property(e => e.KatId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Kat)
.WithMany(p => p.KatParams)
.HasForeignKey(d => d.KatId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KATPARAM_REF_KATPA_KATEGORI");
entity.HasOne(d => d.Par)
.WithMany(p => p.KatParams)
.HasForeignKey(d => d.ParId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KATPARAM_REF_PARKA_PARAMETR");
});
modelBuilder.Entity<Kategorium>(entity =>
{
entity.HasKey(e => e.KatId)
.HasName("PK_KATEGORIA");
entity.HasIndex(e => e.CentrKatId, "idx_CentrKatId");
entity.Property(e => e.KatId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrKatId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
});
modelBuilder.Entity<KodDod>(entity =>
{
entity.HasKey(e => new { e.TowId, e.Kolejnosc })
.HasName("PK_KODDOD");
entity.ToTable("KodDod");
entity.HasIndex(e => e.Kod, "idx_KodDodKod");
entity.HasIndex(e => e.Skrot, "idx_KodDodSkrot");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.IleWkodzie)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleWKodzie");
entity.Property(e => e.Kod)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.PrefPlu).HasColumnName("PrefPLU");
entity.Property(e => e.Skrot)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.SubsysKoduDod)
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.Tow)
.WithMany(p => p.KodDods)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KODDOD_REF_KODDO_TOWAR");
});
modelBuilder.Entity<KodWazony>(entity =>
{
entity.HasKey(e => e.Kwid)
.HasName("PK_KODWAZONY");
entity.ToTable("KodWazony");
entity.HasIndex(e => e.CentrKwid, "idx_CentrKWId");
entity.Property(e => e.Kwid)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd()
.HasColumnName("KWId");
entity.Property(e => e.CentrKwid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("CentrKWId");
entity.Property(e => e.Jmid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("JMId");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.PrecyzjaWkodzie).HasColumnName("PrecyzjaWKodzie");
entity.Property(e => e.WartoscWkodzie).HasColumnName("WartoscWKodzie");
entity.HasOne(d => d.Jm)
.WithMany(p => p.KodWazonies)
.HasForeignKey(d => d.Jmid)
.HasConstraintName("Ref_KodWazony");
});
modelBuilder.Entity<Komentarz>(entity =>
{
entity.HasKey(e => e.ZmId)
.HasName("PK_KOMENTARZ");
entity.ToTable("Komentarz");
entity.Property(e => e.ZmId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Opis)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Zm)
.WithOne(p => p.Komentarz)
.HasForeignKey<Komentarz>(d => d.ZmId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KOMENTAR_REF_ZMKOM_ZMIANA");
});
modelBuilder.Entity<Konfig>(entity =>
{
entity.HasKey(e => new { e.ParGrupa, e.ParNazwa })
.HasName("PK_KONFIG");
entity.ToTable("Konfig");
entity.Property(e => e.ParGrupa)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.ParNazwa)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.ParWartosc)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
});
modelBuilder.Entity<KontoBankowe>(entity =>
{
entity.HasKey(e => e.Kbid);
entity.ToTable("KontoBankowe");
entity.Property(e => e.Kbid)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd()
.HasColumnName("KBId");
entity.Property(e => e.BankId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrKbid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("CentrKBId");
entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Numer)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.PowKbid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PowKBId");
entity.Property(e => e.Sufix)
.IsRequired()
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.WalId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Bank)
.WithMany(p => p.KontoBankowes)
.HasForeignKey(d => d.BankId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KONTOBANK_BANK");
entity.HasOne(d => d.Mag)
.WithMany(p => p.KontoBankowes)
.HasForeignKey(d => d.MagId)
.HasConstraintName("FK_KONTOBANK_MAGAZYN");
entity.HasOne(d => d.Wal)
.WithMany(p => p.KontoBankowes)
.HasForeignKey(d => d.WalId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KONTOBANK_WALUTA");
});
modelBuilder.Entity<KontoBankoweKontr>(entity =>
{
entity.HasKey(e => e.Kbkid);
entity.ToTable("KontoBankoweKontr");
entity.Property(e => e.Kbkid)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd()
.HasColumnName("KBKId");
entity.Property(e => e.BankId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrKbkid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("CentrKBKId");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Numer)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.PowKbkid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PowKBKId");
entity.Property(e => e.WalId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Bank)
.WithMany(p => p.KontoBankoweKontrs)
.HasForeignKey(d => d.BankId)
.HasConstraintName("FK_KONTOBANKKONTR_BANK");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.KontoBankoweKontrs)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KONTOBANKKONTR_KONTR");
entity.HasOne(d => d.Wal)
.WithMany(p => p.KontoBankoweKontrs)
.HasForeignKey(d => d.WalId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KONTOBANKKONTR_WALUTA");
});
modelBuilder.Entity<KontoLoj>(entity =>
{
entity.HasKey(e => e.KontoId)
.HasName("PK_KONTOLOJ");
entity.ToTable("KontoLoj");
entity.HasIndex(e => e.KontrId, "idx_KLoj_KontrId");
entity.HasIndex(e => e.ZmianaStanu, "idx_KLoj_ZmStanu");
entity.HasIndex(e => e.Zmiana, "idx_KLoj_Zmiana");
entity.Property(e => e.KontoId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrKontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Stan).HasColumnType("decimal(15, 4)");
entity.Property(e => e.StanPocz).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.Property(e => e.ZmianaStanu).HasColumnType("datetime");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.KontoLojs)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_KontoKth");
});
modelBuilder.Entity<KontrOpi>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.Znaczenie })
.HasName("PK_KONTROPIS");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Kontr)
.WithMany(p => p.KontrOpis)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KONTROPI_REF_KTHOP_KONTRAHE");
});
modelBuilder.Entity<Kontrahent>(entity =>
{
entity.HasKey(e => e.KontrId)
.HasName("PK_KONTRAHENT");
entity.ToTable("Kontrahent");
entity.HasIndex(e => e.IndeksCentr, "idx_KontrIndCentr");
entity.HasIndex(e => e.Nip, "idx_KontrNIP");
entity.HasIndex(e => e.Zmiana, "idx_KontrZmiana");
entity.Property(e => e.KontrId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.AkwId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Bank)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.CentrKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Email)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false)
.HasColumnName("EMail");
entity.Property(e => e.Fax)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.IndeksCentr)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Kod)
.IsRequired()
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.KodKarty)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.KodKontr)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Konto)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.KontrKrajId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.MaxKredyt).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Miasto)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.NaPrzelewie1)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.NaPrzelewie2)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Nip)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false)
.HasColumnName("NIP");
entity.Property(e => e.NrAnalityki)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.NrDomu)
.HasMaxLength(9)
.IsUnicode(false);
entity.Property(e => e.NrLokalu)
.HasMaxLength(9)
.IsUnicode(false);
entity.Property(e => e.Poczta)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.RabatDost).HasColumnType("decimal(10, 4)");
entity.Property(e => e.RabatOdb).HasColumnType("decimal(10, 4)");
entity.Property(e => e.Rezerwa1)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Rezerwa2)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Skrot)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Telefon)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.TermWaznKarty).HasColumnType("datetime");
entity.Property(e => e.Ulica)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Akw)
.WithMany(p => p.Kontrahents)
.HasForeignKey(d => d.AkwId)
.HasConstraintName("FK_KONTRAHE_REF_KTHAK_AKWIZYTO");
entity.HasOne(d => d.KontrKraj)
.WithMany(p => p.Kontrahents)
.HasForeignKey(d => d.KontrKrajId)
.HasConstraintName("FK_Ref_KontrahentKraj");
});
modelBuilder.Entity<Kraj>(entity =>
{
entity.ToTable("Kraj");
entity.Property(e => e.KrajId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.Aktywny).HasDefaultValueSql("((1))");
entity.Property(e => e.Kod)
.IsRequired()
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.WalId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ZdjecieFlagi)
.HasMaxLength(100)
.IsUnicode(false);
entity.HasOne(d => d.Wal)
.WithMany(p => p.Krajs)
.HasForeignKey(d => d.WalId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_Ref_KrajWal");
});
modelBuilder.Entity<KrajStawka>(entity =>
{
entity.HasKey(e => new { e.KrajId, e.Stawka })
.HasName("PK_KRAJSTAWKA");
entity.ToTable("KrajStawka");
entity.Property(e => e.KrajId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Kraj)
.WithMany(p => p.KrajStawkas)
.HasForeignKey(d => d.KrajId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_Ref_KrajVat");
});
modelBuilder.Entity<KthParWartosc>(entity =>
{
entity.HasKey(e => e.Kpwid)
.HasName("PK_KTHPARWARTOSC");
entity.ToTable("KthParWartosc");
entity.HasIndex(e => e.KthParId, "idx_KPWPar");
entity.Property(e => e.Kpwid)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd()
.HasColumnName("KPWId");
entity.Property(e => e.KthParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.KthPar)
.WithMany(p => p.KthParWartoscs)
.HasForeignKey(d => d.KthParId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KTHPARWA_REF_KPWAR_KTHPARAM");
});
modelBuilder.Entity<KthParam>(entity =>
{
entity.HasKey(e => e.KthParId)
.HasName("PK_KTHPARAM");
entity.ToTable("KthParam");
entity.Property(e => e.KthParId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.KpwdomyslnaId)
.HasColumnType("numeric(9, 0)")
.HasColumnName("KPWDomyslnaId");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.Kpwdomyslna)
.WithMany(p => p.KthParams)
.HasForeignKey(d => d.KpwdomyslnaId)
.HasConstraintName("FK_KTHPARAM_REF_KPDOM_KTHPARWA");
});
modelBuilder.Entity<KthTypO>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.TypOsId })
.HasName("PK_KTHTYPOS");
entity.HasIndex(e => e.TypOsId, "idx_KTHTYPOS_TYPOS");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.TypOsId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.KthTypOs)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KTHTYPOS_KTH");
entity.HasOne(d => d.TypOs)
.WithMany(p => p.KthTypOs)
.HasForeignKey(d => d.TypOsId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KTHTYPOS_TYPOS");
});
modelBuilder.Entity<KthWartosc>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.Kpwid })
.HasName("PK_KTHWARTOSC");
entity.ToTable("KthWartosc");
entity.HasIndex(e => e.Kpwid, "idx_KWart");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kpwid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("KPWId");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.KthWartoscs)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KTHWARTO_REF_KTHWA_KONTRAHE");
entity.HasOne(d => d.Kpw)
.WithMany(p => p.KthWartoscs)
.HasForeignKey(d => d.Kpwid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KTHWARTO_REF_KWPAR_KTHPARWA");
});
modelBuilder.Entity<KursWaluty>(entity =>
{
entity.HasKey(e => new { e.WalId, e.Data })
.HasName("PK_KURSWALUTY");
entity.ToTable("KursWaluty");
entity.Property(e => e.WalId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Data).HasColumnType("datetime");
entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
entity.Property(e => e.KursZak).HasColumnType("decimal(15, 4)");
entity.Property(e => e.KursZakZr).HasColumnType("decimal(15, 4)");
entity.Property(e => e.KursZr).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NrTabeli)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.NrTabeliZak)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Spread).HasColumnType("decimal(15, 4)");
entity.Property(e => e.SpreadZak).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Wal)
.WithMany(p => p.KursWaluties)
.HasForeignKey(d => d.WalId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_KURSWAL_REFERENCE_WAL");
});
modelBuilder.Entity<LiniaLotnicza>(entity =>
{
entity.HasKey(e => e.LiniaId)
.HasName("PK_LINIALOTN");
entity.ToTable("LiniaLotnicza");
entity.HasIndex(e => e.Kod, "idx_LinLotKod");
entity.HasIndex(e => e.Zmiana, "idx_LinLotZmiana");
entity.Property(e => e.LiniaId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.Kod)
.IsRequired()
.HasMaxLength(16)
.IsUnicode(false);
entity.Property(e => e.Nazwa)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<LogOperation>(entity =>
{
entity.HasKey(e => e.OperationId)
.HasName("PK_LOGOPERATION");
entity.ToTable("LogOperation");
entity.Property(e => e.OperationId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.AdditionalDesc)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.AppTypeId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.LastUpdate).HasColumnType("datetime");
entity.Property(e => e.ModItemId)
.HasMaxLength(30)
.IsUnicode(false);
entity.Property(e => e.ModTableTypeId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ModuleTypeId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.OperationTime).HasColumnType("datetime");
entity.Property(e => e.OperationTypeId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.OperatorId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.PosId).HasColumnType("numeric(9, 0)");
});
modelBuilder.Entity<LogTypeDef>(entity =>
{
entity.HasKey(e => e.TypeId)
.HasName("PK_LOGTYPEDEF");
entity.ToTable("LogTypeDef");
entity.Property(e => e.TypeId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.LastUpdate).HasColumnType("datetime");
entity.Property(e => e.TypeCategory)
.HasMaxLength(50)
.IsUnicode(false);
entity.Property(e => e.TypeValue)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
});
modelBuilder.Entity<LogValChangeNum>(entity =>
{
entity.HasKey(e => e.ValChangeId)
.HasName("PK_LOGVALCHANGENUM");
entity.ToTable("LogValChangeNum");
entity.Property(e => e.ValChangeId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.LastUpdate).HasColumnType("datetime");
entity.Property(e => e.OperationId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ValChangeTypeId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ValueAfter).HasColumnType("decimal(15, 4)");
entity.Property(e => e.ValueBefore).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Operation)
.WithMany(p => p.LogValChangeNums)
.HasForeignKey(d => d.OperationId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_LOGVALCH_REFERENCE_LOGOPERB");
});
modelBuilder.Entity<LogValChangeTxt>(entity =>
{
entity.HasKey(e => e.ValChangeId)
.HasName("PK_LOGVALCHANGETXT");
entity.ToTable("LogValChangeTxt");
entity.Property(e => e.ValChangeId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.LastUpdate).HasColumnType("datetime");
entity.Property(e => e.OperationId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ValChangeTypeId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ValueAfter)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.ValueBefore)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Operation)
.WithMany(p => p.LogValChangeTxts)
.HasForeignKey(d => d.OperationId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_LOGVALCH_REFERENCE_LOGOPERA");
});
modelBuilder.Entity<Lotnisko>(entity =>
{
entity.HasKey(e => e.LotnId)
.HasName("PK_LOTNISKO");
entity.ToTable("Lotnisko");
entity.HasIndex(e => e.Kod, "idx_LotnKod");
entity.HasIndex(e => e.Zmiana, "idx_LotnZmiana");
entity.Property(e => e.LotnId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.Kod)
.IsRequired()
.HasMaxLength(16)
.IsUnicode(false);
entity.Property(e => e.Kraj)
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Nazwa)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<Magazyn>(entity =>
{
entity.HasKey(e => e.MagId)
.HasName("PK_MAGAZYN");
entity.ToTable("Magazyn");
entity.Property(e => e.MagId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
});
modelBuilder.Entity<MarZakre>(entity =>
{
entity.HasKey(e => new { e.MarId, e.OdCeny })
.HasName("PK_MARZAKRES");
entity.Property(e => e.MarId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.OdCeny).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Koncowki)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Mar)
.WithMany(p => p.MarZakres)
.HasForeignKey(d => d.MarId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_MARZAKRE_REF_MARZA_MARZOWNI");
});
modelBuilder.Entity<Marzownik>(entity =>
{
entity.HasKey(e => e.MarId)
.HasName("PK_MARZOWNIK");
entity.ToTable("Marzownik");
entity.HasIndex(e => e.AsId, "idxMarAs");
entity.HasIndex(e => e.MagId, "idxMarMag");
entity.HasIndex(e => e.TowId, "idxMarTow");
entity.Property(e => e.MarId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.AsId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.MinMarzaOd100).HasColumnType("decimal(10, 4)");
entity.Property(e => e.MinMarzaW100).HasColumnType("decimal(10, 4)");
entity.Property(e => e.ModOd100).HasColumnType("decimal(10, 4)");
entity.Property(e => e.ModW100).HasColumnType("decimal(10, 4)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.As)
.WithMany(p => p.Marzowniks)
.HasForeignKey(d => d.AsId)
.HasConstraintName("FK_MARZOWNI_REF_MARAS_ASORT");
entity.HasOne(d => d.Mag)
.WithMany(p => p.Marzowniks)
.HasForeignKey(d => d.MagId)
.HasConstraintName("FK_MARZOWNI_REF_MARMA_MAGAZYN");
entity.HasOne(d => d.Tow)
.WithMany(p => p.Marzowniks)
.HasForeignKey(d => d.TowId)
.HasConstraintName("FK_MARZOWNI_REF_MARTO_TOWAR");
});
modelBuilder.Entity<Notatki>(entity =>
{
entity.HasKey(e => new { e.TowId, e.Kolejnosc })
.HasName("PK_NOTATKI");
entity.ToTable("Notatki");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Tow)
.WithMany(p => p.Notatkis)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_NOTATKI_REF_TOWNO_TOWAR");
});
modelBuilder.Entity<NrRej>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.NrFormat })
.HasName("PK_NRREJ");
entity.ToTable("NrRej");
entity.HasIndex(e => new { e.NrFormat, e.KontrId }, "idx_NumerRej");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.NrFormat)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.NrWpisany)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.HasOne(d => d.Kontr)
.WithMany(p => p.NrRejs)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_NrRejKth");
});
modelBuilder.Entity<NrRejKartum>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.NrFormat, e.KartaId })
.HasName("PK_NRREJKARTA");
entity.HasIndex(e => new { e.KartaId, e.KontrId, e.NrFormat }, "idx_NrRejKartaId");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.NrFormat)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.KartaId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Karta)
.WithMany(p => p.NrRejKarta)
.HasForeignKey(d => d.KartaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_KartaNrRej");
entity.HasOne(d => d.NrRej)
.WithMany(p => p.NrRejKarta)
.HasForeignKey(d => new { d.KontrId, d.NrFormat })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_NrRejKarta");
});
modelBuilder.Entity<NumDok>(entity =>
{
entity.HasKey(e => e.TypNumeru)
.HasName("PK_NUMDOK");
entity.ToTable("NumDok");
entity.Property(e => e.TypNumeru).ValueGeneratedNever();
entity.Property(e => e.Format)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
});
modelBuilder.Entity<NumMag>(entity =>
{
entity.HasKey(e => new { e.TypNumeru, e.MagId })
.HasName("PK_NUMMAG");
entity.ToTable("NumMag");
entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Format)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Mag)
.WithMany(p => p.NumMags)
.HasForeignKey(d => d.MagId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_NUMMAG_REF_NUMMA_MAGAZYN");
entity.HasOne(d => d.TypNumeruNavigation)
.WithMany(p => p.NumMags)
.HasForeignKey(d => d.TypNumeru)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_NUMMAG_REF_NUMMA_NUMDOK");
});
modelBuilder.Entity<OdbProd>(entity =>
{
entity.HasKey(e => new { e.OdbId, e.ProdId })
.HasName("PK_ODBPROD");
entity.ToTable("OdbProd");
entity.Property(e => e.OdbId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ProdId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RabatProd).HasColumnType("decimal(10, 4)");
entity.HasOne(d => d.Odb)
.WithMany(p => p.OdbProdOdbs)
.HasForeignKey(d => d.OdbId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ODBPROD_REF_ODBPR_KONTRAHE");
entity.HasOne(d => d.Prod)
.WithMany(p => p.OdbProdProds)
.HasForeignKey(d => d.ProdId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ODBPROD_REF_PRODO_KONTRAHE");
});
modelBuilder.Entity<Odbiorca>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.TowId })
.HasName("PK_ODBIORCA");
entity.ToTable("Odbiorca");
entity.HasIndex(e => e.TowId, "idx_OdbTowId");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Indeks)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Nazwa)
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.RabatTow).HasColumnType("decimal(10, 4)");
entity.Property(e => e.StalaCena).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Zamowil).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.Odbiorcas)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ODBIORCA_REF_KTHOD_KONTRAHE");
entity.HasOne(d => d.Tow)
.WithMany(p => p.Odbiorcas)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ODBIORCA_REF_TOWOD_TOWAR");
});
modelBuilder.Entity<OfKod>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.OfId, e.Kolejnosc })
.HasName("PK_OFKOD");
entity.ToTable("OfKod");
entity.HasIndex(e => new { e.KontrId, e.Kod }, "idx_OfKthKod");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.OfId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kod)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.HasOne(d => d.Ofertum)
.WithMany(p => p.OfKods)
.HasForeignKey(d => new { d.KontrId, d.OfId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_OFKOD_REF_OFKOD_OFERTA");
});
modelBuilder.Entity<OfSlownik>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.Typ, e.Opis })
.HasName("PK_OFSLOWNIK");
entity.ToTable("OfSlownik");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Opis)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Id).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.OfSlowniks)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_OFSLOWNI_REF_OFSLO_KONTRAHE");
});
modelBuilder.Entity<Ofertum>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.OfId })
.HasName("PK_OFERTA");
entity.HasIndex(e => e.TowId, "idx_OfTow");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.OfId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Asortyment)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Cena).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Cku)
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("CKU");
entity.Property(e => e.Indeks1)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Indeks2)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Jm)
.HasMaxLength(10)
.IsUnicode(false)
.HasColumnName("JM");
entity.Property(e => e.Kategoria)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Nazwa)
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Opis1)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Opis2)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Opis3)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Opis4)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Przelicznik).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Skrot)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.Oferta)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_OFERTA_REF_OFKON_KONTRAHE");
entity.HasOne(d => d.Tow)
.WithMany(p => p.Oferta)
.HasForeignKey(d => d.TowId)
.HasConstraintName("FK_OFERTA_REF_OFTOW_TOWAR");
});
modelBuilder.Entity<OpisZdarzLoj>(entity =>
{
entity.HasKey(e => new { e.ZdarzLojId, e.Znaczenie, e.Kolejnosc })
.HasName("PK_OPISZDARZLOJ");
entity.ToTable("OpisZdarzLoj");
entity.Property(e => e.ZdarzLojId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ParamN1).HasColumnType("decimal(15, 4)");
entity.Property(e => e.ParamN2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.ParamS1)
.HasMaxLength(64)
.IsUnicode(false);
entity.HasOne(d => d.ZdarzLoj)
.WithMany(p => p.OpisZdarzLojs)
.HasForeignKey(d => d.ZdarzLojId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_OpisZdarzLojZdarzLoj");
});
modelBuilder.Entity<Oplatum>(entity =>
{
entity.HasKey(e => e.OplataId);
entity.HasIndex(e => new { e.DataOd, e.DataDo }, "IxOplata_DataOd");
entity.HasIndex(e => e.Zmiana, "IxOplata_Zmiana");
entity.Property(e => e.OplataId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrOplataId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DataDo).HasColumnType("datetime");
entity.Property(e => e.DataOd).HasColumnType("datetime");
entity.Property(e => e.Kbid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("KBId");
entity.Property(e => e.Komentarz)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Kwota).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.StawkaProc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Kb)
.WithMany(p => p.Oplata)
.HasForeignKey(d => d.Kbid)
.HasConstraintName("FK_Oplata_KontoBank");
});
modelBuilder.Entity<Osoba>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.Nazwisko })
.HasName("PK_OSOBA");
entity.ToTable("Osoba");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwisko)
.HasMaxLength(60)
.IsUnicode(false);
entity.HasOne(d => d.Kontr)
.WithMany(p => p.Osobas)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_OSOBA_REF_OSOBA_KONTRAHE");
});
modelBuilder.Entity<Panel>(entity =>
{
entity.ToTable("Panel");
entity.Property(e => e.PanelId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrPanelId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.TypAplikacji).HasDefaultValueSql("((3))");
entity.Property(e => e.UzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.UzNsid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("UzNSId");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Uz)
.WithMany(p => p.Panels)
.HasForeignKey(d => d.UzId)
.HasConstraintName("FK_PANEL_REFERENCE_UZYTKOWNIK");
entity.HasOne(d => d.UzNs)
.WithMany(p => p.Panels)
.HasForeignKey(d => d.UzNsid)
.HasConstraintName("FK_PANEL_REFERENCE_UZNASKLEP");
});
modelBuilder.Entity<PanelParam>(entity =>
{
entity.HasKey(e => new { e.PanelId, e.ParNazwa })
.HasName("PK_PANELPARAM");
entity.ToTable("PanelParam");
entity.Property(e => e.PanelId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ParNazwa)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.ParWartosc)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Panel)
.WithMany(p => p.PanelParams)
.HasForeignKey(d => d.PanelId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PANELPARAM_REFERENCE_PANEL");
});
modelBuilder.Entity<ParBon>(entity =>
{
entity.HasKey(e => new { e.ParId, e.Kolejnosc })
.HasName("PK_PARBON");
entity.ToTable("ParBon");
entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kwota).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Numer)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Typ)
.IsRequired()
.HasMaxLength(10)
.IsUnicode(false);
entity.HasOne(d => d.Par)
.WithMany(p => p.ParBons)
.HasForeignKey(d => d.ParId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PARBON_REF_PARBO_PARAGON");
});
modelBuilder.Entity<ParPunkty>(entity =>
{
entity.HasKey(e => new { e.ParId, e.Typ })
.HasName("PK_PARPUNKTY");
entity.ToTable("ParPunkty");
entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kiedy).HasColumnType("datetime");
entity.Property(e => e.Kwota).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Par)
.WithMany(p => p.ParPunkties)
.HasForeignKey(d => d.ParId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PARPUNKT_REF_PARPK_PARAGON");
});
modelBuilder.Entity<ParWalutum>(entity =>
{
entity.HasKey(e => new { e.ParId, e.WalId })
.HasName("PK_PARWALUTA");
entity.HasIndex(e => e.WalId, "idx_WalPar");
entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.WalId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
entity.Property(e => e.ParKwota).HasColumnType("decimal(15, 4)");
entity.Property(e => e.WalKwota).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Par)
.WithMany(p => p.ParWaluta)
.HasForeignKey(d => d.ParId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PARWALUT_REF_PARWA_PARAGON");
entity.HasOne(d => d.Wal)
.WithMany(p => p.ParWaluta)
.HasForeignKey(d => d.WalId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PARWALUT_REF_WALPA_WALUTA");
});
modelBuilder.Entity<ParWartosc>(entity =>
{
entity.HasKey(e => new { e.ParId, e.Wartosc })
.HasName("PK_PARWARTOSC");
entity.ToTable("ParWartosc");
entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.Par)
.WithMany(p => p.ParWartoscs)
.HasForeignKey(d => d.ParId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PARWARTO_REF_PARWA_PARAMETR");
});
modelBuilder.Entity<Paragon>(entity =>
{
entity.HasKey(e => e.ParId)
.HasName("PK_PARAGON");
entity.ToTable("Paragon");
entity.HasIndex(e => e.DataCzas, "idx_ParDataCzas");
entity.HasIndex(e => e.Kasjer, "idx_ParKasjer");
entity.HasIndex(e => e.WalId, "idx_ParWal");
entity.HasIndex(e => e.Zmiana, "idx_ParZmiana");
entity.HasIndex(e => e.ZmianaPkt, "idx_ParZmianaPkt");
entity.Property(e => e.ParId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.Bony).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Brutto).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CechyPar)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Czek).HasColumnType("decimal(15, 4)");
entity.Property(e => e.DataCzas).HasColumnType("datetime");
entity.Property(e => e.DodFplat)
.HasColumnType("decimal(15, 4)")
.HasColumnName("DodFPlat");
entity.Property(e => e.EksportFk).HasColumnName("EksportFK");
entity.Property(e => e.Gotowka).HasColumnType("decimal(15, 4)");
entity.Property(e => e.GrupyGtu)
.HasMaxLength(255)
.IsUnicode(false)
.HasColumnName("GrupyGTU");
entity.Property(e => e.InneFplat)
.HasColumnType("decimal(15, 4)")
.HasColumnName("InneFPlat");
entity.Property(e => e.Karta).HasColumnType("decimal(15, 4)");
entity.Property(e => e.KasaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kasjer)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.KodKarty)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Nip)
.HasMaxLength(40)
.IsUnicode(false)
.HasColumnName("NIP");
entity.Property(e => e.OpakWyd).HasColumnType("decimal(15, 4)");
entity.Property(e => e.OpakZwr).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Przelew).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Rabat).HasColumnType("decimal(15, 4)");
entity.Property(e => e.WalId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Waluty).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.Property(e => e.ZmianaPkt).HasColumnType("datetime");
entity.HasOne(d => d.Kasa)
.WithMany(p => p.Paragons)
.HasForeignKey(d => d.KasaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PARAGON_REF_PARKA_KASA");
entity.HasOne(d => d.Wal)
.WithMany(p => p.Paragons)
.HasForeignKey(d => d.WalId)
.HasConstraintName("FK_PARAGON_REF_PARWA_WALUTA");
});
modelBuilder.Entity<Parametr>(entity =>
{
entity.HasKey(e => e.ParId)
.HasName("PK_PARAMETR");
entity.ToTable("Parametr");
entity.HasIndex(e => e.CentrParId, "idx_CentrParId");
entity.Property(e => e.ParId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
});
modelBuilder.Entity<Partium>(entity =>
{
entity.HasKey(e => new { e.DokId, e.Kolejnosc })
.HasName("PK_PARTIA");
entity.HasIndex(e => new { e.TypPartii, e.TowId, e.Pozostalo }, "idx_PrtTypTowIle");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Cecha1)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Cecha2)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.DataWazn).HasColumnType("datetime");
entity.Property(e => e.Pozostalo).HasColumnType("decimal(15, 4)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Tow)
.WithMany(p => p.Partia)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PARTIA_REF_PRTTO_TOWAR");
entity.HasOne(d => d.PozDok)
.WithOne(p => p.Partium)
.HasForeignKey<Partium>(d => new { d.DokId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PARTIA_REF_PRTPO_POZDOK");
});
modelBuilder.Entity<PcfUser>(entity =>
{
entity.ToTable("PcfUser");
entity.HasIndex(e => e.Ident, "IxIdent");
entity.Property(e => e.Email)
.HasMaxLength(64)
.IsUnicode(false)
.HasColumnName("EMail");
entity.Property(e => e.FirstName)
.HasMaxLength(32)
.IsUnicode(false);
entity.Property(e => e.Ident)
.IsRequired()
.HasMaxLength(32)
.IsUnicode(false);
entity.Property(e => e.LastName)
.HasMaxLength(64)
.IsUnicode(false);
entity.Property(e => e.PasswordHash)
.HasMaxLength(32)
.IsUnicode(false);
entity.Property(e => e.PcfCustomerId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.PcfLoyaltyCustomerId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.PcfPstationId)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PcfPStationId");
entity.Property(e => e.ValidFrom).HasColumnType("datetime");
entity.Property(e => e.ValidTo).HasColumnType("datetime");
entity.HasOne(d => d.PcfCustomer)
.WithMany(p => p.PcfUserPcfCustomers)
.HasForeignKey(d => d.PcfCustomerId)
.HasConstraintName("FK_PCFUSER_REFERENCE_KONTRC");
entity.HasOne(d => d.PcfLoyaltyCustomer)
.WithMany(p => p.PcfUserPcfLoyaltyCustomers)
.HasForeignKey(d => d.PcfLoyaltyCustomerId)
.HasConstraintName("FK_PCFUSER_REFERENCE_KONTRL");
entity.HasOne(d => d.PcfPstation)
.WithMany(p => p.PcfUserPcfPstations)
.HasForeignKey(d => d.PcfPstationId)
.HasConstraintName("FK_PCFUSER_REFERENCE_KONTRS");
});
modelBuilder.Entity<Ph>(entity =>
{
entity.ToTable("PH");
entity.HasIndex(e => e.KontrId, "idx_PHKth");
entity.Property(e => e.Phid)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd()
.HasColumnName("PHId");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.Phs)
.HasForeignKey(d => d.KontrId)
.HasConstraintName("FK_PH_REF_PHKON_KONTRAHE");
});
modelBuilder.Entity<Phdane>(entity =>
{
entity.HasKey(e => new { e.Phid, e.Znaczenie })
.HasName("PK_PHDANE");
entity.ToTable("PHDane");
entity.Property(e => e.Phid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PHId");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Ph)
.WithMany(p => p.Phdanes)
.HasForeignKey(d => d.Phid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PHDANE_REF_PHDAN_PH");
});
modelBuilder.Entity<PhodbDane>(entity =>
{
entity.HasKey(e => new { e.Phid, e.KontrId, e.Znaczenie })
.HasName("PK_PHODBDANE");
entity.ToTable("PHOdbDane");
entity.Property(e => e.Phid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PHId");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Phodbiorca)
.WithMany(p => p.PhodbDanes)
.HasForeignKey(d => new { d.Phid, d.KontrId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PHODBDAN_REF_PHODB_PHODBIOR");
});
modelBuilder.Entity<Phodbiorca>(entity =>
{
entity.HasKey(e => new { e.Phid, e.KontrId })
.HasName("PK_PHODBIORCA");
entity.ToTable("PHOdbiorca");
entity.HasIndex(e => e.KontrId, "idx_PHOdbKth");
entity.Property(e => e.Phid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PHId");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.Phodbiorcas)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PHODBIOR_REF_PHODB_KONTRAHE");
entity.HasOne(d => d.Ph)
.WithMany(p => p.Phodbiorcas)
.HasForeignKey(d => d.Phid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PHODBIOR_REF_PHODB_PH");
});
modelBuilder.Entity<Phrozliczenie>(entity =>
{
entity.HasKey(e => new { e.DokId, e.Phid })
.HasName("PK_PHROZLICZENIE");
entity.ToTable("PHRozliczenie");
entity.HasIndex(e => e.Phid, "idx_PHRozPH");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Phid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PHId");
entity.Property(e => e.Kwota).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Rozliczono).HasColumnType("datetime");
entity.HasOne(d => d.Dok)
.WithMany(p => p.Phrozliczenies)
.HasForeignKey(d => d.DokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PHROZLIC_REF_PHDOK_DOK");
entity.HasOne(d => d.Ph)
.WithMany(p => p.Phrozliczenies)
.HasForeignKey(d => d.Phid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PHROZLIC_REF_PHROZ_PH");
});
modelBuilder.Entity<PolMag>(entity =>
{
entity.HasKey(e => new { e.PolId, e.MagId })
.HasName("PK_POLMAG");
entity.ToTable("PolMag");
entity.HasIndex(e => e.MagId, "idx_MagPol");
entity.Property(e => e.PolId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Mag)
.WithMany(p => p.PolMags)
.HasForeignKey(d => d.MagId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_POLMAG_REF_MAGPO_MAGAZYN");
entity.HasOne(d => d.Pol)
.WithMany(p => p.PolMags)
.HasForeignKey(d => d.PolId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_POLMAG_REF_POLMA_POLITYKA");
});
modelBuilder.Entity<PolParam>(entity =>
{
entity.HasKey(e => new { e.PolId, e.ParGrupa, e.ParNazwa })
.HasName("PK_POLPARAM");
entity.ToTable("PolParam");
entity.Property(e => e.PolId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ParGrupa)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.ParNazwa)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.ParWartosc)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Pol)
.WithMany(p => p.PolParams)
.HasForeignKey(d => d.PolId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_POLPARAM_REF_POLPA_POLITYKA");
});
modelBuilder.Entity<Polityka>(entity =>
{
entity.HasKey(e => e.PolId)
.HasName("PK_POLITYKA");
entity.ToTable("Polityka");
entity.HasIndex(e => e.CentrPolId, "idx_CentrPolId");
entity.Property(e => e.PolId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrPolId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
});
modelBuilder.Entity<PowKontLoj>(entity =>
{
entity.HasKey(e => new { e.NoweKontoId, e.RodzajPow })
.HasName("PK_POWKONTLOJ");
entity.ToTable("PowKontLoj");
entity.HasIndex(e => e.StareKontoId, "idx_PowStareKLoj");
entity.Property(e => e.NoweKontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.StareKontoId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.NoweKonto)
.WithMany(p => p.PowKontLojNoweKontos)
.HasForeignKey(d => d.NoweKontoId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_NoweKonto");
entity.HasOne(d => d.StareKonto)
.WithMany(p => p.PowKontLojStareKontos)
.HasForeignKey(d => d.StareKontoId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_StareKonto");
});
modelBuilder.Entity<Powiadomienie>(entity =>
{
entity.ToTable("Powiadomienie");
entity.HasIndex(e => new { e.ShopNo, e.PosNo }, "IxPowiadomienie_ShopNoPosNo");
entity.HasIndex(e => e.Status, "IxPowiadomienie_Status");
entity.Property(e => e.PowiadomienieId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.Adresat)
.HasMaxLength(64)
.IsUnicode(false);
entity.Property(e => e.Nadawca)
.HasMaxLength(64)
.IsUnicode(false);
entity.Property(e => e.Naglowek)
.HasMaxLength(128)
.IsUnicode(false);
entity.Property(e => e.PosNo)
.HasMaxLength(32)
.IsUnicode(false);
entity.Property(e => e.ShopNo)
.HasMaxLength(32)
.IsUnicode(false);
entity.Property(e => e.Tresc)
.HasMaxLength(2048)
.IsUnicode(false);
entity.Property(e => e.Utworzono).HasColumnType("datetime");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<PowiadomienieParam>(entity =>
{
entity.HasKey(e => new { e.PowiadomienieId, e.Znaczenie, e.Kolejnosc })
.HasName("PK_POWIADOMIENIEPARAM");
entity.ToTable("PowiadomienieParam");
entity.Property(e => e.PowiadomienieId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Param2)
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Powiadomienie)
.WithMany(p => p.PowiadomienieParams)
.HasForeignKey(d => d.PowiadomienieId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_PowiadomienieParamPowiadomienie");
});
modelBuilder.Entity<Powiazanie>(entity =>
{
entity.HasKey(e => e.TowId)
.HasName("PK_POWIAZANIE");
entity.ToTable("Powiazanie");
entity.HasIndex(e => e.OpakId, "idx_OpakId");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.IleWopak)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleWOpak");
entity.Property(e => e.OpakId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Opak)
.WithMany(p => p.PowiazanieOpaks)
.HasForeignKey(d => d.OpakId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_POWIAZAN_REF_OPAK_TOWAR");
entity.HasOne(d => d.Tow)
.WithOne(p => p.PowiazanieTow)
.HasForeignKey<Powiazanie>(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_POWIAZAN_REF_TOWAR_TOWAR");
});
modelBuilder.Entity<PowiazanieSklep>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.Id, e.Typ })
.HasName("PK_POWIAZANIE_SKLEP");
entity.ToTable("PowiazanieSklep");
entity.HasIndex(e => e.Typ, "PowiazanieSklepTyp");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Id).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.PowiazanieSkleps)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_POWIAZANIESKLEP_REFERENCE_SKLEP");
});
modelBuilder.Entity<PowiazanieUz>(entity =>
{
entity.HasKey(e => new { e.UzId, e.RodzajPow, e.Id })
.HasName("PK_POWIAZANIEUZ");
entity.ToTable("PowiazanieUz");
entity.Property(e => e.UzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Id).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Uz)
.WithMany(p => p.PowiazanieUzs)
.HasForeignKey(d => d.UzId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_POWIAZAN_REF_POWUZ_UZYTKOWN");
});
modelBuilder.Entity<PowiazanieUzNaSklep>(entity =>
{
entity.HasKey(e => new { e.UzNsid, e.RodzajPow, e.Id })
.HasName("PK_POWIAZANIEUZNASKLEP");
entity.ToTable("PowiazanieUzNaSklep");
entity.Property(e => e.UzNsid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("UzNSId");
entity.Property(e => e.Id).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.UzNs)
.WithMany(p => p.PowiazanieUzNaSkleps)
.HasForeignKey(d => d.UzNsid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_PowUzNaSklepUzNaSklep");
});
modelBuilder.Entity<PozAkcyza>(entity =>
{
entity.HasKey(e => new { e.DokId, e.Kolejnosc, e.GrAkcId })
.HasName("PK_POZAKCYZA");
entity.ToTable("PozAkcyza");
entity.HasIndex(e => e.GrAkcId, "idx_PozAkcGr");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.GrAkcId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Wartosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.GrAkc)
.WithMany(p => p.PozAkcyzas)
.HasForeignKey(d => d.GrAkcId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_AkcPoz");
entity.HasOne(d => d.PozDok)
.WithMany(p => p.PozAkcyzas)
.HasForeignKey(d => new { d.DokId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_PozAkc");
});
modelBuilder.Entity<PozDok>(entity =>
{
entity.HasKey(e => new { e.DokId, e.Kolejnosc })
.HasName("PK_POZDOK");
entity.ToTable("PozDok");
entity.HasIndex(e => new { e.DokId, e.NrPozycji }, "idx_PozDokDokIdNrPozycji");
entity.HasIndex(e => e.TowId, "idx_PozDokTowId");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CenaDet).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaDomyslna).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaMag).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaPoRab).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaPrzedRab).HasColumnType("decimal(15, 4)");
entity.Property(e => e.IleWzgrzewce)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleWZgrzewce");
entity.Property(e => e.IloscMinus).HasColumnType("decimal(15, 4)");
entity.Property(e => e.IloscPlus).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Netto).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Podatek).HasColumnType("decimal(15, 4)");
entity.Property(e => e.RabatProc).HasColumnType("decimal(10, 4)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Wartosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Dok)
.WithMany(p => p.PozDoks)
.HasForeignKey(d => d.DokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_POZDOK_REF_POZDO_DOK");
entity.HasOne(d => d.Tow)
.WithMany(p => p.PozDoks)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_POZDOK_REF_POZTO_TOWAR");
});
modelBuilder.Entity<PozPar>(entity =>
{
entity.HasKey(e => new { e.ParId, e.Kolejnosc })
.HasName("PK_POZPAR");
entity.ToTable("PozPar");
entity.HasIndex(e => e.TowId, "idx_PozParTowId");
entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.GrupaGtu)
.HasMaxLength(4)
.IsUnicode(false)
.HasColumnName("GrupaGTU");
entity.Property(e => e.Ilosc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kod)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.RabatKwot).HasColumnType("decimal(15, 4)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.WartoscBrutto).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Par)
.WithMany(p => p.PozPars)
.HasForeignKey(d => d.ParId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_POZPAR_REF_POZPA_PARAGON");
entity.HasOne(d => d.Tow)
.WithMany(p => p.PozPars)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_POZPAR_REF_TOWPA_TOWAR");
});
modelBuilder.Entity<PozParSzczeg>(entity =>
{
entity.HasKey(e => new { e.ParId, e.Kolejnosc })
.HasName("PK_POZPARSZCZEG");
entity.ToTable("PozParSzczeg");
entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DodInfo)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.PozPar)
.WithOne(p => p.PozParSzczeg)
.HasForeignKey<PozParSzczeg>(d => new { d.ParId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_POZPARSZ_REF_PPSZC_POZPAR");
});
modelBuilder.Entity<PozWz>(entity =>
{
entity.HasKey(e => new { e.WzId, e.Kolejnosc })
.HasName("PK_POZWZ");
entity.ToTable("PozWz");
entity.Property(e => e.WzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.IloscMinus).HasColumnType("decimal(15, 4)");
entity.Property(e => e.IloscPlus).HasColumnType("decimal(15, 4)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Tow)
.WithMany(p => p.PozWzs)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_POZWZ_REF_TOWWZ_TOWAR");
entity.HasOne(d => d.Wz)
.WithMany(p => p.PozWzs)
.HasForeignKey(d => d.WzId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_POZWZ_REF_POZWZ_WZORZEC");
});
modelBuilder.Entity<Profil>(entity =>
{
entity.ToTable("Profil");
entity.Property(e => e.ProfilId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Utworzony).HasColumnType("datetime");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<ProfilKasa>(entity =>
{
entity.HasKey(e => e.ProfilId)
.HasName("PK_PROFKAS");
entity.ToTable("ProfilKasa");
entity.Property(e => e.ProfilId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KasaId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Kasa)
.WithMany(p => p.ProfilKasas)
.HasForeignKey(d => d.KasaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PROFKAS_REFERENCE_KASA");
entity.HasOne(d => d.Profil)
.WithOne(p => p.ProfilKasa)
.HasForeignKey<ProfilKasa>(d => d.ProfilId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PROFKAS_REFERENCE_PROF");
});
modelBuilder.Entity<ProfilKonfig>(entity =>
{
entity.HasKey(e => new { e.ProfilId, e.ParGrupa, e.ParNazwa, e.Kolejny })
.HasName("PK_PROFIL_KONFIG");
entity.ToTable("ProfilKonfig");
entity.Property(e => e.ProfilId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ParGrupa)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.ParNazwa)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Utworzony).HasColumnType("datetime");
entity.Property(e => e.Wartosc)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Profil)
.WithMany(p => p.ProfilKonfigs)
.HasForeignKey(d => d.ProfilId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PROFILKONFIG_REFERENCE_PROFIL");
});
modelBuilder.Entity<PrtMag>(entity =>
{
entity.HasKey(e => new { e.TowId, e.Pmid })
.HasName("PK_PRTMAG");
entity.ToTable("PrtMag");
entity.HasIndex(e => new { e.TowId, e.MagId, e.Data, e.KolejnyWdniu, e.Pmid }, "idx_PrtMagFifo");
entity.HasIndex(e => new { e.NrPartii, e.TowId, e.Pmid }, "idx_PrtMagNrPrt");
entity.HasIndex(e => e.Zmiana, "idx_PrtMagZmn");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Pmid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PMId");
entity.Property(e => e.CenaZak).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Data).HasColumnType("datetime");
entity.Property(e => e.DataWazn).HasColumnType("datetime");
entity.Property(e => e.Dostarczono).HasColumnType("decimal(15, 4)");
entity.Property(e => e.KolejnyWdniu).HasColumnName("KolejnyWDniu");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.NrDostawy)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.NrPartii)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Pozostalo).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Rezerwacja).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.Property(e => e.ZmianaIstotna).HasColumnType("datetime");
entity.HasOne(d => d.Mag)
.WithMany(p => p.PrtMags)
.HasForeignKey(d => d.MagId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_PrtMagMagazyn");
entity.HasOne(d => d.Tow)
.WithMany(p => p.PrtMags)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_PrtMagTowar");
});
modelBuilder.Entity<Przydzial>(entity =>
{
entity.HasKey(e => new { e.KasaId, e.AsId })
.HasName("PK_PRZYDZIAL");
entity.ToTable("Przydzial");
entity.Property(e => e.KasaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.AsId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.As)
.WithMany(p => p.Przydzials)
.HasForeignKey(d => d.AsId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PRZYDZIA_REF_ASPRZ_ASORT");
entity.HasOne(d => d.Kasa)
.WithMany(p => p.Przydzials)
.HasForeignKey(d => d.KasaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PRZYDZIA_REF_KASPR_KASA");
});
modelBuilder.Entity<RapWartPocz>(entity =>
{
entity.HasKey(e => e.Rwpid)
.HasName("PK_RAPWARTPOCZ");
entity.ToTable("RapWartPocz");
entity.HasIndex(e => new { e.TypRap, e.Data }, "idx_RWP_TypRapData");
entity.Property(e => e.Rwpid)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd()
.HasColumnName("RWPId");
entity.Property(e => e.Data).HasColumnType("datetime");
entity.Property(e => e.ParamTxt)
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Wykonano).HasColumnType("datetime");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<RapWartPoczDane>(entity =>
{
entity.HasKey(e => new { e.Rwpid, e.MagId, e.Typ, e.Numer })
.HasName("PK_RAPWARTPOCZDANE");
entity.ToTable("RapWartPoczDane");
entity.Property(e => e.Rwpid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("RWPId");
entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Typ).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Wartosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Mag)
.WithMany(p => p.RapWartPoczDanes)
.HasForeignKey(d => d.MagId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_RAPWARTPOCZDANE_REFERENCE_MAGAZYN");
entity.HasOne(d => d.Rwp)
.WithMany(p => p.RapWartPoczDanes)
.HasForeignKey(d => d.Rwpid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_RAPWARTPOCZDANE_REFERENCE_RAPWARTPOCZ");
});
modelBuilder.Entity<Regula>(entity =>
{
entity.ToTable("Regula");
entity.Property(e => e.RegulaId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DataCzasDo).HasColumnType("datetime");
entity.Property(e => e.DataCzasOd).HasColumnType("datetime");
entity.Property(e => e.Nazwa)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Number1).HasColumnType("numeric(16, 4)");
entity.Property(e => e.Number2).HasColumnType("numeric(16, 4)");
entity.Property(e => e.Number3).HasColumnType("numeric(16, 4)");
entity.Property(e => e.Number4).HasColumnType("numeric(16, 4)");
entity.Property(e => e.Str1)
.HasMaxLength(128)
.IsUnicode(false);
entity.Property(e => e.Str2)
.HasMaxLength(128)
.IsUnicode(false);
entity.Property(e => e.Usunieto).HasColumnType("datetime");
entity.Property(e => e.Utworzono).HasColumnType("datetime");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<RegulaAsort>(entity =>
{
entity.HasKey(e => new { e.RegulaId, e.AsId, e.Znaczenie })
.HasName("PK_REGULAASORT");
entity.ToTable("RegulaAsort");
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.AsId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.As)
.WithMany(p => p.RegulaAsorts)
.HasForeignKey(d => d.AsId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_REGULAAS_REFERENCE_ASORT");
entity.HasOne(d => d.Regula)
.WithMany(p => p.RegulaAsorts)
.HasForeignKey(d => d.RegulaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_REGULAAS_REFERENCE_REGULA");
});
modelBuilder.Entity<RegulaDok>(entity =>
{
entity.HasKey(e => new { e.DokId, e.RegulaId, e.Kolejnosc })
.HasName("PK_REGULADOK");
entity.ToTable("RegulaDok");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Wartosc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc3).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Dok)
.WithMany(p => p.RegulaDoks)
.HasForeignKey(d => d.DokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RegDokDok");
entity.HasOne(d => d.Konto)
.WithMany(p => p.RegulaDoks)
.HasForeignKey(d => d.KontoId)
.HasConstraintName("Ref_RegDokKonto");
entity.HasOne(d => d.Regula)
.WithMany(p => p.RegulaDoks)
.HasForeignKey(d => d.RegulaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RegDokReg");
});
modelBuilder.Entity<RegulaDokSzczeg>(entity =>
{
entity.HasKey(e => new { e.DokId, e.RegulaId, e.Kolejnosc, e.Znaczenie })
.HasName("PK_REGULADOKSZCZEG");
entity.ToTable("RegulaDokSzczeg");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Param2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Param3)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.RegulaDok)
.WithMany(p => p.RegulaDokSzczegs)
.HasForeignKey(d => new { d.DokId, d.RegulaId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_RgDokSzczegRgDok");
});
modelBuilder.Entity<RegulaKod>(entity =>
{
entity.HasKey(e => new { e.RegulaId, e.Kod, e.Znaczenie });
entity.ToTable("RegulaKod");
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kod)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Cena).HasColumnType("numeric(16, 4)");
entity.Property(e => e.Ilosc).HasColumnType("numeric(16, 4)");
entity.HasOne(d => d.Regula)
.WithMany(p => p.RegulaKods)
.HasForeignKey(d => d.RegulaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_REGULAKOD_REGULA");
});
modelBuilder.Entity<RegulaPar>(entity =>
{
entity.HasKey(e => new { e.ParId, e.RegulaId, e.Kolejnosc })
.HasName("PK_REGULAPAR");
entity.ToTable("RegulaPar");
entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Wartosc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc3).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Konto)
.WithMany(p => p.RegulaPars)
.HasForeignKey(d => d.KontoId)
.HasConstraintName("Ref_RegParKonto");
entity.HasOne(d => d.Par)
.WithMany(p => p.RegulaPars)
.HasForeignKey(d => d.ParId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RegParPar");
entity.HasOne(d => d.Regula)
.WithMany(p => p.RegulaPars)
.HasForeignKey(d => d.RegulaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RegParReg");
});
modelBuilder.Entity<RegulaParSzczeg>(entity =>
{
entity.HasKey(e => new { e.ParId, e.RegulaId, e.Kolejnosc, e.Znaczenie })
.HasName("PK_REGULAPARSZCZEG");
entity.ToTable("RegulaParSzczeg");
entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Param2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Param3)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.RegulaPar)
.WithMany(p => p.RegulaParSzczegs)
.HasForeignKey(d => new { d.ParId, d.RegulaId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_RgParSzczegRgPar");
});
modelBuilder.Entity<RegulaParam>(entity =>
{
entity.HasKey(e => new { e.RegulaId, e.Znaczenie })
.HasName("PK_REGULAPARAM");
entity.ToTable("RegulaParam");
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Param2)
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Regula)
.WithMany(p => p.RegulaParams)
.HasForeignKey(d => d.RegulaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RegPar");
});
modelBuilder.Entity<RegulaPozDok>(entity =>
{
entity.HasKey(e => new { e.DokId, e.Kolejnosc, e.RegulaId, e.Typ })
.HasName("PK_REGULAPOZDOK");
entity.ToTable("RegulaPozDok");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Wartosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Regula)
.WithMany(p => p.RegulaPozDoks)
.HasForeignKey(d => d.RegulaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RegPozReg");
entity.HasOne(d => d.PozDok)
.WithMany(p => p.RegulaPozDoks)
.HasForeignKey(d => new { d.DokId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RegPozPoz");
});
modelBuilder.Entity<RegulaPozDokSzczeg>(entity =>
{
entity.HasKey(e => new { e.DokId, e.Kolejnosc, e.RegulaId, e.Typ, e.KolejnoscRegulaDok })
.HasName("PK_REGPOZDOKSZ");
entity.ToTable("RegulaPozDokSzczeg");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Wartosc1).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc3).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc4).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Regula)
.WithMany(p => p.RegulaPozDokSzczegs)
.HasForeignKey(d => d.RegulaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RegPozSzReg");
entity.HasOne(d => d.PozDok)
.WithMany(p => p.RegulaPozDokSzczegs)
.HasForeignKey(d => new { d.DokId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RegPozSzPoz");
});
modelBuilder.Entity<RegulaPozPar>(entity =>
{
entity.HasKey(e => new { e.ParId, e.Kolejnosc, e.RegulaId, e.Typ })
.HasName("PK_REGULAPOZPAR");
entity.ToTable("RegulaPozPar");
entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Wartosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Regula)
.WithMany(p => p.RegulaPozPars)
.HasForeignKey(d => d.RegulaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RegPozParReg");
entity.HasOne(d => d.PozPar)
.WithMany(p => p.RegulaPozPars)
.HasForeignKey(d => new { d.ParId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RegPozParPar");
});
modelBuilder.Entity<RegulaPozParSzczeg>(entity =>
{
entity.HasKey(e => new { e.ParId, e.Kolejnosc, e.RegulaId, e.Typ, e.KolejnoscRegulaPar })
.HasName("PK_REGPOZPARSZ");
entity.ToTable("RegulaPozParSzczeg");
entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Wartosc1).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc3).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc4).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Regula)
.WithMany(p => p.RegulaPozParSzczegs)
.HasForeignKey(d => d.RegulaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RegPozPSzReg");
entity.HasOne(d => d.PozPar)
.WithMany(p => p.RegulaPozParSzczegs)
.HasForeignKey(d => new { d.ParId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RegPozPSzPoz");
});
modelBuilder.Entity<RegulaProg>(entity =>
{
entity.HasKey(e => new { e.RegulaId, e.Kolejnosc })
.HasName("PK_REGULAPROG");
entity.ToTable("RegulaProg");
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ProgDo).HasColumnType("numeric(16, 4)");
entity.Property(e => e.ProgOd).HasColumnType("numeric(16, 4)");
entity.Property(e => e.Wartosc1).HasColumnType("numeric(16, 4)");
entity.Property(e => e.Wartosc2).HasColumnType("numeric(16, 4)");
entity.HasOne(d => d.Regula)
.WithMany(p => p.RegulaProgs)
.HasForeignKey(d => d.RegulaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_REGULAPROG_REFERENCE_REGULA");
});
modelBuilder.Entity<RegulaSklep>(entity =>
{
entity.HasKey(e => new { e.RegulaId, e.SklepId })
.HasName("PK_REGULASKLEP");
entity.ToTable("RegulaSklep");
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Regula)
.WithMany(p => p.RegulaSkleps)
.HasForeignKey(d => d.RegulaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_RegulaSklep_Regula");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.RegulaSkleps)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_RegulaSklep_Sklep");
});
modelBuilder.Entity<RegulaTowar>(entity =>
{
entity.HasKey(e => new { e.RegulaId, e.TowId, e.Znaczenie })
.HasName("PK_REGULATOWAR");
entity.ToTable("RegulaTowar");
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Cena).HasColumnType("numeric(16, 4)");
entity.Property(e => e.Ilosc).HasColumnType("numeric(16, 4)");
entity.HasOne(d => d.Regula)
.WithMany(p => p.RegulaTowars)
.HasForeignKey(d => d.RegulaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_REGULATO_REFERENCE_REGULA");
entity.HasOne(d => d.Tow)
.WithMany(p => p.RegulaTowars)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_REGULATO_REFERENCE_TOWAR");
});
modelBuilder.Entity<Rola>(entity =>
{
entity.ToTable("Rola");
entity.Property(e => e.RolaId).ValueGeneratedNever();
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<RozPrtMag>(entity =>
{
entity.HasKey(e => new { e.TowId, e.Pmid, e.Znaczenie, e.DokId, e.Kolejnosc })
.HasName("PK_ROZPRTMAG");
entity.ToTable("RozPrtMag");
entity.HasIndex(e => e.Dzien, "idx_RozPrtMagDzien");
entity.HasIndex(e => new { e.DokId, e.Kolejnosc, e.Znaczenie, e.Pmid }, "idx_RozPrtMagPoz");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Pmid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PMId");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Dzien).HasColumnType("datetime");
entity.Property(e => e.IloscPrt).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.PozDok)
.WithMany(p => p.RozPrtMags)
.HasForeignKey(d => new { d.DokId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RozPrtMagPoz");
entity.HasOne(d => d.PrtMag)
.WithMany(p => p.RozPrtMags)
.HasForeignKey(d => new { d.TowId, d.Pmid })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_RozPrtMagPrt");
});
modelBuilder.Entity<RozbicieDok>(entity =>
{
entity.HasKey(e => new { e.DokId, e.Stawka })
.HasName("PK_ROZBICIEDOK");
entity.ToTable("RozbicieDok");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Netto).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NettoDet).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Podatek).HasColumnType("decimal(15, 4)");
entity.Property(e => e.PodatekDet).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Dok)
.WithMany(p => p.RozbicieDoks)
.HasForeignKey(d => d.DokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ROZBICIE_REF_SUMAD_DOK");
});
modelBuilder.Entity<Rozlicza>(entity =>
{
entity.HasKey(e => new { e.DokId, e.Kolejnosc })
.HasName("PK_ROZLICZA");
entity.ToTable("Rozlicza");
entity.HasIndex(e => e.RozliczanyDokId, "idx_RozliczanyDokId");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RozliczanyDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Rozliczenie).HasColumnType("decimal(15, 4)");
entity.Property(e => e.RozliczeniePodatku).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Dok)
.WithMany(p => p.RozliczaDoks)
.HasForeignKey(d => d.DokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ROZLICZA_REF_DOKZB_DOK");
entity.HasOne(d => d.RozliczanyDok)
.WithMany(p => p.RozliczaRozliczanyDoks)
.HasForeignKey(d => d.RozliczanyDokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ROZLICZA_REF_DOKRO_DOK");
});
modelBuilder.Entity<RozliczeniePartii>(entity =>
{
entity.HasKey(e => new { e.RozDokId, e.RozKolejnosc, e.PrtDokId, e.PrtKolejnosc })
.HasName("PK_ROZLICZENIEPARTII");
entity.ToTable("RozliczeniePartii");
entity.HasIndex(e => new { e.PrtDokId, e.PrtKolejnosc }, "idx_RozPrt");
entity.Property(e => e.RozDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.PrtDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Rozliczenie).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Prt)
.WithMany(p => p.RozliczeniePartiis)
.HasForeignKey(d => new { d.PrtDokId, d.PrtKolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ROZLICZE_REF_PRTRO_PARTIA");
entity.HasOne(d => d.Roz)
.WithMany(p => p.RozliczeniePartiis)
.HasForeignKey(d => new { d.RozDokId, d.RozKolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ROZLICZE_REF_ROZPO_POZDOK");
});
modelBuilder.Entity<Sesja>(entity =>
{
entity.ToTable("Sesja");
entity.HasIndex(e => e.UzId, "idx_SesjaUzId");
entity.Property(e => e.SesjaId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.Stanowisko)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.UzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Wersja)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.Uz)
.WithMany(p => p.Sesjas)
.HasForeignKey(d => d.UzId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SESJA_REF_UZYSE_UZYTKOWN");
});
modelBuilder.Entity<SesjaAktywna>(entity =>
{
entity.HasKey(e => e.SesjaId)
.HasName("PK_SESJAAKTYWNA");
entity.ToTable("SesjaAktywna");
entity.Property(e => e.SesjaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Aktywnosc).HasColumnType("datetime");
entity.Property(e => e.IdProcesu)
.HasMaxLength(20)
.IsUnicode(false);
entity.HasOne(d => d.Sesja)
.WithOne(p => p.SesjaAktywna)
.HasForeignKey<SesjaAktywna>(d => d.SesjaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SESJAAKT_REF_SESAK_SESJA");
});
modelBuilder.Entity<SkladnikDefinicjiKodu>(entity =>
{
entity.HasKey(e => new { e.Dkid, e.Kolejnosc })
.HasName("PK_SKLDEFKODU");
entity.ToTable("SkladnikDefinicjiKodu");
entity.Property(e => e.Dkid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("DKId");
entity.Property(e => e.Tekst)
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.Dk)
.WithMany(p => p.SkladnikDefinicjiKodus)
.HasForeignKey(d => d.Dkid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLDEFKODU");
});
modelBuilder.Entity<SkladnikWzorca>(entity =>
{
entity.HasKey(e => e.SkWzId)
.HasName("PK_SKLADNIKWZORCA");
entity.ToTable("SkladnikWzorca");
entity.HasIndex(e => e.CentrSkWzId, "idx_CentrSkWzId");
entity.HasIndex(e => new { e.TowIdWzorca, e.Kolejnosc }, "idx_SkladnikWzorca_TowIdWzorca");
entity.Property(e => e.SkWzId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.Cena).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CentrSkWzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Ilosc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.TowIdWzorca).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.TowIdWzorcaNavigation)
.WithMany(p => p.SkladnikWzorcas)
.HasForeignKey(d => d.TowIdWzorca)
.HasConstraintName("FK_SKLADNIKWZORCA_REFERENCE_TOWAR");
});
modelBuilder.Entity<Sklep>(entity =>
{
entity.ToTable("Sklep");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DataBo)
.HasColumnType("datetime")
.HasColumnName("DataBO");
entity.Property(e => e.KolejnyWdniuBo).HasColumnName("KolejnyWDniuBO");
entity.Property(e => e.KrajId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.NrSeryjny)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.OkrZamkniety).HasColumnType("datetime");
entity.Property(e => e.OstEksport).HasColumnType("datetime");
entity.Property(e => e.OstImport).HasColumnType("datetime");
entity.Property(e => e.PotwEksport).HasColumnType("datetime");
entity.Property(e => e.WymImport).HasColumnType("datetime");
entity.HasOne(d => d.Kraj)
.WithMany(p => p.Skleps)
.HasForeignKey(d => d.KrajId)
.HasConstraintName("FK_Ref_KrajSklep");
entity.HasOne(d => d.Mag)
.WithMany(p => p.Skleps)
.HasForeignKey(d => d.MagId)
.HasConstraintName("FK_SKLEP_REF_SKLEP_MAGAZYN");
entity.HasOne(d => d.SklepNavigation)
.WithOne(p => p.Sklep)
.HasForeignKey<Sklep>(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEP_REF_SKLEP_KONTRAHE");
});
modelBuilder.Entity<SklepArtykul>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepArtId })
.HasName("PK_SKLEPARTYKUL");
entity.ToTable("SklepArtykul");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepArtId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ArtNazwa)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.GlownySklepTowId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepArtykuls)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPART_REF_SKART_SKLEP");
entity.HasOne(d => d.SklepTowar)
.WithMany(p => p.SklepArtykuls)
.HasForeignKey(d => new { d.SklepId, d.GlownySklepTowId })
.HasConstraintName("FK_SKLARTGLOWNYSKLEPTOWID");
});
modelBuilder.Entity<SklepBank>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepBankId });
entity.ToTable("SklepBank");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepBankId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Adres)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.BankId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.NrRozliBank)
.HasMaxLength(8)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<SklepDefinicjaKodu>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDkid })
.HasName("PK_SKDEFKODU");
entity.ToTable("SklepDefinicjaKodu");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDkid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("SklepDKId");
entity.Property(e => e.DataDo).HasColumnType("datetime");
entity.Property(e => e.DataOd).HasColumnType("datetime");
entity.Property(e => e.Dkid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("DKId");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepDefinicjaKodus)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKDEFKODUSKLEP");
});
modelBuilder.Entity<SklepDok>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId })
.HasName("PK_SKLEPDOK");
entity.ToTable("SklepDok");
entity.HasIndex(e => e.DokId, "idx_SkDokId");
entity.HasIndex(e => new { e.SklepId, e.SklepKasaId }, "idx_SkDokKasa");
entity.HasIndex(e => new { e.SklepId, e.SklepKontrId }, "idx_SkDokKth");
entity.HasIndex(e => new { e.SklepId, e.SklepMagId }, "idx_SkDokMag");
entity.HasIndex(e => new { e.SklepId, e.SklepPlatnikId }, "idx_SkDokPlatKth");
entity.HasIndex(e => new { e.TypDok, e.Data, e.KolejnyWdniu }, "idx_SkDokTypDokDataKolejnyWDniu");
entity.HasIndex(e => new { e.SklepId, e.SklepUzId }, "idx_SkDokUz");
entity.HasIndex(e => new { e.SklepId, e.SklepWalId }, "idx_SkDokWal");
entity.HasIndex(e => e.Zmiana, "idx_SkDokZmiana");
entity.HasIndex(e => new { e.SklepId, e.Data, e.KolejnyWdniu }, "idx_SklepDataKolejnyWDniu");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrEksportFk).HasColumnName("CentrEksportFK");
entity.Property(e => e.Data).HasColumnType("datetime");
entity.Property(e => e.DataDod).HasColumnType("datetime");
entity.Property(e => e.DataPom).HasColumnType("datetime");
entity.Property(e => e.DoZaplaty).HasColumnType("decimal(15, 4)");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.EksportFk).HasColumnName("EksportFK");
entity.Property(e => e.KolejnyWdniu).HasColumnName("KolejnyWDniu");
entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota1).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota10).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota11).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota12).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota3).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota4).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota5).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota6).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota7).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota8).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kwota9).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Netto).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NettoDet).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NettoDetUslugi).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NettoMag).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NettoMagUslugi).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NettoUslugi).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NrDok)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Podatek).HasColumnType("decimal(15, 4)");
entity.Property(e => e.PodatekDet).HasColumnType("decimal(15, 4)");
entity.Property(e => e.PodatekDetUslugi).HasColumnType("decimal(15, 4)");
entity.Property(e => e.PodatekMag).HasColumnType("decimal(15, 4)");
entity.Property(e => e.PodatekMagUslugi).HasColumnType("decimal(15, 4)");
entity.Property(e => e.PodatekUslugi).HasColumnType("decimal(15, 4)");
entity.Property(e => e.RabatProc).HasColumnType("decimal(10, 4)");
entity.Property(e => e.Razem).HasColumnType("decimal(15, 4)");
entity.Property(e => e.SklepKasaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKbid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("SklepKBId");
entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepMagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepPlatnikId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepUzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepWalId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Zaplacono).HasColumnType("decimal(15, 4)");
entity.Property(e => e.ZaplaconoPodatek).HasColumnType("decimal(15, 4)");
entity.Property(e => e.ZaplaconoWkasie)
.HasColumnType("decimal(15, 4)")
.HasColumnName("ZaplaconoWKasie");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Dok)
.WithMany(p => p.SklepDoks)
.HasForeignKey(d => d.DokId)
.HasConstraintName("FK_SKLEPDOK_REF_SKDOK_DOK");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepDoks)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPDOK_REF_SKLEP_SKLEP");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepDoks)
.HasForeignKey(d => new { d.SklepId, d.SklepKasaId })
.HasConstraintName("FK_SKLEPDOK_REF_SKDOK_SKLEPKAS");
entity.HasOne(d => d.Sklep1)
.WithMany(p => p.SklepDokSklep1s)
.HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
.HasConstraintName("FK_SKLEPDOK_REF_OBROT_SKLEPKON");
entity.HasOne(d => d.Sklep2)
.WithMany(p => p.SklepDoks)
.HasForeignKey(d => new { d.SklepId, d.SklepMagId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPDOK_REF_SKDOK_SKLEPMAG");
entity.HasOne(d => d.Sklep3)
.WithMany(p => p.SklepDokSklep3s)
.HasForeignKey(d => new { d.SklepId, d.SklepPlatnikId })
.HasConstraintName("FK_SKLEPDOK_REF_OBROT_SKLEPPLAT");
entity.HasOne(d => d.Sklep4)
.WithMany(p => p.SklepDoks)
.HasForeignKey(d => new { d.SklepId, d.SklepUzId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPDOK_REF_SKDOK_SKLEPUZY");
entity.HasOne(d => d.Sklep5)
.WithMany(p => p.SklepDoks)
.HasForeignKey(d => new { d.SklepId, d.SklepWalId })
.HasConstraintName("FK_SKLEPDOK_REF_SKDWP_SKLEPWAL");
});
modelBuilder.Entity<SklepDokDodKth>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.Znaczenie })
.HasName("PK_SKLEPDOKDODKTH");
entity.ToTable("SklepDokDodKth");
entity.HasIndex(e => new { e.SklepId, e.SklepKontrId }, "idx_SkDDKth");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepDokDodKths)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPDOK_REF_SKDDK_SKLEPDOK");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepDokDodKths)
.HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPDOK_REF_SKDKD_SKLEPKON");
});
modelBuilder.Entity<SklepDokKur>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.Znaczenie })
.HasName("PK_SKLEPDOKKURS");
entity.HasIndex(e => new { e.SklepId, e.SklepWalId }, "idx_SklDokKursWal");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Data).HasColumnType("datetime");
entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NrTabeli)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.SklepWalId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepDokKurs)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLDOKKURS_SKLEPDOK");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepDokKurs)
.HasForeignKey(d => new { d.SklepId, d.SklepWalId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLDOKKURS_WAL");
});
modelBuilder.Entity<SklepDokPunkty>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.Typ, e.Gdzie })
.HasName("PK_SKLEPDOKPUNKTY");
entity.ToTable("SklepDokPunkty");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kiedy).HasColumnType("datetime");
entity.Property(e => e.Kwota).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepDokPunkties)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPDOK_REF_SKDOK_SKLEPDOK");
});
modelBuilder.Entity<SklepDokWalutum>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.SklepWalId })
.HasName("PK_SKLEPDOKWALUTA");
entity.HasIndex(e => new { e.SklepId, e.SklepWalId }, "idx_SkWalDok");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepWalId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DokKwota).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
entity.Property(e => e.WalKwota).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepDokWaluta)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPDOK_REF_SKDWZ_SKLEPDOK");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepDokWaluta)
.HasForeignKey(d => new { d.SklepId, d.SklepWalId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPDOK_REF_SKWD_SKLEPWAL");
});
modelBuilder.Entity<SklepDost>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.SklepKontrId })
.HasName("PK_SKLEPDOST");
entity.ToTable("SklepDost");
entity.HasIndex(e => new { e.SklepId, e.SklepKontrId }, "idx_SkDostKth");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CenaZak).HasColumnType("decimal(15, 4)");
entity.Property(e => e.RabatOdWart).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepDosts)
.HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPDOS_REF_DOSTS_SKLEPKON");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepDosts)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPDOS_REF_SKLEP_SKLEPTOW");
});
modelBuilder.Entity<SklepDzienRozl>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.Dzien })
.HasName("PK_SKLEPDZIENROZL");
entity.ToTable("SklepDzienRozl");
entity.HasIndex(e => e.Zmiana, "idx_SkDzienZmiana");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Dzien).HasColumnType("datetime");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepDzienRozls)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkDzienRozl");
});
modelBuilder.Entity<SklepDzienRozlParam>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.Dzien, e.Znaczenie })
.HasName("PK_SKLEPDZIENROZLPARAM");
entity.ToTable("SklepDzienRozlParam");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Dzien).HasColumnType("datetime");
entity.Property(e => e.Wartosc)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.SklepDzienRozl)
.WithMany(p => p.SklepDzienRozlParams)
.HasForeignKey(d => new { d.SklepId, d.Dzien })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkDzienRozlPar");
});
modelBuilder.Entity<SklepFlagi>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.TowId })
.HasName("PK_SKLEPFLAGI");
entity.ToTable("SklepFlagi");
entity.HasIndex(e => new { e.SklepId, e.ZmianaIstotna }, "idx_SFZmianaIstotna");
entity.HasIndex(e => new { e.SklepId, e.ZmianaTylkoCen }, "idx_SFZmianaTylkoCen");
entity.HasIndex(e => new { e.TowId, e.SklepId }, "idx_SklFlgTowSklep");
entity.HasIndex(e => e.Zmiana, "idx_SklepFlagZmiana");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.NarzCenaDet).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NarzCenaDod).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NarzCenaHurt).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NarzCenaNoc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NarzCenaZak).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.Property(e => e.ZmianaIstotna).HasColumnType("datetime");
entity.Property(e => e.ZmianaTylkoCen).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepFlagis)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPFLA_REF_SKLEP_SKLEP");
entity.HasOne(d => d.Tow)
.WithMany(p => p.SklepFlagis)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPFLA_REF_SKLEP_TOWAR");
});
modelBuilder.Entity<SklepFormZgod>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepTypOsId, e.SklepZgId })
.HasName("PK_SKLEPFORMZGOD");
entity.ToTable("SklepFormZgod");
entity.HasIndex(e => new { e.SklepId, e.SklepZgId }, "idx_SKFMZG_SKZGODA");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTypOsId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepZgId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepFormZgods)
.HasForeignKey(d => new { d.SklepId, d.SklepTypOsId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKFMZG_SKTYPOS");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepFormZgods)
.HasForeignKey(d => new { d.SklepId, d.SklepZgId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKFMZG_SKZGODA");
});
modelBuilder.Entity<SklepFormaPlatnPos7>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepFormaId });
entity.ToTable("SklepFormaPlatnPos7");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepFormaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.FormaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kolejnosc).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.SerwisPlatniczy)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepFormaPlatnPos7s)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKFPP7_SKLEP");
});
modelBuilder.Entity<SklepGrupaAkcyzowa>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepGrAkcId })
.HasName("PK_SKLEPGRUPAAKCYZOWA");
entity.ToTable("SklepGrupaAkcyzowa");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepGrAkcId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrGrAkcId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kod)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepGrupaAkcyzowas)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkGrAkc");
});
modelBuilder.Entity<SklepGrupaUz>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepUzId })
.HasName("PK_SK_GR_UZ");
entity.ToTable("SklepGrupaUz");
entity.HasIndex(e => new { e.SklepId, e.SklepRolaId }, "idx_SkRola");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepUzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRolaId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepGrupaUzSkleps)
.HasForeignKey(d => new { d.SklepId, d.SklepRolaId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPGRU_REF_SKGRR_SKLEPUZY");
entity.HasOne(d => d.SklepNavigation)
.WithOne(p => p.SklepGrupaUzSklepNavigation)
.HasForeignKey<SklepGrupaUz>(d => new { d.SklepId, d.SklepUzId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPGRU_REF_SKGRU_SKLEPUZY");
});
modelBuilder.Entity<SklepIstw>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.SklepMagId })
.HasName("PK_SKLEPISTW");
entity.ToTable("SklepIstw");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepMagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CenaMag).HasColumnType("decimal(15, 4)");
entity.Property(e => e.RezerwacjaMag).HasColumnType("decimal(15, 4)");
entity.Property(e => e.StanMag).HasColumnType("decimal(15, 4)");
entity.Property(e => e.StanMax).HasColumnType("decimal(15, 4)");
entity.Property(e => e.StanMin).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepIstws)
.HasForeignKey(d => new { d.SklepId, d.SklepMagId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPIST_REF_SKMAG_SKLEPMAG");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepIstws)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPIST_REF_SKTOW_SKLEPTOW");
});
modelBuilder.Entity<SklepKartaLoj>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepKartaId })
.HasName("PK_SKLEPKARTALOJ");
entity.ToTable("SklepKartaLoj");
entity.HasIndex(e => e.KodKarty, "idx_SKLoj_KodKarty");
entity.HasIndex(e => new { e.SklepId, e.SklepKontoId }, "idx_SKLoj_SKonto");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKartaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KodKarty)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Opis1)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Opis2)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Posiadacz)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.SklepKontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Uniewazniono).HasColumnType("datetime");
entity.Property(e => e.WaznaDo).HasColumnType("datetime");
entity.Property(e => e.WaznaOd).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepKartaLojs)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SKrtLoj_Sklep");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepKartaLojs)
.HasForeignKey(d => new { d.SklepId, d.SklepKontoId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SKartaKonto");
});
modelBuilder.Entity<SklepKasa>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepKasaId })
.HasName("PK_SKLEPKASA");
entity.ToTable("SklepKasa");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKasaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.SklepMagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Stanowisko)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Typ)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepKasas)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPKAS_REF_SKKAS_SKLEP");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepKasas)
.HasForeignKey(d => new { d.SklepId, d.SklepMagId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPKAS_REF_SKMAG_SKLEPMAG");
});
modelBuilder.Entity<SklepKasaFormaPlatn>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepFormaId, e.SklepKasaId });
entity.ToTable("SklepKasaFormaPlatn");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepFormaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKasaId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepKasaFormaPlatns)
.HasForeignKey(d => new { d.SklepId, d.SklepFormaId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKKASAFORMAPLATN_SKFPP7");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepKasaFormaPlatns)
.HasForeignKey(d => new { d.SklepId, d.SklepKasaId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKKASAFORMAPLATN_SKKASA");
});
modelBuilder.Entity<SklepKontoBankowe>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepKbid });
entity.ToTable("SklepKontoBankowe");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKbid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("SklepKBId");
entity.Property(e => e.Kbid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("KBId");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Numer)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.PowSklepKbid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PowSklepKBId");
entity.Property(e => e.SklepBankId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepMagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepWalId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Sufix)
.IsRequired()
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepKontoBankowes)
.HasForeignKey(d => new { d.SklepId, d.SklepBankId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPKONTOBANK_SKLEPBANK");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepKontoBankowes)
.HasForeignKey(d => new { d.SklepId, d.SklepWalId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPKONTOBANK_SKLEPWALUTA");
});
modelBuilder.Entity<SklepKontoBankoweKontr>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepKbkid });
entity.ToTable("SklepKontoBankoweKontr");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKbkid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("SklepKBKId");
entity.Property(e => e.Kbkid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("KBKId");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Numer)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.PowSklepKbkid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PowSklepKBKId");
entity.Property(e => e.SklepBankId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepWalId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepKontoBankoweKontrs)
.HasForeignKey(d => new { d.SklepId, d.SklepBankId })
.HasConstraintName("FK_SKLEPKONTOBANKKONTR_SKLEPBANK");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepKontoBankoweKontrs)
.HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPKONTOBANKKONTR_SKLEPKONTR");
entity.HasOne(d => d.Sklep1)
.WithMany(p => p.SklepKontoBankoweKontrs)
.HasForeignKey(d => new { d.SklepId, d.SklepWalId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPKONTOBANKKONTR_SKLEPWALUTA");
});
modelBuilder.Entity<SklepKontoLoj>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepKontoId })
.HasName("PK_SKLEPKONTOLOJ");
entity.ToTable("SklepKontoLoj");
entity.HasIndex(e => e.CentrKontoId, "idx_SCentrKontoId");
entity.HasIndex(e => e.KontoId, "idx_SKLoj_KLoj");
entity.HasIndex(e => new { e.SklepId, e.SklepKontrId }, "idx_SKLoj_SKontrId");
entity.HasIndex(e => e.ZmianaStanu, "idx_SKLoj_ZmStanu");
entity.HasIndex(e => e.Zmiana, "idx_SKLoj_Zmiana");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrKontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Stan).HasColumnType("decimal(15, 4)");
entity.Property(e => e.StanPocz).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.Property(e => e.ZmianaStanu).HasColumnType("datetime");
entity.HasOne(d => d.Konto)
.WithMany(p => p.SklepKontoLojs)
.HasForeignKey(d => d.KontoId)
.HasConstraintName("Ref_SKLoj_KLoj");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepKontoLojs)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SKntLoj_Sklep");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepKontoLojs)
.HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SKLoj_SKth");
});
modelBuilder.Entity<SklepKontr>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepKontrId })
.HasName("PK_SKLEPKONTR");
entity.ToTable("SklepKontr");
entity.HasIndex(e => e.KontrId, "idx_SklepKthKth");
entity.HasIndex(e => new { e.SklepId, e.KontrId }, "idx_SklepKthSkKth");
entity.HasIndex(e => e.Zmiana, "idx_SklepKthZmiana");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Akwizytor)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Bank)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.CentrKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Email)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false)
.HasColumnName("EMail");
entity.Property(e => e.Fax)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.IndeksCentr)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Kod)
.IsRequired()
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.KodKarty)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.KodKontr)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.KodKraju)
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.Konto)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.MaxKredyt).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Miasto)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.NaPrzelewie1)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.NaPrzelewie2)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Nip)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false)
.HasColumnName("NIP");
entity.Property(e => e.NrAnalityki)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.NrDomu)
.HasMaxLength(9)
.IsUnicode(false);
entity.Property(e => e.NrLokalu)
.HasMaxLength(9)
.IsUnicode(false);
entity.Property(e => e.Poczta)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Prowizja).HasColumnType("decimal(10, 4)");
entity.Property(e => e.RabatDost).HasColumnType("decimal(10, 4)");
entity.Property(e => e.RabatOdb).HasColumnType("decimal(10, 4)");
entity.Property(e => e.Rezerwa1)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Rezerwa2)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Skrot)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Telefon)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.TermWaznKarty).HasColumnType("datetime");
entity.Property(e => e.Ulica)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.SklepKontrs)
.HasForeignKey(d => d.KontrId)
.HasConstraintName("FK_SKLEPKON_REF_KTHSK_KONTRAHE");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepKontrs)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPKON_REF_SKLEP_SKLEP");
});
modelBuilder.Entity<SklepKontrOpi>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepKontrId, e.Znaczenie })
.HasName("PK_SKLEPKONTROPIS");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepKontrOpis)
.HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPKON_REF_SKKTH_SKLEPKON");
});
modelBuilder.Entity<SklepKontrSklep>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepKontrId })
.HasName("PK_SKLKONTRSKL");
entity.ToTable("SklepKontrSklep");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DataBo)
.HasColumnType("datetime")
.HasColumnName("DataBO");
entity.Property(e => e.KodKraju)
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.KolejnyWdniuBo).HasColumnName("KolejnyWDniuBO");
entity.Property(e => e.NrSeryjny)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.OkrZamkniety).HasColumnType("datetime");
entity.Property(e => e.OstEksport).HasColumnType("datetime");
entity.Property(e => e.OstImport).HasColumnType("datetime");
entity.Property(e => e.PotwEksport).HasColumnType("datetime");
entity.Property(e => e.SklepMagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.WymImport).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepKontrSkleps)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SklKontrSklKontr");
});
modelBuilder.Entity<SklepKthPrzydzial>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.Kpwid })
.HasName("PK_SKLEPKTHPRZYDZIAL");
entity.ToTable("SklepKthPrzydzial");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kpwid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("KPWId");
entity.HasOne(d => d.Kpw)
.WithMany(p => p.SklepKthPrzydzials)
.HasForeignKey(d => d.Kpwid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPKTH_REF_SKKTH_KTHPARWA");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepKthPrzydzials)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPKTH_REF_SKKTH_SKLEP");
});
modelBuilder.Entity<SklepKthTypO>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepKontrId, e.SklepTypOsId })
.HasName("PK_SKLEPKTHTYPOS");
entity.HasIndex(e => new { e.SklepId, e.SklepTypOsId }, "idx_SKKTHTYPOS_SKTYPOS");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTypOsId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepKthTypOs)
.HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKKTHTYPOS_SKKTH");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepKthTypOs)
.HasForeignKey(d => new { d.SklepId, d.SklepTypOsId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKKTHTYPOS_SKTYPOS");
});
modelBuilder.Entity<SklepMagazyn>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepMagId })
.HasName("PK_SKLEPMAGAZYN");
entity.ToTable("SklepMagazyn");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepMagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepMagazyns)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPMAG_REF_SKMAG_SKLEP");
});
modelBuilder.Entity<SklepNarzDost>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.TowId, e.KontrId })
.HasName("PK_SKLEPNARZDOST");
entity.ToTable("SklepNarzDost");
entity.HasIndex(e => e.KontrId, "idx_SklepNarzDostKth");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.SklepNarzDosts)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPNAR_REF_SKLEP_KONTRAHE");
entity.HasOne(d => d.SklepFlagi)
.WithMany(p => p.SklepNarzDosts)
.HasForeignKey(d => new { d.SklepId, d.TowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPNAR_REF_SKLEP_SKLEPFLA");
});
modelBuilder.Entity<SklepNotatki>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.Kolejnosc })
.HasName("PK_SKLEPNOTATKI");
entity.ToTable("SklepNotatki");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepNotatkis)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPNOT_REF_SKNOT_SKLEPTOW");
});
modelBuilder.Entity<SklepNrRej>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepKontrId, e.NrFormat })
.HasName("PK_SKLEPNRREJ");
entity.ToTable("SklepNrRej");
entity.HasIndex(e => new { e.NrFormat, e.SklepId, e.SklepKontrId }, "idx_SkNumerRej");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.NrFormat)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.NrWpisany)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepNrRejs)
.HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkNrRejKth");
});
modelBuilder.Entity<SklepNrRejKartum>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepKontrId, e.NrFormat, e.SklepKartaId })
.HasName("PK_SKLEPNRREJKARTA");
entity.HasIndex(e => new { e.SklepId, e.SklepKartaId, e.SklepKontrId, e.NrFormat }, "idx_SkNrRejKartaId");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.NrFormat)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.SklepKartaId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepNrRejKarta)
.HasForeignKey(d => new { d.SklepId, d.SklepKartaId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkKartaNrRej");
entity.HasOne(d => d.SklepNrRej)
.WithMany(p => p.SklepNrRejKarta)
.HasForeignKey(d => new { d.SklepId, d.SklepKontrId, d.NrFormat })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkNrRejKarta");
});
modelBuilder.Entity<SklepOplatum>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepOplataId });
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepOplataId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DataDo).HasColumnType("datetime");
entity.Property(e => e.DataOd).HasColumnType("datetime");
entity.Property(e => e.Komentarz)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Kwota).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.OplataId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKbid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("SklepKBId");
entity.Property(e => e.StawkaProc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepOplata)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKOPLATA_SKLEP");
});
modelBuilder.Entity<SklepPanel>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepPanelId })
.HasName("PK_SKLEP_PANEL");
entity.ToTable("SklepPanel");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepPanelId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.PanelId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepUzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.TypAplikacji).HasDefaultValueSql("((3))");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Panel)
.WithMany(p => p.SklepPanels)
.HasForeignKey(d => d.PanelId)
.HasConstraintName("FK_SKLEPPANEL_REFERENCE_PANEL");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepPanels)
.HasForeignKey(d => new { d.SklepId, d.SklepUzId })
.HasConstraintName("FK_SKLEPPANEL_REFERENCE_SKLEPUZYTKOWNIK");
});
modelBuilder.Entity<SklepPanelParam>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepPanelId, e.ParNazwa })
.HasName("PK_SKLEP_PANEL_PARAM");
entity.ToTable("SklepPanelParam");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepPanelId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ParNazwa)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.ParWartosc)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepPanelParams)
.HasForeignKey(d => new { d.SklepId, d.SklepPanelId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPANELPARAM_REFERENCE_SKLEPPANEL");
});
modelBuilder.Entity<SklepParBon>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepParId, e.Kolejnosc })
.HasName("PK_SKLEPPARBON");
entity.ToTable("SklepParBon");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kwota).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Numer)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Typ)
.IsRequired()
.HasMaxLength(10)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepParBons)
.HasForeignKey(d => new { d.SklepId, d.SklepParId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPAR_REF_SKPB_SKLEPPAR");
});
modelBuilder.Entity<SklepParPunkty>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepParId, e.Typ, e.Gdzie })
.HasName("PK_SKLEPPARPUNKTY");
entity.ToTable("SklepParPunkty");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kiedy).HasColumnType("datetime");
entity.Property(e => e.Kwota).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepParPunkties)
.HasForeignKey(d => new { d.SklepId, d.SklepParId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPAR_REF_SKPAR_SKLEPPAR");
});
modelBuilder.Entity<SklepParWalutum>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepParId, e.SklepWalId })
.HasName("PK_SKLEPPARWALUTA");
entity.HasIndex(e => new { e.SklepId, e.SklepWalId }, "idx_SkWalPar");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepWalId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
entity.Property(e => e.ParKwota).HasColumnType("decimal(15, 4)");
entity.Property(e => e.WalKwota).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepParWaluta)
.HasForeignKey(d => new { d.SklepId, d.SklepParId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPAR_REF_SKPWZ_SKLEPPAR");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepParWaluta)
.HasForeignKey(d => new { d.SklepId, d.SklepWalId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPAR_REF_SKWAL_SKLEPWAL");
});
modelBuilder.Entity<SklepParagon>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepParId })
.HasName("PK_SKLEPPARAGON");
entity.ToTable("SklepParagon");
entity.HasIndex(e => new { e.SklepId, e.SklepKasaId }, "idx_SkParKasa");
entity.HasIndex(e => new { e.SklepId, e.Kasjer }, "idx_SkParKasjer");
entity.HasIndex(e => new { e.SklepId, e.SklepWalId }, "idx_SkParWal");
entity.HasIndex(e => e.Zmiana, "idx_SkParZmiana");
entity.HasIndex(e => new { e.SklepId, e.DataCzas }, "idx_SklepParDataCzas");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Bony).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Brutto).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CechyPar)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.CentrEksportFk).HasColumnName("CentrEksportFK");
entity.Property(e => e.Czek).HasColumnType("decimal(15, 4)");
entity.Property(e => e.DataCzas).HasColumnType("datetime");
entity.Property(e => e.DodFplat)
.HasColumnType("decimal(15, 4)")
.HasColumnName("DodFPlat");
entity.Property(e => e.EksportFk).HasColumnName("EksportFK");
entity.Property(e => e.Gotowka).HasColumnType("decimal(15, 4)");
entity.Property(e => e.GrupyGtu)
.HasMaxLength(255)
.IsUnicode(false)
.HasColumnName("GrupyGTU");
entity.Property(e => e.InneFplat)
.HasColumnType("decimal(15, 4)")
.HasColumnName("InneFPlat");
entity.Property(e => e.Karta).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kasjer)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.KodKarty)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Nip)
.HasMaxLength(40)
.IsUnicode(false)
.HasColumnName("NIP");
entity.Property(e => e.OpakWyd).HasColumnType("decimal(15, 4)");
entity.Property(e => e.OpakZwr).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Przelew).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Rabat).HasColumnType("decimal(15, 4)");
entity.Property(e => e.SklepKasaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepWalId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Waluty).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepParagons)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPAR_REF_SKLEP_SKLEP");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepParagons)
.HasForeignKey(d => new { d.SklepId, d.SklepKasaId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPAR_REF_SKPAR_SKLEPKAS");
entity.HasOne(d => d.Sklep1)
.WithMany(p => p.SklepParagons)
.HasForeignKey(d => new { d.SklepId, d.SklepWalId })
.HasConstraintName("FK_SKLEPPAR_REF_SKPAR_SKLEPWAL");
});
modelBuilder.Entity<SklepPartium>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.Kolejnosc })
.HasName("PK_SKLEPPARTIA");
entity.HasIndex(e => new { e.TypPartii, e.SklepId, e.SklepTowId, e.Pozostalo }, "idx_SkPrtTypTowIle");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Cecha1)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Cecha2)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.DataWazn).HasColumnType("datetime");
entity.Property(e => e.Pozostalo).HasColumnType("decimal(15, 4)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepPartia)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPAR_REF_SKPRT_SKLEPTOW");
entity.HasOne(d => d.SklepPozDok)
.WithOne(p => p.SklepPartium)
.HasForeignKey<SklepPartium>(d => new { d.SklepId, d.SklepDokId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPAR_REF_SKPRT_SKLEPPOZ");
});
modelBuilder.Entity<SklepPowKontLoj>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepNoweKontoId, e.RodzajPow })
.HasName("PK_SKLEPPOWKONTLOJ");
entity.ToTable("SklepPowKontLoj");
entity.HasIndex(e => e.SklepStareKontoId, "idx_PowStareSKLoj");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepNoweKontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepStareKontoId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepPowKontLojSkleps)
.HasForeignKey(d => new { d.SklepId, d.SklepNoweKontoId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SklepNoweKonto");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepPowKontLojSklepNavigations)
.HasForeignKey(d => new { d.SklepId, d.SklepStareKontoId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SklepStareKonto");
});
modelBuilder.Entity<SklepPowiazanieUz>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepUzId, e.RodzajPow, e.Id })
.HasName("PK_SK_POW_UZ");
entity.ToTable("SklepPowiazanieUz");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepUzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Id).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepPowiazanieUzs)
.HasForeignKey(d => new { d.SklepId, d.SklepUzId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPOW_REF_SKPOW_SKLEPUZY");
});
modelBuilder.Entity<SklepPozAkcyza>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.Kolejnosc, e.SklepGrAkcId })
.HasName("PK_SKLEPPOZAKCYZA");
entity.ToTable("SklepPozAkcyza");
entity.HasIndex(e => new { e.SklepId, e.SklepGrAkcId }, "idx_SkPozAkcGr");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepGrAkcId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Wartosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepPozAkcyzas)
.HasForeignKey(d => new { d.SklepId, d.SklepGrAkcId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkAkcPoz");
entity.HasOne(d => d.SklepPozDok)
.WithMany(p => p.SklepPozAkcyzas)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkPozAkc");
});
modelBuilder.Entity<SklepPozDok>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.Kolejnosc })
.HasName("PK_SKLEPPOZDOK");
entity.ToTable("SklepPozDok");
entity.HasIndex(e => new { e.SklepId, e.SklepDokId, e.NrPozycji }, "idx_SklepPozDokNrPoz");
entity.HasIndex(e => new { e.SklepId, e.SklepTowId }, "idx_SklepPozDokTowId");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CenaDet).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaDomyslna).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaMag).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaPoRab).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaPrzedRab).HasColumnType("decimal(15, 4)");
entity.Property(e => e.IleWzgrzewce)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleWZgrzewce");
entity.Property(e => e.IloscMinus).HasColumnType("decimal(15, 4)");
entity.Property(e => e.IloscPlus).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Netto).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Podatek).HasColumnType("decimal(15, 4)");
entity.Property(e => e.RabatProc).HasColumnType("decimal(10, 4)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Wartosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepPozDoks)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPOZ_REF_SKPOZ_SKLEPDOK");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepPozDoks)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPOZ_REF_SKPOZ_SKLEPTOW");
});
modelBuilder.Entity<SklepPozPar>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepParId, e.Kolejnosc })
.HasName("PK_SKLEPPOZPAR");
entity.ToTable("SklepPozPar");
entity.HasIndex(e => new { e.SklepId, e.SklepTowId }, "idx_SkPozParTow");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.GrupaGtu)
.HasMaxLength(4)
.IsUnicode(false)
.HasColumnName("GrupaGTU");
entity.Property(e => e.Ilosc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Kod)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.RabatKwot).HasColumnType("decimal(15, 4)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.WartoscBrutto).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepPozPars)
.HasForeignKey(d => new { d.SklepId, d.SklepParId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPOZ_REF_SKPOZ_SKLEPPAR");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepPozPars)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId })
.HasConstraintName("FK_SKLEPPOZ_REF_SKTOW_SKLEPTOW");
});
modelBuilder.Entity<SklepPozParSzczeg>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepParId, e.Kolejnosc })
.HasName("PK_SKLEPPOZPARSZCZEG");
entity.ToTable("SklepPozParSzczeg");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DodInfo)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.SklepPozPar)
.WithOne(p => p.SklepPozParSzczeg)
.HasForeignKey<SklepPozParSzczeg>(d => new { d.SklepId, d.SklepParId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPOZ_REF_SKPPS_SKLEPPOZ");
});
modelBuilder.Entity<SklepProfil>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepProfilId })
.HasName("PK_SKLEPPROFIL");
entity.ToTable("SklepProfil");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepProfilId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.ProfilId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Utworzony).HasColumnType("datetime");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Profil)
.WithMany(p => p.SklepProfils)
.HasForeignKey(d => d.ProfilId)
.HasConstraintName("FK_SKLEPPROFIL_REFERENCE_PROFIL");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepProfils)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPROFIL_REFERENCE_SKLEP");
});
modelBuilder.Entity<SklepProfilKonfig>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepProfilId, e.ParGrupa, e.ParNazwa, e.Kolejny })
.HasName("PK_SKLEPPROFIL_KONFIG");
entity.ToTable("SklepProfilKonfig");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepProfilId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ParGrupa)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.ParNazwa)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Utworzony).HasColumnType("datetime");
entity.Property(e => e.Wartosc)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepProfilKonfigs)
.HasForeignKey(d => new { d.SklepId, d.SklepProfilId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPROFILKONFIG_REFERENCE_SKLEPPROFIL");
});
modelBuilder.Entity<SklepPrtMag>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.Pmid })
.HasName("PK_SKLEPPRTMAG");
entity.ToTable("SklepPrtMag");
entity.HasIndex(e => new { e.SklepId, e.SklepTowId, e.SklepMagId, e.Data, e.KolejnyWdniu, e.Pmid }, "idx_SkPrtMagFifo");
entity.HasIndex(e => new { e.NrPartii, e.SklepId, e.SklepTowId, e.Pmid }, "idx_SkPrtMagNrPrt");
entity.HasIndex(e => e.Zmiana, "idx_SkPrtMagZmn");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Pmid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PMId");
entity.Property(e => e.CenaZak).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Data).HasColumnType("datetime");
entity.Property(e => e.DataWazn).HasColumnType("datetime");
entity.Property(e => e.Dostarczono).HasColumnType("decimal(15, 4)");
entity.Property(e => e.KolejnyWdniu).HasColumnName("KolejnyWDniu");
entity.Property(e => e.NrDostawy)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.NrPartii)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Pozostalo).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Rezerwacja).HasColumnType("decimal(15, 4)");
entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepMagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepPrtMags)
.HasForeignKey(d => new { d.SklepId, d.SklepMagId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkPrtMagMagazyn");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepPrtMags)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkPrtMagTowar");
});
modelBuilder.Entity<SklepPrzydzial>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.AsId })
.HasName("PK_SKLEPPRZYDZIAL");
entity.ToTable("SklepPrzydzial");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.AsId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.As)
.WithMany(p => p.SklepPrzydzials)
.HasForeignKey(d => d.AsId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPRZ_REF_SKLEP_ASORT");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepPrzydzials)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPPRZ_REF_SKLEP_SKLEP");
});
modelBuilder.Entity<SklepRapWartPocz>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepRwpid })
.HasName("PK_SKLEPRAPWARTPOCZ");
entity.ToTable("SklepRapWartPocz");
entity.HasIndex(e => new { e.SklepId, e.TypRap, e.Data }, "idx_SRWP_TypRapData");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRwpid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("SklepRWPId");
entity.Property(e => e.Data).HasColumnType("datetime");
entity.Property(e => e.ParamTxt)
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Wykonano).HasColumnType("datetime");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepRapWartPoczs)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPRAPWARTPOCZ_REFERENCE_SKLEP");
});
modelBuilder.Entity<SklepRapWartPoczDane>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepRwpid, e.SklepMagId, e.Typ, e.Numer })
.HasName("PK_SKLEPRAPWARTPOCZDANE");
entity.ToTable("SklepRapWartPoczDane");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRwpid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("SklepRWPId");
entity.Property(e => e.SklepMagId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Typ).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Wartosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepRapWartPoczDanes)
.HasForeignKey(d => new { d.SklepId, d.SklepMagId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPRAPWARTPOCZDANE_REFERENCE_SKLEPMAG");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepRapWartPoczDanes)
.HasForeignKey(d => new { d.SklepId, d.SklepRwpid })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPRAPWARTPOCZDANE_REFERENCE_SKLEPRAPWARTPOCZ");
});
modelBuilder.Entity<SklepRegula>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepRegulaId })
.HasName("PK_SKLEPREGULA");
entity.ToTable("SklepRegula");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DataCzasDo).HasColumnType("datetime");
entity.Property(e => e.DataCzasOd).HasColumnType("datetime");
entity.Property(e => e.Nazwa)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Number1).HasColumnType("numeric(16, 4)");
entity.Property(e => e.Number2).HasColumnType("numeric(16, 4)");
entity.Property(e => e.Number3).HasColumnType("numeric(16, 4)");
entity.Property(e => e.Number4).HasColumnType("numeric(16, 4)");
entity.Property(e => e.Str1)
.HasMaxLength(128)
.IsUnicode(false);
entity.Property(e => e.Str2)
.HasMaxLength(128)
.IsUnicode(false);
entity.Property(e => e.Usunieto).HasColumnType("datetime");
entity.Property(e => e.Utworzono).HasColumnType("datetime");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepRegulas)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPREGULA_REFERENCE_SKLEP");
});
modelBuilder.Entity<SklepRegulaAsort>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepRegulaId, e.SklepAsId, e.Znaczenie })
.HasName("PK_SKLEPREGULAASORT");
entity.ToTable("SklepRegulaAsort");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepAsId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepAsNazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepRegulaAsorts)
.HasForeignKey(d => new { d.SklepId, d.SklepRegulaId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPREGULAAS_REFERENCE_SKLEPREGULA");
});
modelBuilder.Entity<SklepRegulaDok>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.SklepRegulaId, e.Kolejnosc })
.HasName("PK_SKLEPREGULADOK");
entity.ToTable("SklepRegulaDok");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Wartosc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc3).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Konto)
.WithMany(p => p.SklepRegulaDoks)
.HasForeignKey(d => d.KontoId)
.HasConstraintName("Ref_SkRegDokKonto");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepRegulaDoks)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkRegDokDok");
});
modelBuilder.Entity<SklepRegulaDokSzczeg>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.SklepRegulaId, e.Kolejnosc, e.Znaczenie })
.HasName("PK_SKLREGULADOKSZCZEG");
entity.ToTable("SklepRegulaDokSzczeg");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Param2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Param3)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.SklepRegulaDok)
.WithMany(p => p.SklepRegulaDokSzczegs)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId, d.SklepRegulaId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SklRgDokSzczegSklRgDok");
});
modelBuilder.Entity<SklepRegulaPar>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepParId, e.SklepRegulaId, e.Kolejnosc })
.HasName("PK_SKLEPREGULAPAR");
entity.ToTable("SklepRegulaPar");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Wartosc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc3).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Konto)
.WithMany(p => p.SklepRegulaPars)
.HasForeignKey(d => d.KontoId)
.HasConstraintName("Ref_SkRegParKonto");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepRegulaPars)
.HasForeignKey(d => new { d.SklepId, d.SklepParId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkRegParPar");
});
modelBuilder.Entity<SklepRegulaParSzczeg>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepParId, e.SklepRegulaId, e.Kolejnosc, e.Znaczenie })
.HasName("PK_SKLREGULAPARSZCZEG");
entity.ToTable("SklepRegulaParSzczeg");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Param2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Param3)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.SklepRegulaPar)
.WithMany(p => p.SklepRegulaParSzczegs)
.HasForeignKey(d => new { d.SklepId, d.SklepParId, d.SklepRegulaId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SklRgParSzczegSklRPar");
});
modelBuilder.Entity<SklepRegulaParam>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepRegulaId, e.Znaczenie })
.HasName("PK_SKLEPREGULAPARAM");
entity.ToTable("SklepRegulaParam");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Param2)
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepRegulaParams)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPREGULAPA_REFERENCE_SKLEP");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepRegulaParams)
.HasForeignKey(d => new { d.SklepId, d.SklepRegulaId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPREGULAPA_REFERENCE_SKLEPREGULA");
});
modelBuilder.Entity<SklepRegulaPozDok>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.Kolejnosc, e.SklepRegulaId, e.Typ })
.HasName("PK_SKLEPREGULAPOZDOK");
entity.ToTable("SklepRegulaPozDok");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Wartosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.SklepPozDok)
.WithMany(p => p.SklepRegulaPozDoks)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkRegPozPoz");
});
modelBuilder.Entity<SklepRegulaPozDokSzczeg>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.Kolejnosc, e.SklepRegulaId, e.Typ, e.KolejnoscRegulaDok })
.HasName("PK_SKLREGPOZDOKSZ");
entity.ToTable("SklepRegulaPozDokSzczeg");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Wartosc1).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc3).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc4).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.SklepPozDok)
.WithMany(p => p.SklepRegulaPozDokSzczegs)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkRegPozSzPoz");
});
modelBuilder.Entity<SklepRegulaPozPar>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepParId, e.Kolejnosc, e.SklepRegulaId, e.Typ })
.HasName("PK_SKLEPREGULAPOZPAR");
entity.ToTable("SklepRegulaPozPar");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Wartosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.SklepPozPar)
.WithMany(p => p.SklepRegulaPozPars)
.HasForeignKey(d => new { d.SklepId, d.SklepParId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkRegPozPar");
});
modelBuilder.Entity<SklepRegulaPozParSzczeg>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepParId, e.Kolejnosc, e.SklepRegulaId, e.Typ, e.KolejnoscRegulaPar })
.HasName("PK_SKLREGPOZPARSZ");
entity.ToTable("SklepRegulaPozParSzczeg");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Wartosc1).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc2).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc3).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Wartosc4).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.SklepPozPar)
.WithMany(p => p.SklepRegulaPozParSzczegs)
.HasForeignKey(d => new { d.SklepId, d.SklepParId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkRegPozPSzPoz");
});
modelBuilder.Entity<SklepRegulaTowar>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepRegulaId, e.SklepTowId, e.Znaczenie })
.HasName("PK_SKLEPREGULATOWAR");
entity.ToTable("SklepRegulaTowar");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepRegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Cena).HasColumnType("numeric(16, 4)");
entity.Property(e => e.Ilosc).HasColumnType("numeric(16, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepRegulaTowars)
.HasForeignKey(d => new { d.SklepId, d.SklepRegulaId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPREGULATO_REFERENCE_SKLEPREGULA");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepRegulaTowars)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPREGULATO_REFERENCE_SKLEPTOWAR");
});
modelBuilder.Entity<SklepRola>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepRolaId })
.HasName("PK_SKLEPROLA");
entity.ToTable("SklepRola");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.CentrRola)
.WithMany(p => p.SklepRolas)
.HasForeignKey(d => d.CentrRolaId)
.HasConstraintName("Ref_SklepRolaRola");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepRolas)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SklepRolaSklep");
});
modelBuilder.Entity<SklepRozPrtMag>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.Pmid, e.Znaczenie, e.SklepDokId, e.Kolejnosc })
.HasName("PK_SKLEPROZPRTMAG");
entity.ToTable("SklepRozPrtMag");
entity.HasIndex(e => new { e.SklepId, e.SklepDokId, e.Kolejnosc, e.Znaczenie, e.Pmid }, "idx_SkRozPrtMagPoz");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Pmid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PMId");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Dzien).HasColumnType("datetime");
entity.Property(e => e.IloscPrt).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.SklepPozDok)
.WithMany(p => p.SklepRozPrtMags)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkRozPrtMagPoz");
entity.HasOne(d => d.SklepPrtMag)
.WithMany(p => p.SklepRozPrtMags)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId, d.Pmid })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkRozPrtMagPrt");
});
modelBuilder.Entity<SklepRozbicieDok>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.Stawka })
.HasName("PK_SKLEPROZBICIEDOK");
entity.ToTable("SklepRozbicieDok");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Netto).HasColumnType("decimal(15, 4)");
entity.Property(e => e.NettoDet).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Podatek).HasColumnType("decimal(15, 4)");
entity.Property(e => e.PodatekDet).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepRozbicieDoks)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPROZ_REF_SKLEP_SKLEPDOK");
});
modelBuilder.Entity<SklepRozlPartii>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.RozSklepDokId, e.RozKolejnosc, e.PrtSklepDokId, e.PrtKolejnosc })
.HasName("PK_SKLEPROZLPARTII");
entity.ToTable("SklepRozlPartii");
entity.HasIndex(e => new { e.SklepId, e.PrtSklepDokId, e.PrtKolejnosc }, "idx_SkRozPrt");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RozSklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.PrtSklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Rozliczenie).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.SklepPartium)
.WithMany(p => p.SklepRozlPartiis)
.HasForeignKey(d => new { d.SklepId, d.PrtSklepDokId, d.PrtKolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPROZ_REF_SKPRT_SKLEPPAR");
entity.HasOne(d => d.SklepPozDok)
.WithMany(p => p.SklepRozlPartiis)
.HasForeignKey(d => new { d.SklepId, d.RozSklepDokId, d.RozKolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPROZ_REF_SKROZ_SKLEPPOZ");
});
modelBuilder.Entity<SklepRozlicza>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.Kolejnosc })
.HasName("PK_SKLEPROZLICZA");
entity.ToTable("SklepRozlicza");
entity.HasIndex(e => new { e.RozliczanySklepId, e.RozliczanySklepDokId }, "idx_SkRozliczany");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RozliczanySklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.RozliczanySklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Rozliczenie).HasColumnType("decimal(15, 4)");
entity.Property(e => e.RozliczeniePodatku).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.RozliczanySklep)
.WithMany(p => p.SklepRozliczaRozliczanySkleps)
.HasForeignKey(d => new { d.RozliczanySklepId, d.RozliczanySklepDokId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPROZ_REF_SKKOG_SKLEPDOK");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepRozliczaSkleps)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPROZ_REF_SKKTO_SKLEPDOK");
});
modelBuilder.Entity<SklepSkladnikDefinicjiKodu>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDkid, e.Kolejnosc })
.HasName("PK_SKSKLDEFKODU");
entity.ToTable("SklepSkladnikDefinicjiKodu");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDkid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("SklepDKId");
entity.Property(e => e.Tekst)
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepSkladnikDefinicjiKodus)
.HasForeignKey(d => new { d.SklepId, d.SklepDkid })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKSKLDEFKODUDEFDOKU");
});
modelBuilder.Entity<SklepSkladnikWzorca>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepSkWzId })
.HasName("PK_SKLEPSKLADNIKWZORCA");
entity.ToTable("SklepSkladnikWzorca");
entity.HasIndex(e => new { e.SklepTowIdWzorca, e.Kolejnosc }, "idx_SkSkladnikWzorca_SkTowIdWzorca");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepSkWzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Cena).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Ilosc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.SkWzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowIdWzorca).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepSkladnikWzorcas)
.HasForeignKey(d => new { d.SklepId, d.SklepTowIdWzorca })
.HasConstraintName("FK_SKSKLADNIKWZORCA_REFERENCE_SKTOWAR");
});
modelBuilder.Entity<SklepSklep>(entity =>
{
entity.HasKey(e => new { e.CentralaId, e.SklepId })
.HasName("PK_SKLEPSKLEP");
entity.ToTable("SklepSklep");
entity.Property(e => e.CentralaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Centrala)
.WithMany(p => p.SklepSklepCentralas)
.HasForeignKey(d => d.CentralaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPSKL_REF_SKCEN_SKLEP");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepSklepSkleps)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPSKL_REF_SKSKL_SKLEP");
});
modelBuilder.Entity<SklepStanPrtMag>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.Dzien, e.SklepTowId, e.Pmid })
.HasName("PK_SKLEPSTANPRTMAG");
entity.ToTable("SklepStanPrtMag");
entity.HasIndex(e => new { e.SklepId, e.SklepTowId, e.Pmid, e.Dzien }, "idx_SkStanPrt");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Dzien).HasColumnType("datetime");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Pmid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PMId");
entity.Property(e => e.StanPrt).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.SklepDzienRozl)
.WithMany(p => p.SklepStanPrtMags)
.HasForeignKey(d => new { d.SklepId, d.Dzien })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkStanPrtDzien");
entity.HasOne(d => d.SklepPrtMag)
.WithMany(p => p.SklepStanPrtMags)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId, d.Pmid })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkStanPrtMag");
});
modelBuilder.Entity<SklepSzczegPrtMag>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.Pmid, e.TypDanych })
.HasName("PK_SKLEPSZCZEGPRTMAG");
entity.ToTable("SklepSzczegPrtMag");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Pmid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PMId");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.SklepPrtMag)
.WithMany(p => p.SklepSzczegPrtMags)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId, d.Pmid })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SklepSzczegPrtMag");
});
modelBuilder.Entity<SklepTekstDok>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.Znaczenie })
.HasName("PK_SKLEPTEKSTDOK");
entity.ToTable("SklepTekstDok");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepTekstDoks)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPTEK_REF_SKLEP_SKLEPDOK");
});
modelBuilder.Entity<SklepTekstPoz>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.Kolejnosc, e.Znaczenie })
.HasName("PK_SKLEPTEKSTPOZ");
entity.ToTable("SklepTekstPoz");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.SklepPozDok)
.WithMany(p => p.SklepTekstPozs)
.HasForeignKey(d => new { d.SklepId, d.SklepDokId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SklepTekstPoz");
});
modelBuilder.Entity<SklepTekstZgody>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepZgId, e.Wersja, e.Kolejnosc })
.HasName("PK_SKLEPTEKSTZGODY");
entity.ToTable("SklepTekstZgody");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepZgId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Wersja)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepTekstZgodies)
.HasForeignKey(d => new { d.SklepId, d.SklepZgId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKTXTZG_SKZGODA");
});
modelBuilder.Entity<SklepTowAkcyza>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.Kolejnosc })
.HasName("PK_SKLEPTOWAKCYZA");
entity.ToTable("SklepTowAkcyza");
entity.HasIndex(e => new { e.SklepId, e.SklepGrAkcId }, "idx_SkTowAkcGr");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CenaMax).HasColumnType("decimal(15, 4)");
entity.Property(e => e.IleAkcJm)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleAkcJM");
entity.Property(e => e.KodCn)
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("KodCN");
entity.Property(e => e.Sklad).HasColumnType("decimal(15, 4)");
entity.Property(e => e.SklepGrAkcId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepTowAkcyzas)
.HasForeignKey(d => new { d.SklepId, d.SklepGrAkcId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkAkcTow");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepTowAkcyzas)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkTowAkc");
});
modelBuilder.Entity<SklepTowDodatek>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.Kolejnosc })
.HasName("PK_SKLEPTOWDODATEK");
entity.ToTable("SklepTowDodatek");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Cena).HasColumnType("decimal(15, 4)");
entity.Property(e => e.DodSklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Ilosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.SklepTowar)
.WithMany(p => p.SklepTowDodatekSklepTowars)
.HasForeignKey(d => new { d.SklepId, d.DodSklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkDodTow");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepTowDodatekSkleps)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkTowDod");
});
modelBuilder.Entity<SklepTowKod>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.Kolejnosc })
.HasName("PK_SKLEPTOWKOD");
entity.ToTable("SklepTowKod");
entity.HasIndex(e => e.Kod, "idx_SklepKod");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.IleWkodzie)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleWKodzie");
entity.Property(e => e.Kod)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.PrefPlu).HasColumnName("PrefPLU");
entity.Property(e => e.Skrot)
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepTowKods)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPTOW_REF_KODSK_SKLEPTOW");
});
modelBuilder.Entity<SklepTowPowiazanie>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.Znaczenie })
.HasName("PK_SKLEPTOWPOWIAZANIE");
entity.ToTable("SklepTowPowiazanie");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.PowSklepTowId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.SklepTowar)
.WithMany(p => p.SklepTowPowiazanieSklepTowars)
.HasForeignKey(d => new { d.SklepId, d.PowSklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkPowTowPow_SkTow");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepTowPowiazanieSkleps)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SkTowPow_SkTow");
});
modelBuilder.Entity<SklepTowStraty>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.IdxRodzStrat })
.HasName("PK_SKLEPTOWSTRATY");
entity.ToTable("SklepTowStraty");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.NormaStrat).HasColumnType("decimal(10, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepTowStraties)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKTWSTR_TOW");
});
modelBuilder.Entity<SklepTowar>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepTowId })
.HasName("PK_SKLEPTOWAR");
entity.ToTable("SklepTowar");
entity.HasIndex(e => new { e.SklepId, e.SklepArtId }, "idx_SklepTowArt");
entity.HasIndex(e => new { e.SklepId, e.SklepProducent }, "idx_SklepTowProd");
entity.HasIndex(e => new { e.SklepId, e.TowId }, "idx_SklepTowSkTow");
entity.HasIndex(e => e.TowId, "idx_SklepTowTow");
entity.HasIndex(e => e.Zmiana, "idx_SklepTowZmiana");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Asortyment)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Cena5).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Cena6).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaDet).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaDod).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaEw).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaHurt).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaNoc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CentrTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Cku)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("CKU");
entity.Property(e => e.GrupaGtu)
.HasMaxLength(3)
.IsUnicode(false)
.HasColumnName("GrupaGTU");
entity.Property(e => e.HurtRabat).HasColumnType("decimal(10, 4)");
entity.Property(e => e.IleWcalosci)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleWCalosci");
entity.Property(e => e.IleWopak)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleWOpak");
entity.Property(e => e.IleWzgrzewce)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleWZgrzewce");
entity.Property(e => e.Indeks1)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Indeks2)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Jm)
.IsRequired()
.HasMaxLength(10)
.IsUnicode(false)
.HasColumnName("JM");
entity.Property(e => e.Kategoria)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.KodCn)
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("KodCN");
entity.Property(e => e.KodKrajuPochodzenia)
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.Marza).HasColumnType("decimal(10, 4)");
entity.Property(e => e.MaxCenaZak).HasColumnType("decimal(15, 4)");
entity.Property(e => e.MinCenaSp).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.NocNarzut).HasColumnType("decimal(10, 4)");
entity.Property(e => e.NowoscOd).HasColumnType("datetime");
entity.Property(e => e.Opis1)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Opis2)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Opis3)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Opis4)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.ProgPromocji).HasColumnType("decimal(15, 4)");
entity.Property(e => e.PrzeliczJm)
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("PrzeliczJM");
entity.Property(e => e.Rezerwa1)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Rezerwa2)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.SklepArtId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepOpakId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepProducent).HasColumnType("numeric(9, 0)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepTowars)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPTOW_REF_SKLEP_SKLEP");
entity.HasOne(d => d.Tow)
.WithMany(p => p.SklepTowars)
.HasForeignKey(d => d.TowId)
.HasConstraintName("FK_SKLEPTOW_REF_SKLEP_TOWAR");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepTowars)
.HasForeignKey(d => new { d.SklepId, d.SklepArtId })
.HasConstraintName("FK_SKLEPTOW_REF_SKTOW_SKLEPART");
entity.HasOne(d => d.Sklep1)
.WithMany(p => p.SklepTowars)
.HasForeignKey(d => new { d.SklepId, d.SklepProducent })
.HasConstraintName("FK_SKLEPTOW_REF_SKLEP_SKLEPKON");
});
modelBuilder.Entity<SklepTowarSkladnika>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepSkWzId, e.SklepTowId })
.HasName("PK_SKLEPTOWARSKLADNIKA");
entity.ToTable("SklepTowarSkladnika");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepSkWzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Cena).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaZkartyTow).HasColumnName("CenaZKartyTow");
entity.Property(e => e.Ilosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepTowarSkladnikas)
.HasForeignKey(d => new { d.SklepId, d.SklepSkWzId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKTOWARSKLADNIKA_REFERENCE_SKSKLADNIKWZORCA");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepTowarSkladnikas)
.HasForeignKey(d => new { d.SklepId, d.SklepTowId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKTOWARSKLADNIKA_REFERENCE_SKTOWAR");
});
modelBuilder.Entity<SklepTypO>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepTypOsId })
.HasName("PK_SKLEPTYPOS");
entity.HasIndex(e => e.TypOsId, "idx_SKTYPOS_TYPOS");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepTypOsId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrTypOsId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Komentarz)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.TypOsId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepTypOs)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKTYPOS_SKLEP");
entity.HasOne(d => d.TypOs)
.WithMany(p => p.SklepTypOs)
.HasForeignKey(d => d.TypOsId)
.HasConstraintName("FK_SKTYPOS_TYPOS");
});
modelBuilder.Entity<SklepUprawnienie>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepUzId, e.Rodzaj })
.HasName("PK_SKLEPUPRAWNIENIE");
entity.ToTable("SklepUprawnienie");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepUzId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepUprawnienies)
.HasForeignKey(d => new { d.SklepId, d.SklepUzId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPUPR_REF_SKUPR_SKLEPUZY");
});
modelBuilder.Entity<SklepUzytkownik>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepUzId })
.HasName("PK_SKLEPUZYTKOWNIK");
entity.ToTable("SklepUzytkownik");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepUzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Haslo)
.HasMaxLength(50)
.IsUnicode(false);
entity.Property(e => e.HasloPrepaid)
.HasMaxLength(100)
.IsUnicode(false);
entity.Property(e => e.IdentPrepaid)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Identyfikator)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Jezyk)
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.KodKasjera)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Nazwisko)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.OstZmianaHasla).HasColumnType("datetime");
entity.Property(e => e.SklepProfilId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.UzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepUzytkowniks)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPUZY_REF_SKUZ_SKLEP");
entity.HasOne(d => d.Uz)
.WithMany(p => p.SklepUzytkowniks)
.HasForeignKey(d => d.UzId)
.HasConstraintName("FK_SKLEPUZYTKOWINK_REFERENCE_UZYTKOWNIK");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepUzytkowniks)
.HasForeignKey(d => new { d.SklepId, d.SklepProfilId })
.HasConstraintName("FK_SKLEPUZYTKOWINK_REFERENCE_SKLEPPROFIL");
});
modelBuilder.Entity<SklepWalutum>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepWalId })
.HasName("PK_SK_WALUTA");
entity.HasIndex(e => e.WalId, "idx_SkWal");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepWalId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kod)
.IsRequired()
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Skrot1)
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.Skrot100)
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.WalId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepWaluta)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPWAL_REF_SKWAL_SKLEP");
entity.HasOne(d => d.Wal)
.WithMany(p => p.SklepWaluta)
.HasForeignKey(d => d.WalId)
.HasConstraintName("FK_SKLEPWAL_REF_SKWAL_WALUTA");
});
modelBuilder.Entity<SklepZaleznosc>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepDokId })
.HasName("PK_SKLEPZALEZNOSC");
entity.ToTable("SklepZaleznosc");
entity.HasIndex(e => new { e.PoprzedniSklepId, e.PoprzedniSklepDokId }, "idx_SklepPoprzedniDokId");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.PoprzedniSklepDokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.PoprzedniSklepId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.PoprzedniSklep)
.WithMany(p => p.SklepZaleznoscPoprzedniSkleps)
.HasForeignKey(d => new { d.PoprzedniSklepId, d.PoprzedniSklepDokId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPZAL_REF_SKDOD_SKLEPDOK");
entity.HasOne(d => d.Sklep)
.WithOne(p => p.SklepZaleznoscSklep)
.HasForeignKey<SklepZaleznosc>(d => new { d.SklepId, d.SklepDokId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKLEPZAL_REF_SKODD_SKLEPDOK");
});
modelBuilder.Entity<SklepZasob>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.Tabela, e.Id, e.Typ })
.HasName("PK_SKLEPZASOB");
entity.ToTable("SklepZasob");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Id).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Typ)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Sciezka)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepZasobs)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SklepZasobSklep");
});
modelBuilder.Entity<SklepZdarzO>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepKontrId, e.Kiedy })
.HasName("PK_SKLEPZDARZOS");
entity.HasIndex(e => new { e.SklepId, e.SklepUzId, e.Kiedy }, "idx_SKZDOSUZKIEDY");
entity.HasIndex(e => new { e.SklepId, e.SklepKontrId, e.SklepZgId, e.DataDec }, "idx_SKZDOS_OSTDEC");
entity.HasIndex(e => new { e.SklepId, e.SklepKontrId, e.SklepZgId, e.Kiedy }, "idx_SKZDOS_OSTZGODA");
entity.HasIndex(e => new { e.SklepId, e.SklepTypOsId }, "idx_SKZDOS_SKTPOS");
entity.HasIndex(e => new { e.SklepId, e.SklepZgId }, "idx_SKZDOS_SKZG");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kiedy)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.DataDec).HasColumnType("datetime");
entity.Property(e => e.DodPar)
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.SklepTypOsId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepUzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepZgId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Wersja)
.HasMaxLength(20)
.IsUnicode(false);
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepZdarzOs)
.HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKZDOS_SKKTH");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.SklepZdarzOs)
.HasForeignKey(d => new { d.SklepId, d.SklepTypOsId })
.HasConstraintName("FK_SKZDOS_SKTPOS");
entity.HasOne(d => d.Sklep1)
.WithMany(p => p.SklepZdarzOs)
.HasForeignKey(d => new { d.SklepId, d.SklepUzId })
.HasConstraintName("FK_SKZDOSUZ");
entity.HasOne(d => d.Sklep2)
.WithMany(p => p.SklepZdarzOs)
.HasForeignKey(d => new { d.SklepId, d.SklepZgId })
.HasConstraintName("FK_SKZDOS_SKZG");
});
modelBuilder.Entity<SklepZdarzOsOpi>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepKontrId, e.Kiedy, e.Znaczenie })
.HasName("PK_SKZDARZOSOPIS");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kiedy)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.SklepZdarzO)
.WithMany(p => p.SklepZdarzOsOpis)
.HasForeignKey(d => new { d.SklepId, d.SklepKontrId, d.Kiedy })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKZDOSOPIS");
});
modelBuilder.Entity<SklepZgodum>(entity =>
{
entity.HasKey(e => new { e.SklepId, e.SklepZgId })
.HasName("PK_SKLEPZGODA");
entity.HasIndex(e => e.ZgId, "idx_SKZG_ZGODA");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepZgId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrZgId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DaneOs)
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Komentarz)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Wersja)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Zastosowania)
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.ZgId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.SklepZgoda)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SKZG_SKLEP");
entity.HasOne(d => d.Zg)
.WithMany(p => p.SklepZgoda)
.HasForeignKey(d => d.ZgId)
.HasConstraintName("FK_SKZG_ZGODA");
});
modelBuilder.Entity<Sprzedaz>(entity =>
{
entity.HasKey(e => new { e.TowId, e.SklepId, e.CzasId, e.SklepTowId })
.HasName("PK_SPRZEDAZ");
entity.ToTable("Sprzedaz");
entity.HasIndex(e => new { e.CzasId, e.SklepId, e.TowId }, "Sprzedaz_Czas_Sklep_Towar");
entity.HasIndex(e => new { e.CzasId, e.TowId, e.SklepId }, "Sprzedaz_Czas_Towar_Sklep");
entity.HasIndex(e => new { e.SklepId, e.TowId }, "Sprzedaz_Sklep_Towar");
entity.HasIndex(e => new { e.TowId, e.SklepId }, "Sprzedaz_Towar_Sklep");
entity.HasIndex(e => e.SklepId, "idx_Sprzedaz_SklepId");
entity.HasIndex(e => e.TowId, "idx_Sprzedaz_TowId");
entity.Property(e => e.TowId)
.HasColumnType("numeric(9, 0)")
.HasColumnName("TowID");
entity.Property(e => e.SklepId)
.HasColumnType("numeric(9, 0)")
.HasColumnName("SklepID");
entity.Property(e => e.CzasId)
.HasColumnType("numeric(9, 0)")
.HasColumnName("CzasID");
entity.Property(e => e.SklepTowId)
.HasColumnType("numeric(9, 0)")
.HasColumnName("SklepTowID");
entity.Property(e => e.CenaSprzedazyBrutto).HasColumnType("decimal(14, 3)");
entity.Property(e => e.CenaSprzedazyNetto).HasColumnType("decimal(14, 3)");
entity.Property(e => e.CenaZakInne).HasColumnType("decimal(14, 3)");
entity.Property(e => e.CenaZakPrzes).HasColumnType("decimal(14, 3)");
entity.Property(e => e.CenaZakZakupy).HasColumnType("decimal(14, 3)");
entity.Property(e => e.CenaZakupuNetto).HasColumnType("decimal(14, 3)");
entity.Property(e => e.IlSprzedana).HasColumnType("decimal(14, 3)");
entity.Property(e => e.IlSztTowFakt).HasColumnType("decimal(14, 3)");
entity.Property(e => e.IlSztTowHurt).HasColumnType("decimal(14, 3)");
entity.Property(e => e.IlSztTowPar).HasColumnType("decimal(14, 3)");
entity.Property(e => e.IlSztTowPrzes).HasColumnType("decimal(14, 3)");
entity.Property(e => e.IlSztTowRozchody).HasColumnType("decimal(14, 3)");
entity.Property(e => e.IlTowFakt).HasColumnType("decimal(14, 3)");
entity.Property(e => e.IlTowPar).HasColumnType("decimal(14, 3)");
entity.Property(e => e.IlZakInne).HasColumnType("decimal(14, 3)");
entity.Property(e => e.IlZakPrzes).HasColumnType("decimal(14, 3)");
entity.Property(e => e.IlZakZakupy).HasColumnType("decimal(14, 3)");
entity.Property(e => e.IlZakupiona).HasColumnType("decimal(14, 3)");
entity.Property(e => e.StanTowaru).HasColumnType("decimal(14, 3)");
entity.Property(e => e.Version)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.WartNetZapas).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartSprzBrtFakt).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartSprzBrtHurt).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartSprzBrtPar).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartSprzBrtPrzes).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartSprzBrtRozchody).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartSprzNetFakt).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartSprzNetHurt).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartSprzNetPar).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartSprzNetPrzes).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartSprzNetRozchody).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartZakBrtFakt).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartZakBrtHurt).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartZakBrtPar).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartZakBrtPrzes).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartZakBrtRozchody).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartZakInne).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartZakNetFakt).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartZakNetHurt).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartZakNetPar).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartZakNetPrzes).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartZakNetRozchody).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartZakPrzes).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartZakZakupy).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartoscSprzedazWcenieZakupu)
.HasColumnType("decimal(14, 3)")
.HasColumnName("WartoscSprzedazWCenieZakupu");
entity.Property(e => e.WartoscSprzedazyBrutto).HasColumnType("decimal(14, 3)");
entity.Property(e => e.WartoscSprzedazyNetto).HasColumnType("decimal(14, 3)");
});
modelBuilder.Entity<StanPrtMag>(entity =>
{
entity.HasKey(e => new { e.Dzien, e.TowId, e.Pmid })
.HasName("PK_STANPRTMAG");
entity.ToTable("StanPrtMag");
entity.HasIndex(e => new { e.TowId, e.Pmid, e.Dzien }, "idx_StanPrt");
entity.Property(e => e.Dzien).HasColumnType("datetime");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Pmid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PMId");
entity.Property(e => e.StanPrt).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.DzienNavigation)
.WithMany(p => p.StanPrtMags)
.HasForeignKey(d => d.Dzien)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_StanPrtDzien");
entity.HasOne(d => d.PrtMag)
.WithMany(p => p.StanPrtMags)
.HasForeignKey(d => new { d.TowId, d.Pmid })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_StanPrtMag");
});
modelBuilder.Entity<StanZgody>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.ZgId })
.HasName("PK_STANZGODY");
entity.ToTable("StanZgody");
entity.HasIndex(e => e.ZgId, "idx_STZG_ZG");
entity.HasIndex(e => e.Zmiana, "idx_STZG_ZMIANA");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ZgId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DataDec).HasColumnType("datetime");
entity.Property(e => e.Kiedy)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Wersja)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.StanZgodies)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_STZG_KTH");
entity.HasOne(d => d.Zg)
.WithMany(p => p.StanZgodies)
.HasForeignKey(d => d.ZgId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_STZG_ZG");
});
modelBuilder.Entity<Struktura73>(entity =>
{
entity.HasKey(e => e.ModId)
.HasName("PK_STRUKTURA_7_3");
entity.ToTable("Struktura_7_3");
entity.Property(e => e.ModId).ValueGeneratedNever();
entity.Property(e => e.Kiedy).HasColumnType("datetime");
entity.Property(e => e.Wersja)
.HasMaxLength(40)
.IsUnicode(false);
});
modelBuilder.Entity<Subsy>(entity =>
{
entity.HasKey(e => e.KodSubsys)
.HasName("PK_SUBSYS");
entity.HasIndex(e => new { e.TowId, e.KodSubsys }, "idx_SubsysTow");
entity.HasIndex(e => e.Zmiana, "idx_SubsysZmiana");
entity.Property(e => e.KodSubsys)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.DataDok).HasColumnType("datetime");
entity.Property(e => e.IleWzgrzewce)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleWZgrzewce");
entity.Property(e => e.KodZgrzewki)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.NrDok)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Tow)
.WithMany(p => p.Subsies)
.HasForeignKey(d => d.TowId)
.HasConstraintName("FK_SUBSYS_TOW");
});
modelBuilder.Entity<SzczegPrtMag>(entity =>
{
entity.HasKey(e => new { e.TowId, e.Pmid, e.TypDanych })
.HasName("PK_SZCZEGPRTMAG");
entity.ToTable("SzczegPrtMag");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Pmid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("PMId");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.PrtMag)
.WithMany(p => p.SzczegPrtMags)
.HasForeignKey(d => new { d.TowId, d.Pmid })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_SzczegPrtMag");
});
modelBuilder.Entity<TabelaAkcyzowa>(entity =>
{
entity.HasKey(e => new { e.GrAkcId, e.OdDaty })
.HasName("PK_TABELAAKCYZOWA");
entity.ToTable("TabelaAkcyzowa");
entity.Property(e => e.GrAkcId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.OdDaty).HasColumnType("datetime");
entity.Property(e => e.MinStawkaAkc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.ProcCenyMax).HasColumnType("decimal(10, 4)");
entity.Property(e => e.StawkaAkc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.GrAkc)
.WithMany(p => p.TabelaAkcyzowas)
.HasForeignKey(d => d.GrAkcId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_TabAkc");
});
modelBuilder.Entity<TekstDok>(entity =>
{
entity.HasKey(e => new { e.DokId, e.Znaczenie })
.HasName("PK_TEKSTDOK");
entity.ToTable("TekstDok");
entity.HasIndex(e => new { e.Tekst, e.Znaczenie }, "idx_TekstDokTekstZnaczenie");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Dok)
.WithMany(p => p.TekstDoks)
.HasForeignKey(d => d.DokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_TEKSTDOK_REF_TEKST_DOK");
});
modelBuilder.Entity<TekstPoz>(entity =>
{
entity.HasKey(e => new { e.DokId, e.Kolejnosc, e.Znaczenie })
.HasName("PK_TEKSTPOZ");
entity.ToTable("TekstPoz");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.PozDok)
.WithMany(p => p.TekstPozs)
.HasForeignKey(d => new { d.DokId, d.Kolejnosc })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_TekstPoz");
});
modelBuilder.Entity<TekstZgody>(entity =>
{
entity.HasKey(e => new { e.ZgId, e.Wersja, e.Kolejnosc })
.HasName("PK_TEKSTZGODY");
entity.ToTable("TekstZgody");
entity.HasIndex(e => e.Zmiana, "idx_TXTZG_ZMIANA");
entity.Property(e => e.ZgId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Wersja)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Zg)
.WithMany(p => p.TekstZgodies)
.HasForeignKey(d => d.ZgId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_TXTZG_ZGODA");
});
modelBuilder.Entity<TowAkcyza>(entity =>
{
entity.HasKey(e => new { e.TowId, e.Kolejnosc })
.HasName("PK_TOWAKCYZA");
entity.ToTable("TowAkcyza");
entity.HasIndex(e => e.GrAkcId, "idx_TowAkcGr");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CenaMax).HasColumnType("decimal(15, 4)");
entity.Property(e => e.GrAkcId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.IleAkcJm)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleAkcJM");
entity.Property(e => e.KodCn)
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("KodCN");
entity.Property(e => e.Sklad).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.GrAkc)
.WithMany(p => p.TowAkcyzas)
.HasForeignKey(d => d.GrAkcId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_AkcTow");
entity.HasOne(d => d.Tow)
.WithMany(p => p.TowAkcyzas)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_TowAkc");
});
modelBuilder.Entity<TowDodatek>(entity =>
{
entity.HasKey(e => new { e.TowId, e.Kolejnosc })
.HasName("PK_TOWDODATEK");
entity.ToTable("TowDodatek");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Cena).HasColumnType("decimal(15, 4)");
entity.Property(e => e.DodTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Ilosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.DodTow)
.WithMany(p => p.TowDodatekDodTows)
.HasForeignKey(d => d.DodTowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_DodTow");
entity.HasOne(d => d.Tow)
.WithMany(p => p.TowDodatekTows)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_TowDod");
});
modelBuilder.Entity<TowKraj>(entity =>
{
entity.HasKey(e => new { e.TowId, e.KrajId })
.HasName("PK_TOWKRAJ");
entity.ToTable("TowKraj");
entity.HasIndex(e => new { e.KrajId, e.TowId }, "idx_KrajTow");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KrajId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CenaDet).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaDod).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaHurt).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaNoc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaZak).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Indeks1)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Indeks2)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Nazwa)
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Opis1)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Opis2)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Opis3)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Opis4)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Skrot)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Kraj)
.WithMany(p => p.TowKrajs)
.HasForeignKey(d => d.KrajId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_Ref_KrajTow");
entity.HasOne(d => d.Tow)
.WithMany(p => p.TowKrajs)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_Ref_TowKraj");
});
modelBuilder.Entity<TowPowiazanie>(entity =>
{
entity.HasKey(e => new { e.TowId, e.Znaczenie })
.HasName("PK_TOWPOWIAZANIE");
entity.ToTable("TowPowiazanie");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.PowTowId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.PowTow)
.WithMany(p => p.TowPowiazaniePowTows)
.HasForeignKey(d => d.PowTowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_PowTowPow_Tow");
entity.HasOne(d => d.Tow)
.WithMany(p => p.TowPowiazanieTows)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_TowPow_Tow");
});
modelBuilder.Entity<TowStraty>(entity =>
{
entity.HasKey(e => new { e.TowId, e.IdxRodzStrat })
.HasName("PK_TOWSTRATY");
entity.ToTable("TowStraty");
entity.HasIndex(e => e.IdxRodzStrat, "idx_TwStrRS");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.NormaStrat).HasColumnType("decimal(10, 4)");
entity.HasOne(d => d.Tow)
.WithMany(p => p.TowStraties)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_TWSTR_TOW");
});
modelBuilder.Entity<TowStratyDlaSklepu>(entity =>
{
entity.HasKey(e => new { e.TowId, e.IdxRodzStrat, e.SklepId })
.HasName("PK_TOWSTRATYDLASKLEPU");
entity.ToTable("TowStratyDlaSklepu");
entity.HasIndex(e => e.SklepId, "idx_TwStrSk");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.NormaStrat).HasColumnType("decimal(10, 4)");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.TowStratyDlaSklepus)
.HasForeignKey(d => d.SklepId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_TWSTRSKL_SKL");
entity.HasOne(d => d.TowStraty)
.WithMany(p => p.TowStratyDlaSklepus)
.HasForeignKey(d => new { d.TowId, d.IdxRodzStrat })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_TWSTRSKL_TWSTR");
});
modelBuilder.Entity<TowWartosc>(entity =>
{
entity.HasKey(e => new { e.TowId, e.ParId })
.HasName("PK_TOWWARTOSC");
entity.ToTable("TowWartosc");
entity.HasIndex(e => new { e.ParId, e.Wartosc }, "idx_TowWartParIdWart");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Par)
.WithMany(p => p.TowWartoscs)
.HasForeignKey(d => d.ParId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_TOWWARTO_REF_PARTO_PARAMETR");
entity.HasOne(d => d.Tow)
.WithMany(p => p.TowWartoscs)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_TOWWARTO_REF_TOWWA_TOWAR");
});
modelBuilder.Entity<Towar>(entity =>
{
entity.HasKey(e => e.TowId)
.HasName("PK_TOWAR");
entity.ToTable("Towar");
entity.HasIndex(e => e.ArtId, "idx_TowArtId");
entity.HasIndex(e => e.AsId, "idx_TowAsId");
entity.HasIndex(e => e.Cku, "idx_TowCKU");
entity.HasIndex(e => e.Jmid, "idx_TowJMId");
entity.HasIndex(e => e.KatId, "idx_TowKatId");
entity.HasIndex(e => e.Kod, "idx_TowKod");
entity.HasIndex(e => e.KodZgrzewki, "idx_TowKodZgrzewki");
entity.HasIndex(e => e.Producent, "idx_TowProducent");
entity.HasIndex(e => e.Skrot, "idx_TowSkrot");
entity.HasIndex(e => e.Zmiana, "idx_TowZmiana");
entity.Property(e => e.TowId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.ArtId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.AsId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Cena5).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Cena6).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaDet).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaDod).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaEw).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaHurt).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaNoc).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CentrTowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Cku)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("CKU");
entity.Property(e => e.GrupaGtu)
.HasMaxLength(3)
.IsUnicode(false)
.HasColumnName("GrupaGTU");
entity.Property(e => e.HurtRabat).HasColumnType("decimal(10, 4)");
entity.Property(e => e.IleWcalosci)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleWCalosci");
entity.Property(e => e.IleWzgrzewce)
.HasColumnType("decimal(15, 4)")
.HasColumnName("IleWZgrzewce");
entity.Property(e => e.Indeks1)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Indeks2)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Jmid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("JMId");
entity.Property(e => e.KatId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kod)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.KodCn)
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("KodCN");
entity.Property(e => e.KodZgrzewki)
.IsRequired()
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.KrajIdPochodzenia).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Marza).HasColumnType("decimal(10, 4)");
entity.Property(e => e.MaxCenaZak).HasColumnType("decimal(15, 4)");
entity.Property(e => e.MinCenaSp).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.NocNarzut).HasColumnType("decimal(10, 4)");
entity.Property(e => e.NowoscOd).HasColumnType("datetime");
entity.Property(e => e.Opis1)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Opis2)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Opis3)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Opis4)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.PrefPlu).HasColumnName("PrefPLU");
entity.Property(e => e.Producent).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ProgPromocji).HasColumnType("decimal(15, 4)");
entity.Property(e => e.PrzeliczJm)
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("PrzeliczJM");
entity.Property(e => e.Rezerwa1)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Rezerwa2)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Skrot)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.SubsysKoduGlownego)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.Property(e => e.ZmianaIstotna).HasColumnType("datetime");
entity.Property(e => e.ZmianaTylkoCen).HasColumnType("datetime");
entity.HasOne(d => d.Art)
.WithMany(p => p.Towars)
.HasForeignKey(d => d.ArtId)
.HasConstraintName("FK_TOWAR_REF_TOWAR_ARTYKUL");
entity.HasOne(d => d.As)
.WithMany(p => p.Towars)
.HasForeignKey(d => d.AsId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_TOWAR_REF_TOWAS_ASORT");
entity.HasOne(d => d.Jm)
.WithMany(p => p.Towars)
.HasForeignKey(d => d.Jmid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_TOWAR_REF_TOWJM_JM");
entity.HasOne(d => d.Kat)
.WithMany(p => p.Towars)
.HasForeignKey(d => d.KatId)
.HasConstraintName("FK_TOWAR_REF_TOWKA_KATEGORI");
entity.HasOne(d => d.KrajIdPochodzeniaNavigation)
.WithMany(p => p.Towars)
.HasForeignKey(d => d.KrajIdPochodzenia)
.HasConstraintName("FK_Ref_TowarKrajPochodzenia");
entity.HasOne(d => d.ProducentNavigation)
.WithMany(p => p.Towars)
.HasForeignKey(d => d.Producent)
.HasConstraintName("FK_TOWAR_REF_PRODU_KONTRAHE");
});
modelBuilder.Entity<TowarSkladnika>(entity =>
{
entity.HasKey(e => new { e.SkWzId, e.TowId })
.HasName("PK_TOWARSKLADNIKA");
entity.ToTable("TowarSkladnika");
entity.HasIndex(e => e.SkWzId, "idx_TowarSkladniaka");
entity.Property(e => e.SkWzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Cena).HasColumnType("decimal(15, 4)");
entity.Property(e => e.CenaZkartyTow).HasColumnName("CenaZKartyTow");
entity.Property(e => e.Ilosc).HasColumnType("decimal(15, 4)");
entity.HasOne(d => d.SkWz)
.WithMany(p => p.TowarSkladnikas)
.HasForeignKey(d => d.SkWzId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_TOWARSKLADNIKA_REFERENCE_SKLADNIKWZORCA");
entity.HasOne(d => d.Tow)
.WithMany(p => p.TowarSkladnikas)
.HasForeignKey(d => d.TowId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_TOWARSKLADNIKA_REFERENCE_TOWAR");
});
modelBuilder.Entity<TypO>(entity =>
{
entity.HasKey(e => e.TypOsId)
.HasName("PK_TYPOS");
entity.HasIndex(e => e.Zmiana, "idx_TYPOS_ZMIANA");
entity.Property(e => e.TypOsId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrTypOsId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Komentarz)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<Uprawnienie>(entity =>
{
entity.HasKey(e => new { e.UzId, e.Rodzaj })
.HasName("PK_UPRAWNIENIE");
entity.ToTable("Uprawnienie");
entity.Property(e => e.UzId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Uz)
.WithMany(p => p.Uprawnienies)
.HasForeignKey(d => d.UzId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_UPRAWNIE_REF_UZUPR_UZYTKOWN");
});
modelBuilder.Entity<UprawnienieNaSklep>(entity =>
{
entity.HasKey(e => new { e.UzNsid, e.Rodzaj })
.HasName("PK_UPRAWNIENIENASKLEP");
entity.ToTable("UprawnienieNaSklep");
entity.Property(e => e.UzNsid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("UzNSId");
entity.HasOne(d => d.UzNs)
.WithMany(p => p.UprawnienieNaSkleps)
.HasForeignKey(d => d.UzNsid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("Ref_UprNaSklepUzNaSklep");
});
modelBuilder.Entity<UzNaSklep>(entity =>
{
entity.HasKey(e => e.UzNsid)
.HasName("PK_UZNASKLEP");
entity.ToTable("UzNaSklep");
entity.HasIndex(e => e.Identyfikator, "idx_UzNaSklelp_Ident");
entity.HasIndex(e => new { e.SklepId, e.SklepUzId }, "idx_UzNaSklelp_SIdSUzId");
entity.Property(e => e.UzNsid)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd()
.HasColumnName("UzNSId");
entity.Property(e => e.Haslo)
.IsRequired()
.HasMaxLength(50)
.IsUnicode(false);
entity.Property(e => e.HasloPrepaid)
.HasMaxLength(50)
.IsUnicode(false);
entity.Property(e => e.IdentPrePaid)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Identyfikator)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Jezyk)
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.KodKasjera)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Nazwisko)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepUzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.WymusZmianeHasla).HasColumnType("datetime");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Sklep)
.WithMany(p => p.UzNaSkleps)
.HasForeignKey(d => d.SklepId)
.HasConstraintName("Ref_UzNaSklepSklep");
entity.HasOne(d => d.SklepNavigation)
.WithMany(p => p.UzNaSkleps)
.HasForeignKey(d => new { d.SklepId, d.SklepUzId })
.HasConstraintName("Ref_UzNaSklepSklepUz");
});
modelBuilder.Entity<Uzytkownik>(entity =>
{
entity.HasKey(e => e.UzId)
.HasName("PK_UZYTKOWNIK");
entity.ToTable("Uzytkownik");
entity.HasIndex(e => e.CentrUzId, "idx_CentrUzId");
entity.Property(e => e.UzId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrUzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.CentrUzNsid)
.HasColumnType("numeric(9, 0)")
.HasColumnName("CentrUzNSId");
entity.Property(e => e.Haslo)
.IsRequired()
.HasMaxLength(50)
.IsUnicode(false);
entity.Property(e => e.HasloPrepaid)
.HasMaxLength(100)
.IsUnicode(false);
entity.Property(e => e.IdentPrepaid)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Identyfikator)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Jezyk)
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.KodKasjera)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Nazwisko)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.OstZmianaHasla).HasColumnType("datetime");
entity.Property(e => e.ProfilId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.WymusZmianeHasla).HasColumnType("datetime");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Profil)
.WithMany(p => p.Uzytkowniks)
.HasForeignKey(d => d.ProfilId)
.HasConstraintName("FK_UZYTKOWINK_REFERENCE_PROFIL");
});
modelBuilder.Entity<Vat>(entity =>
{
entity.HasKey(e => e.Stawka)
.HasName("PK_VAT");
entity.ToTable("Vat");
entity.Property(e => e.Stawka).ValueGeneratedNever();
});
modelBuilder.Entity<Walutum>(entity =>
{
entity.HasKey(e => e.WalId)
.HasName("PK_WALUTA");
entity.HasIndex(e => e.CentrWalId, "idx_CentrWalId");
entity.Property(e => e.WalId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrWalId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kod)
.IsRequired()
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
entity.Property(e => e.KursZak).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Skrot1)
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.Skrot100)
.HasMaxLength(10)
.IsUnicode(false);
entity.Property(e => e.Spread).HasColumnType("decimal(15, 4)");
entity.Property(e => e.SpreadZak).HasColumnType("decimal(15, 4)");
});
modelBuilder.Entity<Wersja72>(entity =>
{
entity.HasKey(e => e.Upgrade)
.HasName("PK_WERSJA_7_2");
entity.ToTable("Wersja_7_2");
entity.Property(e => e.Upgrade).ValueGeneratedNever();
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
});
modelBuilder.Entity<Wzorzec>(entity =>
{
entity.HasKey(e => e.WzId)
.HasName("PK_WZORZEC");
entity.ToTable("Wzorzec");
entity.HasIndex(e => e.CentrWzId, "idx_CentrWzId");
entity.Property(e => e.WzId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrWzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Opis)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Param1).HasColumnType("decimal(10, 4)");
entity.Property(e => e.Param2).HasColumnType("decimal(10, 4)");
});
modelBuilder.Entity<Zaleznosc>(entity =>
{
entity.HasKey(e => e.DokId)
.HasName("PK_ZALEZNOSC");
entity.ToTable("Zaleznosc");
entity.HasIndex(e => e.PoprzedniDokId, "idx_PoprzedniDokId");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.PoprzedniDokId).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Dok)
.WithOne(p => p.ZaleznoscDok)
.HasForeignKey<Zaleznosc>(d => d.DokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ZALEZNOS_REF_ODDOK_DOK");
entity.HasOne(d => d.PoprzedniDok)
.WithMany(p => p.ZaleznoscPoprzedniDoks)
.HasForeignKey(d => d.PoprzedniDokId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ZALEZNOS_REF_DODOK_DOK");
});
modelBuilder.Entity<Zasob>(entity =>
{
entity.HasKey(e => new { e.Tabela, e.Id, e.Typ })
.HasName("PK_ZASOB");
entity.ToTable("Zasob");
entity.Property(e => e.Id).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Typ)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.Sciezka)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
});
modelBuilder.Entity<ZdarzLoj>(entity =>
{
entity.ToTable("ZdarzLoj");
entity.HasIndex(e => e.Cecha, "IxZdarzLoj_Cecha");
entity.HasIndex(e => e.DataCzas, "IxZdarzLoj_DataCzas");
entity.HasIndex(e => e.KodKarty, "IxZdarzLoj_KodKarty");
entity.HasIndex(e => e.KontoId, "IxZdarzLoj_KontoId");
entity.Property(e => e.ZdarzLojId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.Cecha)
.HasMaxLength(64)
.IsUnicode(false);
entity.Property(e => e.DataCzas).HasColumnType("datetime");
entity.Property(e => e.DataCzasZapisu).HasColumnType("datetime");
entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KartaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.KodKarty)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.KontoId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kwota).HasColumnType("decimal(15, 4)");
entity.Property(e => e.Opis)
.HasMaxLength(64)
.IsUnicode(false);
entity.Property(e => e.PosNo)
.HasMaxLength(32)
.IsUnicode(false);
entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ShopNo)
.HasMaxLength(32)
.IsUnicode(false);
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.StanPo).HasColumnType("decimal(15, 4)");
entity.Property(e => e.StanPrzed).HasColumnType("decimal(15, 4)");
entity.Property(e => e.TransUuid)
.HasMaxLength(64)
.IsUnicode(false)
.HasColumnName("TransUUID");
entity.HasOne(d => d.Karta)
.WithMany(p => p.ZdarzLojs)
.HasForeignKey(d => d.KartaId)
.HasConstraintName("Ref_ZdarzKarta");
entity.HasOne(d => d.Konto)
.WithMany(p => p.ZdarzLojs)
.HasForeignKey(d => d.KontoId)
.HasConstraintName("Ref_ZdarzKonto");
});
modelBuilder.Entity<ZdarzO>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.Kiedy })
.HasName("PK_ZDARZOS");
entity.HasIndex(e => new { e.UzId, e.Kiedy }, "idx_ZDOSUZKIEDY");
entity.HasIndex(e => new { e.KontrId, e.ZgId, e.DataDec }, "idx_ZDOS_OSTDEC");
entity.HasIndex(e => new { e.KontrId, e.ZgId, e.Kiedy }, "idx_ZDOS_OSTZGODA");
entity.HasIndex(e => e.TypOsId, "idx_ZDOS_TPOS");
entity.HasIndex(e => e.ZgId, "idx_ZDOS_ZG");
entity.HasIndex(e => e.Zmiana, "idx_ZDOS_ZMIANA");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kiedy)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.DataDec).HasColumnType("datetime");
entity.Property(e => e.DodPar)
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.TypOsId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.UzId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Wersja)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.ZgId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Kontr)
.WithMany(p => p.ZdarzOs)
.HasForeignKey(d => d.KontrId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ZDOS_KTH");
entity.HasOne(d => d.TypOs)
.WithMany(p => p.ZdarzOs)
.HasForeignKey(d => d.TypOsId)
.HasConstraintName("FK_ZDOS_TPOS");
entity.HasOne(d => d.Uz)
.WithMany(p => p.ZdarzOs)
.HasForeignKey(d => d.UzId)
.HasConstraintName("FK_ZDOSUZ");
entity.HasOne(d => d.Zg)
.WithMany(p => p.ZdarzOs)
.HasForeignKey(d => d.ZgId)
.HasConstraintName("FK_ZDOS_ZG");
});
modelBuilder.Entity<ZdarzOsOpi>(entity =>
{
entity.HasKey(e => new { e.KontrId, e.Kiedy, e.Znaczenie })
.HasName("PK_ZDARZOSOPIS");
entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Kiedy)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.K)
.WithMany(p => p.ZdarzOsOpis)
.HasForeignKey(d => new { d.KontrId, d.Kiedy })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ZDOSOPIS");
});
modelBuilder.Entity<Zgodum>(entity =>
{
entity.HasKey(e => e.ZgId)
.HasName("PK_ZGODA");
entity.HasIndex(e => e.Zmiana, "idx_ZG_ZMIANA");
entity.Property(e => e.ZgId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.CentrZgId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.DaneOs)
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Komentarz)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Nazwa)
.IsRequired()
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.Wersja)
.HasMaxLength(20)
.IsUnicode(false);
entity.Property(e => e.Zastosowania)
.HasMaxLength(120)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
});
modelBuilder.Entity<ZlecKomunikat>(entity =>
{
entity.HasKey(e => new { e.KasaId, e.ZlecId, e.Kolejnosc })
.HasName("PK_ZLECKOMUNIKAT");
entity.ToTable("ZlecKomunikat");
entity.Property(e => e.KasaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ZlecId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Zlecenie)
.WithMany(p => p.ZlecKomunikats)
.HasForeignKey(d => new { d.KasaId, d.ZlecId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ZLECKOMU_REF_ZLECK_ZLECENIE");
});
modelBuilder.Entity<ZlecParam>(entity =>
{
entity.HasKey(e => new { e.KasaId, e.ZlecId, e.ParNazwa })
.HasName("PK_ZLECPARAM");
entity.ToTable("ZlecParam");
entity.Property(e => e.KasaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ZlecId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ParNazwa)
.HasMaxLength(40)
.IsUnicode(false);
entity.Property(e => e.ParWartosc)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.Zlecenie)
.WithMany(p => p.ZlecParams)
.HasForeignKey(d => new { d.KasaId, d.ZlecId })
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ZLECPARA_REF_ZLECP_ZLECENIE");
});
modelBuilder.Entity<Zlecenie>(entity =>
{
entity.HasKey(e => new { e.KasaId, e.ZlecId })
.HasName("PK_ZLECENIE");
entity.ToTable("Zlecenie");
entity.Property(e => e.KasaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.ZlecId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.NazwaDod)
.HasMaxLength(60)
.IsUnicode(false);
entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Utworzono).HasColumnType("datetime");
entity.Property(e => e.Wstrzymanie)
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.Zmiana).HasColumnType("datetime");
entity.HasOne(d => d.Kasa)
.WithMany(p => p.Zlecenies)
.HasForeignKey(d => d.KasaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ZLECENIE_REF_ZLECK_KASA");
});
modelBuilder.Entity<Zmiana>(entity =>
{
entity.HasKey(e => e.ZmId)
.HasName("PK_ZMIANA");
entity.ToTable("Zmiana");
entity.HasIndex(e => new { e.SklepId, e.TabId, e.Czas }, "idx_ZmSkTabIdCzas");
entity.HasIndex(e => new { e.TabId, e.Czas }, "idx_ZmTabIdCzas");
entity.HasIndex(e => e.SesjaId, "idx_ZmianaSesjaId");
entity.Property(e => e.ZmId)
.HasColumnType("numeric(9, 0)")
.ValueGeneratedOnAdd();
entity.Property(e => e.Czas).HasColumnType("datetime");
entity.Property(e => e.SesjaId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.TabId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Tekst)
.IsRequired()
.HasMaxLength(40)
.IsUnicode(false);
entity.HasOne(d => d.Sesja)
.WithMany(p => p.Zmianas)
.HasForeignKey(d => d.SesjaId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ZMIANA_REF_SESJA_SESJA");
});
modelBuilder.Entity<ZmianaTabeli>(entity =>
{
entity.HasKey(e => new { e.ZmId, e.Id })
.HasName("PK_ZMIANATABELI");
entity.ToTable("ZmianaTabeli");
entity.Property(e => e.ZmId).HasColumnType("numeric(9, 0)");
entity.Property(e => e.Id).HasColumnType("numeric(9, 0)");
entity.HasOne(d => d.Zm)
.WithMany(p => p.ZmianaTabelis)
.HasForeignKey(d => d.ZmId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ZMIANATA_REF_ZMTAB_ZMIANA");
});
}
}