using DuSoft.PcmDb.Entities;
using Microsoft.EntityFrameworkCore;

namespace DuSoft.PcmDb;

public partial class PcmDbContext : DbContext
{
    public PcmDbContext()
    {
    }

    public PcmDbContext(DbContextOptions<PcmDbContext> options)
        : base(options)
    {
    }

    public virtual DbSet<Akwizytor> Akwizytor { get; set; }

    public virtual DbSet<Artykul> Artykul { get; set; }

    public virtual DbSet<Asort> Asort { get; set; }

    public virtual DbSet<Bank> Bank { get; set; }

    public virtual DbSet<Blokada> Blokada { get; set; }

    public virtual DbSet<CentrStanZgody> CentrStanZgody { get; set; }

    public virtual DbSet<Czas> Czas { get; set; }

    public virtual DbSet<DefinicjaKodu> DefinicjaKodu { get; set; }

    public virtual DbSet<DlugiZasob> DlugiZasob { get; set; }

    public virtual DbSet<DlugiZasobBin> DlugiZasobBin { get; set; }

    public virtual DbSet<DlugiZasobTxt> DlugiZasobTxt { get; set; }

    public virtual DbSet<Dok> Dok { get; set; }

    public virtual DbSet<DokDodKth> DokDodKth { get; set; }

    public virtual DbSet<DokKasa> DokKasa { get; set; }

    public virtual DbSet<DokKontr> DokKontr { get; set; }

    public virtual DbSet<DokKurs> DokKurs { get; set; }

    public virtual DbSet<DokPunkty> DokPunkty { get; set; }

    public virtual DbSet<DokWBufPowiazanie> DokWBufPowiazanie { get; set; }

    public virtual DbSet<DokWaluta> DokWaluta { get; set; }

    public virtual DbSet<DostProd> DostProd { get; set; }

    public virtual DbSet<Dostawca> Dostawca { get; set; }

    public virtual DbSet<DzienRozl> DzienRozl { get; set; }

    public virtual DbSet<DzienRozlParam> DzienRozlParam { get; set; }

    public virtual DbSet<Email> Email { get; set; }

    public virtual DbSet<FormZgod> FormZgod { get; set; }

    public virtual DbSet<FormaPlatnPos7> FormaPlatnPos7 { get; set; }

    public virtual DbSet<FormaPlatnosci> FormaPlatnosci { get; set; }

    public virtual DbSet<GrWartosc> GrWartosc { get; set; }

    public virtual DbSet<GrupaAkcyzowa> GrupaAkcyzowa { get; set; }

    public virtual DbSet<GrupaPromocji> GrupaPromocji { get; set; }

    public virtual DbSet<GrupaTow> GrupaTow { get; set; }

    public virtual DbSet<GrupaUz> GrupaUz { get; set; }

    public virtual DbSet<HarmCeny> HarmCeny { get; set; }

    public virtual DbSet<HarmCykl> HarmCykl { get; set; }

    public virtual DbSet<HarmHarm> HarmHarm { get; set; }

    public virtual DbSet<HarmRap> HarmRap { get; set; }

    public virtual DbSet<HarmRapCykl> HarmRapCykl { get; set; }

    public virtual DbSet<HarmRapParam> HarmRapParam { get; set; }

    public virtual DbSet<HarmRapZlecenie> HarmRapZlecenie { get; set; }

    public virtual DbSet<HarmWpis> HarmWpis { get; set; }

    public virtual DbSet<Istw> Istw { get; set; }

    public virtual DbSet<JM> JM { get; set; }

    public virtual DbSet<KartaLoj> KartaLoj { get; set; }

    public virtual DbSet<KasKod> KasKod { get; set; }

    public virtual DbSet<KasPar> KasPar { get; set; }

    public virtual DbSet<KasTow> KasTow { get; set; }

    public virtual DbSet<Kasa> Kasa { get; set; }

    public virtual DbSet<KasaFormaPlatn> KasaFormaPlatn { get; set; }

    public virtual DbSet<KatParam> KatParam { get; set; }

    public virtual DbSet<Kategoria> Kategoria { get; set; }

    public virtual DbSet<KodDod> KodDod { get; set; }

    public virtual DbSet<KodWazony> KodWazony { get; set; }

    public virtual DbSet<Komentarz> Komentarz { get; set; }

    public virtual DbSet<Konfig> Konfig { get; set; }

    public virtual DbSet<KontoBankowe> KontoBankowe { get; set; }

    public virtual DbSet<KontoBankoweKontr> KontoBankoweKontr { get; set; }

    public virtual DbSet<KontoLoj> KontoLoj { get; set; }

    public virtual DbSet<KontrOpis> KontrOpis { get; set; }

    public virtual DbSet<Kontrahent> Kontrahent { get; set; }

    public virtual DbSet<Kraj> Kraj { get; set; }

    public virtual DbSet<KrajStawka> KrajStawka { get; set; }

    public virtual DbSet<KthParWartosc> KthParWartosc { get; set; }

    public virtual DbSet<KthParam> KthParam { get; set; }

    public virtual DbSet<KursWaluty> KursWaluty { get; set; }

    public virtual DbSet<LiniaLotnicza> LiniaLotnicza { get; set; }

    public virtual DbSet<LogOperation> LogOperation { get; set; }

    public virtual DbSet<LogTypeDef> LogTypeDef { get; set; }

    public virtual DbSet<LogValChangeNum> LogValChangeNum { get; set; }

    public virtual DbSet<LogValChangeTxt> LogValChangeTxt { get; set; }

    public virtual DbSet<Lotnisko> Lotnisko { get; set; }

    public virtual DbSet<Magazyn> Magazyn { get; set; }

    public virtual DbSet<MarZakres> MarZakres { get; set; }

    public virtual DbSet<Marzownik> Marzownik { get; set; }

    public virtual DbSet<Miasto> Miasto { get; set; }

    public virtual DbSet<Notatki> Notatki { get; set; }

    public virtual DbSet<NrRej> NrRej { get; set; }

    public virtual DbSet<NumDok> NumDok { get; set; }

    public virtual DbSet<NumMag> NumMag { get; set; }

    public virtual DbSet<OdbProd> OdbProd { get; set; }

    public virtual DbSet<Odbiorca> Odbiorca { get; set; }

    public virtual DbSet<OfKod> OfKod { get; set; }

    public virtual DbSet<OfSlownik> OfSlownik { get; set; }

    public virtual DbSet<Oferta> Oferta { get; set; }

    public virtual DbSet<OpisZdarzLoj> OpisZdarzLoj { get; set; }

    public virtual DbSet<Oplata> Oplata { get; set; }

    public virtual DbSet<Osoba> Osoba { get; set; }

    public virtual DbSet<PH> PH { get; set; }

    public virtual DbSet<PHDane> PHDane { get; set; }

    public virtual DbSet<PHOdbDane> PHOdbDane { get; set; }

    public virtual DbSet<PHOdbiorca> PHOdbiorca { get; set; }

    public virtual DbSet<PHRozliczenie> PHRozliczenie { get; set; }

    public virtual DbSet<Panel> Panel { get; set; }

    public virtual DbSet<PanelParam> PanelParam { get; set; }

    public virtual DbSet<ParBon> ParBon { get; set; }

    public virtual DbSet<ParPunkty> ParPunkty { get; set; }

    public virtual DbSet<ParWaluta> ParWaluta { get; set; }

    public virtual DbSet<ParWartosc> ParWartosc { get; set; }

    public virtual DbSet<ParWiseBase> ParWiseBase { get; set; }

    public virtual DbSet<Paragon> Paragon { get; set; }

    public virtual DbSet<Parametr> Parametr { get; set; }

    public virtual DbSet<Partia> Partia { get; set; }

    public virtual DbSet<PcfUser> PcfUser { get; set; }

    public virtual DbSet<PcfUserSklep> PcfUserSklep { get; set; }

    public virtual DbSet<PcpPos> PcpPos { get; set; }

    public virtual DbSet<PcpReceipt> PcpReceipt { get; set; }

    public virtual DbSet<PcpReceiptItem> PcpReceiptItem { get; set; }

    public virtual DbSet<PcpReceiptPayment> PcpReceiptPayment { get; set; }

    public virtual DbSet<PcpReceiptVat> PcpReceiptVat { get; set; }

    public virtual DbSet<PcpShop> PcpShop { get; set; }

    public virtual DbSet<PolParam> PolParam { get; set; }

    public virtual DbSet<Polityka> Polityka { get; set; }

    public virtual DbSet<PowKontLoj> PowKontLoj { get; set; }

    public virtual DbSet<Powiadomienie> Powiadomienie { get; set; }

    public virtual DbSet<PowiadomienieParam> PowiadomienieParam { get; set; }

    public virtual DbSet<Powiazanie> Powiazanie { get; set; }

    public virtual DbSet<PowiazanieProm> PowiazanieProm { get; set; }

    public virtual DbSet<PowiazanieSklep> PowiazanieSklep { get; set; }

    public virtual DbSet<PowiazanieUz> PowiazanieUz { get; set; }

    public virtual DbSet<PowiazanieUzNaSklep> PowiazanieUzNaSklep { get; set; }

    public virtual DbSet<PozAkcyza> PozAkcyza { get; set; }

    public virtual DbSet<PozCennikDok> PozCennikDok { get; set; }

    public virtual DbSet<PozDok> PozDok { get; set; }

    public virtual DbSet<PozDokWBufPowiazanie> PozDokWBufPowiazanie { get; set; }

    public virtual DbSet<PozPar> PozPar { get; set; }

    public virtual DbSet<PozParSzczeg> PozParSzczeg { get; set; }

    public virtual DbSet<PozWz> PozWz { get; set; }

    public virtual DbSet<Profil> Profil { get; set; }

    public virtual DbSet<ProfilKasa> ProfilKasa { get; set; }

    public virtual DbSet<ProfilKonfig> ProfilKonfig { get; set; }

    public virtual DbSet<PrtMag> PrtMag { get; set; }

    public virtual DbSet<RapWartPocz> RapWartPocz { get; set; }

    public virtual DbSet<RapWartPoczDane> RapWartPoczDane { get; set; }

    public virtual DbSet<Regula> Regula { get; set; }

    public virtual DbSet<RegulaAsort> RegulaAsort { get; set; }

    public virtual DbSet<RegulaDok> RegulaDok { get; set; }

    public virtual DbSet<RegulaDokSzczeg> RegulaDokSzczeg { get; set; }

    public virtual DbSet<RegulaKod> RegulaKod { get; set; }

    public virtual DbSet<RegulaPar> RegulaPar { get; set; }

    public virtual DbSet<RegulaParSzczeg> RegulaParSzczeg { get; set; }

    public virtual DbSet<RegulaParam> RegulaParam { get; set; }

    public virtual DbSet<RegulaPozDok> RegulaPozDok { get; set; }

    public virtual DbSet<RegulaPozDokSzczeg> RegulaPozDokSzczeg { get; set; }

    public virtual DbSet<RegulaPozPar> RegulaPozPar { get; set; }

    public virtual DbSet<RegulaPozParSzczeg> RegulaPozParSzczeg { get; set; }

    public virtual DbSet<RegulaProg> RegulaProg { get; set; }

    public virtual DbSet<RegulaSklep> RegulaSklep { get; set; }

    public virtual DbSet<RegulaSklepAuth> RegulaSklepAuth { get; set; }

    public virtual DbSet<RegulaTekst> RegulaTekst { get; set; }

    public virtual DbSet<RegulaTowar> RegulaTowar { get; set; }

    public virtual DbSet<Rola> Rola { get; set; }

    public virtual DbSet<RolaUprawnienie> RolaUprawnienie { get; set; }

    public virtual DbSet<RozPrtMag> RozPrtMag { get; set; }

    public virtual DbSet<RozbicieDodDok> RozbicieDodDok { get; set; }

    public virtual DbSet<RozbicieDok> RozbicieDok { get; set; }

    public virtual DbSet<Rozlicza> Rozlicza { get; set; }

    public virtual DbSet<RozliczeniePartii> RozliczeniePartii { get; set; }

    public virtual DbSet<Sesja> Sesja { get; set; }

    public virtual DbSet<SesjaAktywna> SesjaAktywna { get; set; }

    public virtual DbSet<SkladnikDefinicjiKodu> SkladnikDefinicjiKodu { get; set; }

    public virtual DbSet<SkladnikWzorca> SkladnikWzorca { get; set; }

    public virtual DbSet<Sklep> Sklep { get; set; }

    public virtual DbSet<SklepArtykul> SklepArtykul { get; set; }

    public virtual DbSet<SklepBank> SklepBank { get; set; }

    public virtual DbSet<SklepDefinicjaKodu> SklepDefinicjaKodu { get; set; }

    public virtual DbSet<SklepDlugiZasob> SklepDlugiZasob { get; set; }

    public virtual DbSet<SklepDok> SklepDok { get; set; }

    public virtual DbSet<SklepDokDodKth> SklepDokDodKth { get; set; }

    public virtual DbSet<SklepDokKurs> SklepDokKurs { get; set; }

    public virtual DbSet<SklepDokPunkty> SklepDokPunkty { get; set; }

    public virtual DbSet<SklepDokWaluta> SklepDokWaluta { get; set; }

    public virtual DbSet<SklepDost> SklepDost { get; set; }

    public virtual DbSet<SklepDzienRozl> SklepDzienRozl { get; set; }

    public virtual DbSet<SklepDzienRozlParam> SklepDzienRozlParam { get; set; }

    public virtual DbSet<SklepEmail> SklepEmail { get; set; }

    public virtual DbSet<SklepFlagi> SklepFlagi { get; set; }

    public virtual DbSet<SklepFormZgod> SklepFormZgod { get; set; }

    public virtual DbSet<SklepFormaPlatnPos7> SklepFormaPlatnPos7 { get; set; }

    public virtual DbSet<SklepGrupaAkcyzowa> SklepGrupaAkcyzowa { get; set; }

    public virtual DbSet<SklepGrupaPromocji> SklepGrupaPromocji { get; set; }

    public virtual DbSet<SklepGrupaUz> SklepGrupaUz { get; set; }

    public virtual DbSet<SklepIstw> SklepIstw { get; set; }

    public virtual DbSet<SklepKartaLoj> SklepKartaLoj { get; set; }

    public virtual DbSet<SklepKasa> SklepKasa { get; set; }

    public virtual DbSet<SklepKasaFormaPlatn> SklepKasaFormaPlatn { get; set; }

    public virtual DbSet<SklepKontoBankowe> SklepKontoBankowe { get; set; }

    public virtual DbSet<SklepKontoBankoweKontr> SklepKontoBankoweKontr { get; set; }

    public virtual DbSet<SklepKontoLoj> SklepKontoLoj { get; set; }

    public virtual DbSet<SklepKontr> SklepKontr { get; set; }

    public virtual DbSet<SklepKontrOpis> SklepKontrOpis { get; set; }

    public virtual DbSet<SklepKontrSklep> SklepKontrSklep { get; set; }

    public virtual DbSet<SklepKthTypOs> SklepKthTypOs { get; set; }

    public virtual DbSet<SklepMagazyn> SklepMagazyn { get; set; }

    public virtual DbSet<SklepNotatki> SklepNotatki { get; set; }

    public virtual DbSet<SklepNrRej> SklepNrRej { get; set; }

    public virtual DbSet<SklepNrRejKarta> SklepNrRejKarta { get; set; }

    public virtual DbSet<SklepOplata> SklepOplata { get; set; }

    public virtual DbSet<SklepPanel> SklepPanel { get; set; }

    public virtual DbSet<SklepPanelParam> SklepPanelParam { get; set; }

    public virtual DbSet<SklepParBon> SklepParBon { get; set; }

    public virtual DbSet<SklepParPunkty> SklepParPunkty { get; set; }

    public virtual DbSet<SklepParWaluta> SklepParWaluta { get; set; }

    public virtual DbSet<SklepParagon> SklepParagon { get; set; }

    public virtual DbSet<SklepPartia> SklepPartia { get; set; }

    public virtual DbSet<SklepPowKontLoj> SklepPowKontLoj { get; set; }

    public virtual DbSet<SklepPowiazanieProm> SklepPowiazanieProm { get; set; }

    public virtual DbSet<SklepPowiazanieUz> SklepPowiazanieUz { get; set; }

    public virtual DbSet<SklepPozAkcyza> SklepPozAkcyza { get; set; }

    public virtual DbSet<SklepPozDok> SklepPozDok { get; set; }

    public virtual DbSet<SklepPozPar> SklepPozPar { get; set; }

    public virtual DbSet<SklepPozParSzczeg> SklepPozParSzczeg { get; set; }

    public virtual DbSet<SklepProfil> SklepProfil { get; set; }

    public virtual DbSet<SklepProfilKonfig> SklepProfilKonfig { get; set; }

    public virtual DbSet<SklepPrtMag> SklepPrtMag { get; set; }

    public virtual DbSet<SklepRapWartPocz> SklepRapWartPocz { get; set; }

    public virtual DbSet<SklepRapWartPoczDane> SklepRapWartPoczDane { get; set; }

    public virtual DbSet<SklepRegula> SklepRegula { get; set; }

    public virtual DbSet<SklepRegulaAsort> SklepRegulaAsort { get; set; }

    public virtual DbSet<SklepRegulaDok> SklepRegulaDok { get; set; }

    public virtual DbSet<SklepRegulaDokSzczeg> SklepRegulaDokSzczeg { get; set; }

    public virtual DbSet<SklepRegulaKod> SklepRegulaKod { get; set; }

    public virtual DbSet<SklepRegulaPar> SklepRegulaPar { get; set; }

    public virtual DbSet<SklepRegulaParSzczeg> SklepRegulaParSzczeg { get; set; }

    public virtual DbSet<SklepRegulaParam> SklepRegulaParam { get; set; }

    public virtual DbSet<SklepRegulaPozDok> SklepRegulaPozDok { get; set; }

    public virtual DbSet<SklepRegulaPozDokSzczeg> SklepRegulaPozDokSzczeg { get; set; }

    public virtual DbSet<SklepRegulaPozPar> SklepRegulaPozPar { get; set; }

    public virtual DbSet<SklepRegulaPozParSzczeg> SklepRegulaPozParSzczeg { get; set; }

    public virtual DbSet<SklepRegulaTekst> SklepRegulaTekst { get; set; }

    public virtual DbSet<SklepRegulaTowar> SklepRegulaTowar { get; set; }

    public virtual DbSet<SklepRola> SklepRola { get; set; }

    public virtual DbSet<SklepRolaUprawnienie> SklepRolaUprawnienie { get; set; }

    public virtual DbSet<SklepRozPrtMag> SklepRozPrtMag { get; set; }

    public virtual DbSet<SklepRozbicieDodDok> SklepRozbicieDodDok { get; set; }

    public virtual DbSet<SklepRozbicieDok> SklepRozbicieDok { get; set; }

    public virtual DbSet<SklepRozlPartii> SklepRozlPartii { get; set; }

    public virtual DbSet<SklepRozlicza> SklepRozlicza { get; set; }

    public virtual DbSet<SklepSkladnikDefinicjiKodu> SklepSkladnikDefinicjiKodu { get; set; }

    public virtual DbSet<SklepSkladnikWzorca> SklepSkladnikWzorca { get; set; }

    public virtual DbSet<SklepStanPrtMag> SklepStanPrtMag { get; set; }

    public virtual DbSet<SklepSzczegPrtMag> SklepSzczegPrtMag { get; set; }

    public virtual DbSet<SklepTekstDok> SklepTekstDok { get; set; }

    public virtual DbSet<SklepTekstPoz> SklepTekstPoz { get; set; }

    public virtual DbSet<SklepTekstZgody> SklepTekstZgody { get; set; }

    public virtual DbSet<SklepTowAkcyza> SklepTowAkcyza { get; set; }

    public virtual DbSet<SklepTowDodatek> SklepTowDodatek { get; set; }

    public virtual DbSet<SklepTowIntParam> SklepTowIntParam { get; set; }

    public virtual DbSet<SklepTowKod> SklepTowKod { get; set; }

    public virtual DbSet<SklepTowParWiseBase> SklepTowParWiseBase { get; set; }

    public virtual DbSet<SklepTowPowiazanie> SklepTowPowiazanie { get; set; }

    public virtual DbSet<SklepTowStraty> SklepTowStraty { get; set; }

    public virtual DbSet<SklepTowZamiennik> SklepTowZamiennik { get; set; }

    public virtual DbSet<SklepTowZdjecia> SklepTowZdjecia { get; set; }

    public virtual DbSet<SklepTowar> SklepTowar { get; set; }

    public virtual DbSet<SklepTowarSkladnika> SklepTowarSkladnika { get; set; }

    public virtual DbSet<SklepTrescEmail> SklepTrescEmail { get; set; }

    public virtual DbSet<SklepTrescEmailTekst> SklepTrescEmailTekst { get; set; }

    public virtual DbSet<SklepTypOs> SklepTypOs { get; set; }

    public virtual DbSet<SklepUprawnienie> SklepUprawnienie { get; set; }

    public virtual DbSet<SklepUzytkownik> SklepUzytkownik { get; set; }

    public virtual DbSet<SklepWaluta> SklepWaluta { get; set; }

    public virtual DbSet<SklepZaleznosc> SklepZaleznosc { get; set; }

    public virtual DbSet<SklepZamiennik> SklepZamiennik { get; set; }

    public virtual DbSet<SklepZasob> SklepZasob { get; set; }

    public virtual DbSet<SklepZdarzOs> SklepZdarzOs { get; set; }

    public virtual DbSet<SklepZdarzOsOpis> SklepZdarzOsOpis { get; set; }

    public virtual DbSet<SklepZgoda> SklepZgoda { get; set; }

    public virtual DbSet<Sprzedaz> Sprzedaz { get; set; }

    public virtual DbSet<StanPrtMag> StanPrtMag { get; set; }

    public virtual DbSet<StanZgody> StanZgody { get; set; }

    public virtual DbSet<Struktura_7_3> Struktura_7_3 { get; set; }

    public virtual DbSet<Subsys> Subsys { get; set; }

    public virtual DbSet<SzczegPrtMag> SzczegPrtMag { get; set; }

    public virtual DbSet<TabelaAkcyzowa> TabelaAkcyzowa { get; set; }

    public virtual DbSet<TekstDok> TekstDok { get; set; }

    public virtual DbSet<TekstPoz> TekstPoz { get; set; }

    public virtual DbSet<TekstZgody> TekstZgody { get; set; }

    public virtual DbSet<TowAkcyza> TowAkcyza { get; set; }

    public virtual DbSet<TowDodatek> TowDodatek { get; set; }

    public virtual DbSet<TowIntParam> TowIntParam { get; set; }

    public virtual DbSet<TowKraj> TowKraj { get; set; }

    public virtual DbSet<TowParWiseBase> TowParWiseBase { get; set; }

    public virtual DbSet<TowPowiazanie> TowPowiazanie { get; set; }

    public virtual DbSet<TowStraty> TowStraty { get; set; }

    public virtual DbSet<TowStratyDlaSklepu> TowStratyDlaSklepu { get; set; }

    public virtual DbSet<TowWartosc> TowWartosc { get; set; }

    public virtual DbSet<TowZamiennik> TowZamiennik { get; set; }

    public virtual DbSet<TowZdjecia> TowZdjecia { get; set; }

    public virtual DbSet<Towar> Towar { get; set; }

    public virtual DbSet<TowarSkladnika> TowarSkladnika { get; set; }

    public virtual DbSet<TrescEmail> TrescEmail { get; set; }

    public virtual DbSet<TrescEmailTekst> TrescEmailTekst { get; set; }

    public virtual DbSet<TypOs> TypOs { get; set; }

    public virtual DbSet<Ulica> Ulica { get; set; }

    public virtual DbSet<Uprawnienie> Uprawnienie { get; set; }

    public virtual DbSet<UprawnienieNaSklep> UprawnienieNaSklep { get; set; }

    public virtual DbSet<UzNaSklep> UzNaSklep { get; set; }

    public virtual DbSet<Uzytkownik> Uzytkownik { get; set; }

    public virtual DbSet<Vat> Vat { get; set; }

    public virtual DbSet<Waluta> Waluta { get; set; }

    public virtual DbSet<Wersja_7_2> Wersja_7_2 { get; set; }

    public virtual DbSet<Wzorzec> Wzorzec { get; set; }

    public virtual DbSet<Zaleznosc> Zaleznosc { get; set; }

    public virtual DbSet<Zamiennik> Zamiennik { get; set; }

    public virtual DbSet<Zasob> Zasob { get; set; }

    public virtual DbSet<ZdarzLoj> ZdarzLoj { get; set; }

    public virtual DbSet<ZdarzOs> ZdarzOs { get; set; }

    public virtual DbSet<ZdarzOsOpis> ZdarzOsOpis { get; set; }

    public virtual DbSet<Zgoda> Zgoda { get; set; }

    public virtual DbSet<ZlecKomunikat> ZlecKomunikat { get; set; }

    public virtual DbSet<ZlecParam> ZlecParam { get; set; }

    public virtual DbSet<Zlecenie> Zlecenie { get; set; }

    public virtual DbSet<Zmiana> Zmiana { get; set; }

    public virtual DbSet<ZmianaTabeli> ZmianaTabeli { get; set; }
    

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Akwizytor>(entity =>
        {
            entity.HasKey(e => e.AkwId).HasName("PK_AKWIZYTOR");

            entity.Property(e => e.AkwId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwisko)
                .HasMaxLength(60)
                .IsUnicode(false);
            entity.Property(e => e.Opis)
                .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.HasIndex(e => e.CentrArtId, "idx_CentrArtId");

            entity.Property(e => e.ArtId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ArtNazwa)
                .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.Artykul)
                .HasForeignKey(d => d.GlownyTowId)
                .HasConstraintName("FK_ARTGLOWNYTOWID");
        });

        modelBuilder.Entity<Asort>(entity =>
        {
            entity.HasKey(e => e.AsId).HasName("PK_ASORT");

            entity.HasIndex(e => e.CentrAsId, "idx_CentrAsId");

            entity.Property(e => e.AsId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            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)
                .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.Property(e => e.BankId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Adres)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.CentrBankId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.NrRozliBank)
                .HasMaxLength(8)
                .IsUnicode(false);
            entity.Property(e => e.SWIFT)
                .HasMaxLength(11)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");
        });

        modelBuilder.Entity<Blokada>(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.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)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Wersja)
                .HasMaxLength(20)
                .IsUnicode(false);

            entity.HasOne(d => d.Kontr).WithMany(p => p.CentrStanZgody)
                .HasForeignKey(d => d.KontrId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_CESTZG_KTH");

            entity.HasOne(d => d.Zg).WithMany(p => p.CentrStanZgody)
                .HasForeignKey(d => d.ZgId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_CESTZG_ZG");
        });

        modelBuilder.Entity<Czas>(entity =>
        {
            entity.HasKey(e => e.CzasID).HasName("PK_CZAS");

            entity.Property(e => e.CzasID).HasColumnType("numeric(9, 0)");
            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.Property(e => e.DKId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrDKId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.DataDo).HasColumnType("datetime");
            entity.Property(e => e.DataOd).HasColumnType("datetime");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");
        });

        modelBuilder.Entity<DlugiZasob>(entity =>
        {
            entity.HasKey(e => e.ZasobId);

            entity.HasIndex(e => e.CentrZasobId, "IxDlugiZasob_CentrZasobId");

            entity.HasIndex(e => e.GUID, "IxDlugiZasob_GUID");

            entity.HasIndex(e => e.Zmiana, "IxDlugiZasob_Zmiana");

            entity.Property(e => e.ZasobId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrWersja)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.CentrZasobId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.GUID)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Opcje)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Sciezka)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Skrot1)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Skrot2)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Skrot3)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Skrot4)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.TypDanych)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Wersja)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Zastosowanie)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");
        });

        modelBuilder.Entity<DlugiZasobBin>(entity =>
        {
            entity.HasKey(e => new { e.ZasobId, e.Porcja });

            entity.Property(e => e.ZasobId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.Zasob).WithMany(p => p.DlugiZasobBin)
                .HasForeignKey(d => d.ZasobId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_DlugiZasobBin_ZasobId");
        });

        modelBuilder.Entity<DlugiZasobTxt>(entity =>
        {
            entity.HasKey(e => new { e.ZasobId, e.Porcja });

            entity.Property(e => e.ZasobId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Dane).IsUnicode(false);

            entity.HasOne(d => d.Zasob).WithMany(p => p.DlugiZasobTxt)
                .HasForeignKey(d => d.ZasobId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_DlugiZasobTxt_ZasobId");
        });

        modelBuilder.Entity<Dok>(entity =>
        {
            entity.HasKey(e => e.DokId).HasName("PK_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)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            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.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)
                .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.WalIdPlatnosci).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)");
            entity.Property(e => e.Zmiana).HasColumnType("datetime");
            entity.Property(e => e.ZmianaPkt).HasColumnType("datetime");

            entity.HasOne(d => d.Mag).WithMany(p => p.Dok)
                .HasForeignKey(d => d.MagId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_DOK_REF_DOKMA_MAGAZYN");

            entity.HasOne(d => d.Uz).WithMany(p => p.Dok)
                .HasForeignKey(d => d.UzId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_DOK_REF_DOKUZ_UZYTKOWN");

            entity.HasOne(d => d.Wal).WithMany(p => p.DokWal)
                .HasForeignKey(d => d.WalId)
                .HasConstraintName("FK_DOK_REF_DOKWA_WALUTA");

            entity.HasOne(d => d.WalIdPlatnosciNavigation).WithMany(p => p.DokWalIdPlatnosciNavigation)
                .HasForeignKey(d => d.WalIdPlatnosci)
                .HasConstraintName("FK_Ref_DokWalIdPlatnosci");

            entity.HasMany(d => d.KB).WithMany(p => p.Dok)
                .UsingEntity<Dictionary<string, object>>(
                    "DokKontoBankowe",
                    r => r.HasOne<KontoBankowe>().WithMany()
                        .HasForeignKey("KBId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_DOKKONTOBANK_KONTOBANK"),
                    l => l.HasOne<Dok>().WithMany()
                        .HasForeignKey("DokId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_DOKKONTOBANK_DOK"),
                    j =>
                    {
                        j.HasKey("DokId", "KBId");
                        j.IndexerProperty<decimal>("DokId").HasColumnType("numeric(9, 0)");
                        j.IndexerProperty<decimal>("KBId").HasColumnType("numeric(9, 0)");
                    });
        });

        modelBuilder.Entity<DokDodKth>(entity =>
        {
            entity.HasKey(e => new { e.DokId, e.Znaczenie }).HasName("PK_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.Property(e => e.Kwota).HasColumnType("decimal(15, 4)");

            entity.HasOne(d => d.Dok).WithMany(p => p.DokDodKth)
                .HasForeignKey(d => d.DokId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_DOKDODKT_REF_DDK_DOK");

            entity.HasOne(d => d.Kontr).WithMany(p => p.DokDodKth)
                .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.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.DokKasa)
                .HasForeignKey(d => d.KasaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_DOKKASA_REF_KASA_KASA");
        });

        modelBuilder.Entity<DokKontr>(entity =>
        {
            entity.HasKey(e => e.DokId).HasName("PK_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.DokKontr)
                .HasForeignKey(d => d.KontrId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_DOKKONTR_REF_KONTR_KONTRAHE");
        });

        modelBuilder.Entity<DokKurs>(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.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.DokPunkty)
                .HasForeignKey(d => d.DokId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_DOKPUNKT_REF_DOKPK_DOK");
        });

        modelBuilder.Entity<DokWBufPowiazanie>(entity =>
        {
            entity.HasKey(e => new { e.DokId, e.JakiePow, e.KtorePow }).HasName("PK_DOKWBUFPOWIAZANIE");

            entity.HasIndex(e => e.Id, "idx_DokWBufId");

            entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Id).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Param)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Dok).WithMany(p => p.DokWBufPowiazanie)
                .HasForeignKey(d => d.DokId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_DokWBufPow");
        });

        modelBuilder.Entity<DokWaluta>(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.Property(e => e.WalNetto).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.WalNettoDet).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.WalPodatek).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.WalPodatekDet).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.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.DostProdDost)
                .HasForeignKey(d => d.DostId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_DostPrKth");

            entity.HasOne(d => d.Prod).WithMany(p => p.DostProdProd)
                .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.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.IleWZgrzewce).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Kod)
                .HasMaxLength(30)
                .IsUnicode(false);
            entity.Property(e => e.RabatOdWart).HasColumnType("decimal(10, 4)");

            entity.HasOne(d => d.Kontr).WithMany(p => p.DostawcaNavigation)
                .HasForeignKey(d => d.KontrId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_DOSTAWCA_REF_KTHDO_KONTRAHE");

            entity.HasOne(d => d.Tow).WithMany(p => p.Dostawca)
                .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.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.Property(e => e.Dzien).HasColumnType("datetime");
            entity.Property(e => e.Wartosc)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.DzienNavigation).WithMany(p => p.DzienRozlParam)
                .HasForeignKey(d => d.Dzien)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_DzienRozlPar");
        });

        modelBuilder.Entity<Email>(entity =>
        {
            entity.HasKey(e => e.EmId);

            entity.Property(e => e.EmId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Haslo)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Host)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.KopiaEmail)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Login)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Nadawca)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.Nazwa)
                .HasMaxLength(60)
                .IsUnicode(false);
            entity.Property(e => e.Port)
                .HasMaxLength(5)
                .IsUnicode(false);
            entity.Property(e => e.TEDId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.TEHRId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.TERId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.TEWId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.TEZIId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.UzId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.TED).WithMany(p => p.EmailTED)
                .HasForeignKey(d => d.TEDId)
                .HasConstraintName("FK_Email_TED");

            entity.HasOne(d => d.TER).WithMany(p => p.EmailTER)
                .HasForeignKey(d => d.TERId)
                .HasConstraintName("FK_Email_TER");

            entity.HasOne(d => d.TEW).WithMany(p => p.EmailTEW)
                .HasForeignKey(d => d.TEWId)
                .HasConstraintName("FK_Email_TEW");

            entity.HasOne(d => d.Uz).WithMany(p => p.Email)
                .HasForeignKey(d => d.UzId)
                .HasConstraintName("FK_Email_Uz");
        });

        modelBuilder.Entity<FormZgod>(entity =>
        {
            entity.HasKey(e => new { e.TypOsId, e.ZgId }).HasName("PK_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.FormZgod)
                .HasForeignKey(d => d.TypOsId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_FMZG_TYPOS");

            entity.HasOne(d => d.Zg).WithMany(p => p.FormZgod)
                .HasForeignKey(d => d.ZgId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_FMZG_ZGODA");
        });

        modelBuilder.Entity<FormaPlatnPos7>(entity =>
        {
            entity.HasKey(e => e.FormaId);

            entity.Property(e => e.FormaId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrFormaId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Kolejnosc).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .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.Property(e => e.FormaPlat).ValueGeneratedNever();
            entity.Property(e => e.Tekst)
                .HasMaxLength(40)
                .IsUnicode(false);
        });

        modelBuilder.Entity<GrWartosc>(entity =>
        {
            entity.HasKey(e => new { e.GrId, e.ParId, e.Wartosc }).HasName("PK_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.GrWartosc)
                .HasForeignKey(d => d.GrId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_GRWARTOS_REF_GRWAR_GRUPATOW");

            entity.HasOne(d => d.Par).WithMany(p => p.GrWartosc)
                .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.Property(e => e.GrAkcId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.AkcJM)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.CentrGrAkcId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.DodJM)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.IleDodJMWAkcJM).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Kod)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Nazwa)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.OpcjeWzoru)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Opis)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.PrefiksyCN)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");
        });

        modelBuilder.Entity<GrupaPromocji>(entity =>
        {
            entity.HasKey(e => e.GrupaId);

            entity.Property(e => e.GrupaId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrGrupaId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Opis)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");
        });

        modelBuilder.Entity<GrupaTow>(entity =>
        {
            entity.HasKey(e => e.GrId).HasName("PK_GRUPATOW");

            entity.Property(e => e.GrId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Opis)
                .HasMaxLength(255)
                .IsUnicode(false);
        });

        modelBuilder.Entity<GrupaUz>(entity =>
        {
            entity.HasKey(e => e.UzId).HasName("PK_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.GrupaUzRola)
                .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.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.Cena7).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Cena8).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.HarmCeny)
                .HasForeignKey(d => d.HarmId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_HARMCENY_REF_HARMC_HARMWPIS");

            entity.HasOne(d => d.Tow).WithMany(p => p.HarmCeny)
                .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.Property(e => e.HarmId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.Harm).WithMany(p => p.HarmCykl)
                .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.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.HarmHarmHarm)
                .HasForeignKey(d => d.HarmId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_HARMHARM");

            entity.HasOne(d => d.PoprzHarm).WithMany(p => p.HarmHarmPoprzHarm)
                .HasForeignKey(d => d.PoprzHarmId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_HARMPOPRZHARM");
        });

        modelBuilder.Entity<HarmRap>(entity =>
        {
            entity.HasKey(e => e.HRId);

            entity.Property(e => e.HRId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.DataDo).HasColumnType("datetime");
            entity.Property(e => e.DataOd).HasColumnType("datetime");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");
        });

        modelBuilder.Entity<HarmRapCykl>(entity =>
        {
            entity.HasKey(e => new { e.HRId, e.Dzien, e.Godzina, e.Minuta });

            entity.Property(e => e.HRId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.HR).WithMany(p => p.HarmRapCykl)
                .HasForeignKey(d => d.HRId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_HarmRapCykl_HRId");
        });

        modelBuilder.Entity<HarmRapParam>(entity =>
        {
            entity.HasKey(e => new { e.HRId, e.ParNazwa });

            entity.Property(e => e.HRId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ParNazwa)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.ParWartosc)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.HR).WithMany(p => p.HarmRapParam)
                .HasForeignKey(d => d.HRId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_HarmRapParam_HRId");
        });

        modelBuilder.Entity<HarmRapZlecenie>(entity =>
        {
            entity.HasKey(e => new { e.HRId, e.DataCzas });

            entity.HasIndex(e => e.DataCzas, "idx_HarmRapZlecenieDataCzas");

            entity.Property(e => e.HRId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.DataCzas).HasColumnType("datetime");
            entity.Property(e => e.Komentarz)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.HR).WithMany(p => p.HarmRapZlecenie)
                .HasForeignKey(d => d.HRId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_HarmRapZlecenie_HRId");
        });

        modelBuilder.Entity<HarmWpis>(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)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrHarmId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.KrajId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Opcje)
                .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.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.Istw)
                .HasForeignKey(d => d.MagId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_ISTW_REF_ISTWM_MAGAZYN");

            entity.HasOne(d => d.Tow).WithMany(p => p.Istw)
                .HasForeignKey(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_ISTW_REF_TOWIS_TOWAR");
        });

        modelBuilder.Entity<JM>(entity =>
        {
            entity.HasIndex(e => e.CentrJMId, "idx_CentrJMId");

            entity.Property(e => e.JMId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrJMId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(10)
                .IsUnicode(false);
        });

        modelBuilder.Entity<KartaLoj>(entity =>
        {
            entity.HasKey(e => e.KartaId).HasName("PK_KARTALOJ");

            entity.HasIndex(e => e.CentrKartaId, "idx_CentrKartaId");

            entity.HasIndex(e => e.KodKarty, "idx_KLoj_KodKarty");

            entity.HasIndex(e => e.KontoId, "idx_KLoj_Konto");

            entity.Property(e => e.KartaId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            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.KartaLoj)
                .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.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)");
            entity.Property(e => e.Kod)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.KodOpak)
                .HasMaxLength(20)
                .IsUnicode(false);
            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.KasKod)
                .HasForeignKey(d => d.KasaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_KASKOD_REF_KASKO_KASA");

            entity.HasOne(d => d.Tow).WithMany(p => p.KasKod)
                .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.Property(e => e.KasaId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ParNazwa)
                .HasMaxLength(60)
                .IsUnicode(false);
            entity.Property(e => e.ParWartosc)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Kasa).WithMany(p => p.KasPar)
                .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.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.KasTow)
                .HasForeignKey(d => d.KasaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_KASTOW_REF_KASKO_KASA");

            entity.HasOne(d => d.Tow).WithMany(p => p.KasTow)
                .HasForeignKey(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_KASTOW_REF_KASTO_TOWAR");
        });

        modelBuilder.Entity<Kasa>(entity =>
        {
            entity.HasKey(e => e.KasaId).HasName("PK_KASA");

            entity.Property(e => e.KasaId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.NrUnikatowy)
                .HasMaxLength(30)
                .IsUnicode(false);
            entity.Property(e => e.Stanowisko)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Typ)
                .HasMaxLength(40)
                .IsUnicode(false);

            entity.HasOne(d => d.Mag).WithMany(p => p.Kasa)
                .HasForeignKey(d => d.MagId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_KASA_REF_KASAM_MAGAZYN");

            entity.HasMany(d => d.As).WithMany(p => p.Kasa)
                .UsingEntity<Dictionary<string, object>>(
                    "Przydzial",
                    r => r.HasOne<Asort>().WithMany()
                        .HasForeignKey("AsId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_PRZYDZIA_REF_ASPRZ_ASORT"),
                    l => l.HasOne<Kasa>().WithMany()
                        .HasForeignKey("KasaId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_PRZYDZIA_REF_KASPR_KASA"),
                    j =>
                    {
                        j.HasKey("KasaId", "AsId").HasName("PK_PRZYDZIAL");
                        j.IndexerProperty<decimal>("KasaId").HasColumnType("numeric(9, 0)");
                        j.IndexerProperty<decimal>("AsId").HasColumnType("numeric(9, 0)");
                    });
        });

        modelBuilder.Entity<KasaFormaPlatn>(entity =>
        {
            entity.HasKey(e => new { e.FormaId, e.KasaId });

            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.KasaFormaPlatn)
                .HasForeignKey(d => d.FormaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_KASAFORMAPLATN_FPP7");

            entity.HasOne(d => d.Kasa).WithMany(p => p.KasaFormaPlatn)
                .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.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.KatParam)
                .HasForeignKey(d => d.KatId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_KATPARAM_REF_KATPA_KATEGORI");

            entity.HasOne(d => d.Par).WithMany(p => p.KatParam)
                .HasForeignKey(d => d.ParId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_KATPARAM_REF_PARKA_PARAMETR");
        });

        modelBuilder.Entity<Kategoria>(entity =>
        {
            entity.HasKey(e => e.KatId).HasName("PK_KATEGORIA");

            entity.HasIndex(e => e.CentrKatId, "idx_CentrKatId");

            entity.Property(e => e.KatId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrKatId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(40)
                .IsUnicode(false);
        });

        modelBuilder.Entity<KodDod>(entity =>
        {
            entity.HasKey(e => new { e.TowId, e.Kolejnosc }).HasName("PK_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)");
            entity.Property(e => e.Kod)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Skrot)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.SubsysKoduDod)
                .HasMaxLength(40)
                .IsUnicode(false);

            entity.HasOne(d => d.Tow).WithMany(p => p.KodDod)
                .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.HasIndex(e => e.CentrKWId, "idx_CentrKWId");

            entity.Property(e => e.KWId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrKWId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.JMId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(40)
                .IsUnicode(false);

            entity.HasOne(d => d.JM).WithMany(p => p.KodWazony)
                .HasForeignKey(d => d.JMId)
                .HasConstraintName("Ref_KodWazony");
        });

        modelBuilder.Entity<Komentarz>(entity =>
        {
            entity.HasKey(e => e.ZmId).HasName("PK_KOMENTARZ");

            entity.Property(e => e.ZmId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Opis)
                .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.Property(e => e.ParGrupa)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.ParNazwa)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.ParWartosc)
                .HasMaxLength(255)
                .IsUnicode(false);
        });

        modelBuilder.Entity<KontoBankowe>(entity =>
        {
            entity.HasKey(e => e.KBId);

            entity.Property(e => e.KBId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.BankId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrKBId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.KBIdOplat).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.Numer)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.PowKBId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Sufix)
                .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.KontoBankowe)
                .HasForeignKey(d => d.BankId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_KONTOBANK_BANK");

            entity.HasOne(d => d.Mag).WithMany(p => p.KontoBankowe)
                .HasForeignKey(d => d.MagId)
                .HasConstraintName("FK_KONTOBANK_MAGAZYN");

            entity.HasOne(d => d.Wal).WithMany(p => p.KontoBankowe)
                .HasForeignKey(d => d.WalId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_KONTOBANK_WALUTA");
        });

        modelBuilder.Entity<KontoBankoweKontr>(entity =>
        {
            entity.HasKey(e => e.KBKId);

            entity.Property(e => e.KBKId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.BankId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrKBKId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.Numer)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.PowKBKId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.WalId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.Bank).WithMany(p => p.KontoBankoweKontr)
                .HasForeignKey(d => d.BankId)
                .HasConstraintName("FK_KONTOBANKKONTR_BANK");

            entity.HasOne(d => d.Kontr).WithMany(p => p.KontoBankoweKontr)
                .HasForeignKey(d => d.KontrId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_KONTOBANKKONTR_KONTR");

            entity.HasOne(d => d.Wal).WithMany(p => p.KontoBankoweKontr)
                .HasForeignKey(d => d.WalId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_KONTOBANKKONTR_WALUTA");
        });

        modelBuilder.Entity<KontoLoj>(entity =>
        {
            entity.HasKey(e => e.KontoId).HasName("PK_KONTOLOJ");

            entity.HasIndex(e => e.CentrKontoId, "idx_CentrKontoId");

            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)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            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.KontoLoj)
                .HasForeignKey(d => d.KontrId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_KontoKth");
        });

        modelBuilder.Entity<KontrOpis>(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)
                .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.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)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.AkwId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Bank)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.CentrKontrId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.EMail)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.Fax)
                .HasMaxLength(60)
                .IsUnicode(false);
            entity.Property(e => e.IndeksCentr)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Kod)
                .HasMaxLength(10)
                .IsUnicode(false);
            entity.Property(e => e.KodKarty)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.KodKontr)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Konto)
                .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)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.NIP)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.NaPrzelewie1)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.NaPrzelewie2)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.NrAnalityki)
                .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)
                .HasMaxLength(80)
                .IsUnicode(false);
            entity.Property(e => e.Rezerwa2)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Skrot)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Telefon)
                .HasMaxLength(60)
                .IsUnicode(false);
            entity.Property(e => e.TermWaznKarty).HasColumnType("datetime");
            entity.Property(e => e.Ulica)
                .HasMaxLength(60)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.Akw).WithMany(p => p.Kontrahent)
                .HasForeignKey(d => d.AkwId)
                .HasConstraintName("FK_KONTRAHE_REF_KTHAK_AKWIZYTO");

            entity.HasOne(d => d.KontrKraj).WithMany(p => p.Kontrahent)
                .HasForeignKey(d => d.KontrKrajId)
                .HasConstraintName("FK_Ref_KontrahentKraj");

            entity.HasMany(d => d.KPW).WithMany(p => p.Kontr)
                .UsingEntity<Dictionary<string, object>>(
                    "KthWartosc",
                    r => r.HasOne<KthParWartosc>().WithMany()
                        .HasForeignKey("KPWId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_KTHWARTO_REF_KWPAR_KTHPARWA"),
                    l => l.HasOne<Kontrahent>().WithMany()
                        .HasForeignKey("KontrId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_KTHWARTO_REF_KTHWA_KONTRAHE"),
                    j =>
                    {
                        j.HasKey("KontrId", "KPWId").HasName("PK_KTHWARTOSC");
                        j.HasIndex(new[] { "KPWId" }, "idx_KWart");
                        j.IndexerProperty<decimal>("KontrId").HasColumnType("numeric(9, 0)");
                        j.IndexerProperty<decimal>("KPWId").HasColumnType("numeric(9, 0)");
                    });

            entity.HasMany(d => d.TypOs).WithMany(p => p.Kontr)
                .UsingEntity<Dictionary<string, object>>(
                    "KthTypOs",
                    r => r.HasOne<TypOs>().WithMany()
                        .HasForeignKey("TypOsId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_KTHTYPOS_TYPOS"),
                    l => l.HasOne<Kontrahent>().WithMany()
                        .HasForeignKey("KontrId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_KTHTYPOS_KTH"),
                    j =>
                    {
                        j.HasKey("KontrId", "TypOsId").HasName("PK_KTHTYPOS");
                        j.HasIndex(new[] { "TypOsId" }, "idx_KTHTYPOS_TYPOS");
                        j.IndexerProperty<decimal>("KontrId").HasColumnType("numeric(9, 0)");
                        j.IndexerProperty<decimal>("TypOsId").HasColumnType("numeric(9, 0)");
                    });
        });

        modelBuilder.Entity<Kraj>(entity =>
        {
            entity.HasKey(e => e.KrajId).HasName("PK_KRAJ");

            entity.Property(e => e.KrajId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Aktywny).HasDefaultValue((short)1);
            entity.Property(e => e.Kod)
                .HasMaxLength(10)
                .IsUnicode(false);
            entity.Property(e => e.Nazwa)
                .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.Kraj)
                .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.Property(e => e.KrajId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.Kraj).WithMany(p => p.KrajStawka)
                .HasForeignKey(d => d.KrajId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_Ref_KrajVat");
        });

        modelBuilder.Entity<KthParWartosc>(entity =>
        {
            entity.HasKey(e => e.KPWId).HasName("PK_KTHPARWARTOSC");

            entity.HasIndex(e => e.KthParId, "idx_KPWPar");

            entity.Property(e => e.KPWId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrKPWId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.KthParId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(40)
                .IsUnicode(false);

            entity.HasOne(d => d.KthPar).WithMany(p => p.KthParWartosc)
                .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.Property(e => e.KthParId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrKthParId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.KPWDomyslnaId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(40)
                .IsUnicode(false);

            entity.HasOne(d => d.KPWDomyslna).WithMany(p => p.KthParam)
                .HasForeignKey(d => d.KPWDomyslnaId)
                .HasConstraintName("FK_KTHPARAM_REF_KPDOM_KTHPARWA");
        });

        modelBuilder.Entity<KursWaluty>(entity =>
        {
            entity.HasKey(e => new { e.WalId, e.Data }).HasName("PK_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.KursWaluty)
                .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.HasIndex(e => e.Kod, "idx_LinLotKod");

            entity.HasIndex(e => e.Zmiana, "idx_LinLotZmiana");

            entity.Property(e => e.LiniaId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Kod)
                .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.Property(e => e.OperationId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            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.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)
                .HasMaxLength(255)
                .IsUnicode(false);
        });

        modelBuilder.Entity<LogValChangeNum>(entity =>
        {
            entity.HasKey(e => e.ValChangeId).HasName("PK_LOGVALCHANGENUM");

            entity.Property(e => e.ValChangeId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            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.LogValChangeNum)
                .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.Property(e => e.ValChangeId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            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)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.ValueBefore)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Operation).WithMany(p => p.LogValChangeTxt)
                .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.HasIndex(e => e.Kod, "idx_LotnKod");

            entity.HasIndex(e => e.Zmiana, "idx_LotnZmiana");

            entity.Property(e => e.LotnId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Kod)
                .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.Property(e => e.MagId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(40)
                .IsUnicode(false);
        });

        modelBuilder.Entity<MarZakres>(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)
                .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.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.Marzownik)
                .HasForeignKey(d => d.AsId)
                .HasConstraintName("FK_MARZOWNI_REF_MARAS_ASORT");

            entity.HasOne(d => d.Mag).WithMany(p => p.Marzownik)
                .HasForeignKey(d => d.MagId)
                .HasConstraintName("FK_MARZOWNI_REF_MARMA_MAGAZYN");

            entity.HasOne(d => d.Tow).WithMany(p => p.Marzownik)
                .HasForeignKey(d => d.TowId)
                .HasConstraintName("FK_MARZOWNI_REF_MARTO_TOWAR");
        });

        modelBuilder.Entity<Miasto>(entity =>
        {
            entity.HasKey(e => e.MId);

            entity.Property(e => e.MId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");
        });

        modelBuilder.Entity<Notatki>(entity =>
        {
            entity.HasKey(e => new { e.TowId, e.Kolejnosc }).HasName("PK_NOTATKI");

            entity.ToTable(tb => tb.HasTrigger("SwwDoNotatek"));

            entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Tow).WithMany(p => p.Notatki)
                .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.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)
                .HasMaxLength(60)
                .IsUnicode(false);

            entity.HasOne(d => d.Kontr).WithMany(p => p.NrRej)
                .HasForeignKey(d => d.KontrId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_NrRejKth");

            entity.HasMany(d => d.Karta).WithMany(p => p.NrRej)
                .UsingEntity<Dictionary<string, object>>(
                    "NrRejKarta",
                    r => r.HasOne<KartaLoj>().WithMany()
                        .HasForeignKey("KartaId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("Ref_KartaNrRej"),
                    l => l.HasOne<NrRej>().WithMany()
                        .HasForeignKey("KontrId", "NrFormat")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("Ref_NrRejKarta"),
                    j =>
                    {
                        j.HasKey("KontrId", "NrFormat", "KartaId").HasName("PK_NRREJKARTA");
                        j.HasIndex(new[] { "KartaId", "KontrId", "NrFormat" }, "idx_NrRejKartaId");
                        j.IndexerProperty<decimal>("KontrId").HasColumnType("numeric(9, 0)");
                        j.IndexerProperty<string>("NrFormat")
                            .HasMaxLength(60)
                            .IsUnicode(false);
                        j.IndexerProperty<decimal>("KartaId").HasColumnType("numeric(9, 0)");
                    });
        });

        modelBuilder.Entity<NumDok>(entity =>
        {
            entity.HasKey(e => e.TypNumeru).HasName("PK_NUMDOK");

            entity.Property(e => e.TypNumeru).ValueGeneratedNever();
            entity.Property(e => e.Format)
                .HasMaxLength(255)
                .IsUnicode(false);
        });

        modelBuilder.Entity<NumMag>(entity =>
        {
            entity.HasKey(e => new { e.TypNumeru, e.MagId }).HasName("PK_NUMMAG");

            entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Format)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Mag).WithMany(p => p.NumMag)
                .HasForeignKey(d => d.MagId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_NUMMAG_REF_NUMMA_MAGAZYN");

            entity.HasOne(d => d.TypNumeruNavigation).WithMany(p => p.NumMag)
                .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.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.OdbProdOdb)
                .HasForeignKey(d => d.OdbId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_ODBPROD_REF_ODBPR_KONTRAHE");

            entity.HasOne(d => d.Prod).WithMany(p => p.OdbProdProd)
                .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.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.OdbiorcaNavigation)
                .HasForeignKey(d => d.KontrId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_ODBIORCA_REF_KTHOD_KONTRAHE");

            entity.HasOne(d => d.Tow).WithMany(p => p.Odbiorca)
                .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.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)
                .HasMaxLength(20)
                .IsUnicode(false);

            entity.HasOne(d => d.Oferta).WithMany(p => p.OfKod)
                .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.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.OfSlownik)
                .HasForeignKey(d => d.KontrId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_OFSLOWNI_REF_OFSLO_KONTRAHE");
        });

        modelBuilder.Entity<Oferta>(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.CKU)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Cena).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.JM)
                .HasMaxLength(10)
                .IsUnicode(false);
            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.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.OpisZdarzLoj)
                .HasForeignKey(d => d.ZdarzLojId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_OpisZdarzLojZdarzLoj");
        });

        modelBuilder.Entity<Oplata>(entity =>
        {
            entity.HasIndex(e => new { e.DataOd, e.DataDo }, "IxOplata_DataOd");

            entity.HasIndex(e => e.Zmiana, "IxOplata_Zmiana");

            entity.Property(e => e.OplataId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            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)");
            entity.Property(e => e.Komentarz)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Kwota).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Nazwa)
                .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.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.OsobaNavigation)
                .HasForeignKey(d => d.KontrId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_OSOBA_REF_OSOBA_KONTRAHE");
        });

        modelBuilder.Entity<PH>(entity =>
        {
            entity.HasIndex(e => e.KontrId, "idx_PHKth");

            entity.Property(e => e.PHId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(60)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.Kontr).WithMany(p => p.PH)
                .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.Property(e => e.PHId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.PH).WithMany(p => p.PHDane)
                .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.Property(e => e.PHId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.PHOdbiorca).WithMany(p => p.PHOdbDane)
                .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.HasIndex(e => e.KontrId, "idx_PHOdbKth");

            entity.Property(e => e.PHId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.Kontr).WithMany(p => p.PHOdbiorca)
                .HasForeignKey(d => d.KontrId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_PHODBIOR_REF_PHODB_KONTRAHE");

            entity.HasOne(d => d.PH).WithMany(p => p.PHOdbiorca)
                .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.HasIndex(e => e.PHId, "idx_PHRozPH");

            entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.PHId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Kwota).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Rozliczono).HasColumnType("datetime");

            entity.HasOne(d => d.Dok).WithMany(p => p.PHRozliczenie)
                .HasForeignKey(d => d.DokId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_PHROZLIC_REF_PHDOK_DOK");

            entity.HasOne(d => d.PH).WithMany(p => p.PHRozliczenie)
                .HasForeignKey(d => d.PHId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_PHROZLIC_REF_PHROZ_PH");
        });

        modelBuilder.Entity<Panel>(entity =>
        {
            entity.HasKey(e => e.PanelId).HasName("PK_PANEL");

            entity.Property(e => e.PanelId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrPanelId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.TypAplikacji).HasDefaultValue((short)3);
            entity.Property(e => e.UzId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.UzNSId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.Uz).WithMany(p => p.Panel)
                .HasForeignKey(d => d.UzId)
                .HasConstraintName("FK_PANEL_REFERENCE_UZYTKOWNIK");

            entity.HasOne(d => d.UzNS).WithMany(p => p.Panel)
                .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.Property(e => e.PanelId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ParNazwa)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.ParWartosc)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Panel).WithMany(p => p.PanelParam)
                .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.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Kwota).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Numer)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Typ)
                .HasMaxLength(10)
                .IsUnicode(false);

            entity.HasOne(d => d.Par).WithMany(p => p.ParBon)
                .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.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.ParPunkty)
                .HasForeignKey(d => d.ParId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_PARPUNKT_REF_PARPK_PARAGON");
        });

        modelBuilder.Entity<ParWaluta>(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.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(40)
                .IsUnicode(false);

            entity.HasOne(d => d.Par).WithMany(p => p.ParWartosc)
                .HasForeignKey(d => d.ParId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_PARWARTO_REF_PARWA_PARAMETR");
        });

        modelBuilder.Entity<ParWiseBase>(entity =>
        {
            entity.HasKey(e => e.ParId);

            entity.HasIndex(e => new { e.KodGrupy, e.Nazwa }, "idx_ParWB_GrupaINazwa");

            entity.Property(e => e.ParId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.KodGrupy)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Opcje)
                .HasMaxLength(255)
                .IsUnicode(false);
        });

        modelBuilder.Entity<Paragon>(entity =>
        {
            entity.HasKey(e => e.ParId).HasName("PK_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)
                .ValueGeneratedOnAdd()
                .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)
                .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)");
            entity.Property(e => e.Gotowka).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.GrupyGTU)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.InneFPlat).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Karta).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.KasaId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Kasjer)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.KodKarty)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.NIP)
                .HasMaxLength(40)
                .IsUnicode(false);
            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.Paragon)
                .HasForeignKey(d => d.KasaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_PARAGON_REF_PARKA_KASA");

            entity.HasOne(d => d.Wal).WithMany(p => p.Paragon)
                .HasForeignKey(d => d.WalId)
                .HasConstraintName("FK_PARAGON_REF_PARWA_WALUTA");
        });

        modelBuilder.Entity<Parametr>(entity =>
        {
            entity.HasKey(e => e.ParId).HasName("PK_PARAMETR");

            entity.HasIndex(e => e.CentrParId, "idx_CentrParId");

            entity.Property(e => e.ParId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrParId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
        });

        modelBuilder.Entity<Partia>(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.Partia)
                .HasForeignKey<Partia>(d => new { d.DokId, d.Kolejnosc })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_PARTIA_REF_PRTPO_POZDOK");
        });

        modelBuilder.Entity<PcfUser>(entity =>
        {
            entity.HasKey(e => e.PcfUserId).HasName("PK_PCFUSER");

            entity.HasIndex(e => e.Ident, "IxIdent");

            entity.Property(e => e.EMail)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.FirstName)
                .HasMaxLength(32)
                .IsUnicode(false);
            entity.Property(e => e.Flags)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.Ident)
                .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)");
            entity.Property(e => e.ValidFrom).HasColumnType("datetime");
            entity.Property(e => e.ValidTo).HasColumnType("datetime");

            entity.HasOne(d => d.PcfCustomer).WithMany(p => p.PcfUserPcfCustomer)
                .HasForeignKey(d => d.PcfCustomerId)
                .HasConstraintName("FK_PCFUSER_REFERENCE_KONTRC");

            entity.HasOne(d => d.PcfLoyaltyCustomer).WithMany(p => p.PcfUserPcfLoyaltyCustomer)
                .HasForeignKey(d => d.PcfLoyaltyCustomerId)
                .HasConstraintName("FK_PCFUSER_REFERENCE_KONTRL");

            entity.HasOne(d => d.PcfPStation).WithMany(p => p.PcfUserPcfPStation)
                .HasForeignKey(d => d.PcfPStationId)
                .HasConstraintName("FK_PCFUSER_REFERENCE_KONTRS");
        });

        modelBuilder.Entity<PcfUserSklep>(entity =>
        {
            entity.HasKey(e => new { e.PcfUserId, e.SklepId, e.Znaczenie }).HasName("PK_PcfUserSklepZnaczenie");

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Parametr)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.PcfUser).WithMany(p => p.PcfUserSklep)
                .HasForeignKey(d => d.PcfUserId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_PcfUser");

            entity.HasOne(d => d.Sklep).WithMany(p => p.PcfUserSklep)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_Sklep");
        });

        modelBuilder.Entity<PcpPos>(entity =>
        {
            entity.HasIndex(e => e.PcpShopId, "IxPcpPosPcpShopId");

            entity.Property(e => e.Created).HasColumnType("datetime");
            entity.Property(e => e.FiscalUniqueNoDfl)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.PosCode)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.PosName)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.Updated).HasColumnType("datetime");

            entity.HasOne(d => d.PcpShop).WithMany(p => p.PcpPos)
                .HasForeignKey(d => d.PcpShopId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_Pos_Shop");
        });

        modelBuilder.Entity<PcpReceipt>(entity =>
        {
            entity.HasIndex(e => e.CustomerCode, "IxPcpReceiptCustomerCode");

            entity.HasIndex(e => e.KontrId, "IxPcpReceiptKontrId");

            entity.HasIndex(e => e.PcpPosId, "IxPcpReceiptPcpPosId");

            entity.Property(e => e.PcpReceiptId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Cashier)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.Created).HasColumnType("datetime");
            entity.Property(e => e.CustomerCode)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.CustomerNip)
                .HasMaxLength(16)
                .IsUnicode(false);
            entity.Property(e => e.DocNo)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.FiscalUniqueNo)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.KontrId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.OperationDateTime).HasColumnType("datetime");
            entity.Property(e => e.PosCode)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.ReceiptSysNo)
                .HasMaxLength(32)
                .IsUnicode(false);
            entity.Property(e => e.TotalBrutto).HasColumnType("decimal(14, 2)");
            entity.Property(e => e.TotalDiscount).HasColumnType("decimal(14, 2)");
            entity.Property(e => e.TotalNetto).HasColumnType("decimal(14, 2)");
            entity.Property(e => e.TransUUID)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.Updated).HasColumnType("datetime");

            entity.HasOne(d => d.Kontr).WithMany(p => p.PcpReceipt)
                .HasForeignKey(d => d.KontrId)
                .HasConstraintName("FK_Receipt_Customer");

            entity.HasOne(d => d.PcpPos).WithMany(p => p.PcpReceipt)
                .HasForeignKey(d => d.PcpPosId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_Receipt_Pos");
        });

        modelBuilder.Entity<PcpReceiptItem>(entity =>
        {
            entity.HasIndex(e => e.PcpReceiptId, "IxPcpReceiptItemPcpReceiptId");

            entity.Property(e => e.PcpReceiptItemId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Barcode)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.DiscountValue).HasColumnType("decimal(14, 2)");
            entity.Property(e => e.PcpReceiptId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Price).HasColumnType("decimal(14, 2)");
            entity.Property(e => e.ProductName)
                .HasMaxLength(128)
                .IsUnicode(false);
            entity.Property(e => e.Quantity).HasColumnType("decimal(14, 4)");
            entity.Property(e => e.TotalBrutto).HasColumnType("decimal(14, 2)");
            entity.Property(e => e.TotalDiscount).HasColumnType("decimal(14, 2)");
            entity.Property(e => e.TotalNetto).HasColumnType("decimal(14, 2)");
            entity.Property(e => e.VatChar)
                .HasMaxLength(1)
                .IsUnicode(false);
            entity.Property(e => e.VatRate).HasColumnType("decimal(6, 2)");

            entity.HasOne(d => d.PcpReceipt).WithMany(p => p.PcpReceiptItem)
                .HasForeignKey(d => d.PcpReceiptId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_ReceiptItem_Receipt");
        });

        modelBuilder.Entity<PcpReceiptPayment>(entity =>
        {
            entity.HasIndex(e => e.PcpReceiptId, "IxPcpReceiptPaymentPcpReceiptId");

            entity.Property(e => e.PcpReceiptPaymentId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ChangeInCurrency).HasColumnType("decimal(14, 4)");
            entity.Property(e => e.ChangeRef).HasColumnType("decimal(14, 2)");
            entity.Property(e => e.Currency)
                .HasMaxLength(8)
                .IsUnicode(false);
            entity.Property(e => e.PcpReceiptId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ValueInCurrency).HasColumnType("decimal(14, 4)");
            entity.Property(e => e.ValueRef).HasColumnType("decimal(14, 2)");

            entity.HasOne(d => d.PcpReceipt).WithMany(p => p.PcpReceiptPayment)
                .HasForeignKey(d => d.PcpReceiptId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_ReceiptPayment_Receipt");
        });

        modelBuilder.Entity<PcpReceiptVat>(entity =>
        {
            entity.Property(e => e.PcpReceiptVatId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.PcpReceiptId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.TotalBrutto).HasColumnType("decimal(14, 2)");
            entity.Property(e => e.TotalVat).HasColumnType("decimal(14, 2)");
            entity.Property(e => e.VatChar)
                .HasMaxLength(1)
                .IsUnicode(false);
            entity.Property(e => e.VatRate).HasColumnType("decimal(6, 2)");

            entity.HasOne(d => d.PcpReceipt).WithMany(p => p.PcpReceiptVat)
                .HasForeignKey(d => d.PcpReceiptId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_ReceiptVat_Receipt");
        });

        modelBuilder.Entity<PcpShop>(entity =>
        {
            entity.Property(e => e.Created).HasColumnType("datetime");
            entity.Property(e => e.ShopAddrOnReceipt0)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.ShopAddrOnReceipt1)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.ShopAddrOnReceipt2)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.ShopAddrOnReceipt3)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.ShopLicenseKey)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.ShopLicenseValidFrom).HasColumnType("datetime");
            entity.Property(e => e.ShopLicenseValidTo).HasColumnType("datetime");
            entity.Property(e => e.ShopName)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.ShopNameOnReceipt0)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.ShopNameOnReceipt1)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.ShopNameOnReceipt2)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.ShopNameOnReceipt3)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.ShopNip)
                .HasMaxLength(16)
                .IsUnicode(false);
            entity.Property(e => e.Updated).HasColumnType("datetime");
        });

        modelBuilder.Entity<PolParam>(entity =>
        {
            entity.HasKey(e => new { e.PolId, e.ParGrupa, e.ParNazwa }).HasName("PK_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)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Pol).WithMany(p => p.PolParam)
                .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.HasIndex(e => e.CentrPolId, "idx_CentrPolId");

            entity.Property(e => e.PolId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrPolId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(40)
                .IsUnicode(false);

            entity.HasMany(d => d.Mag).WithMany(p => p.Pol)
                .UsingEntity<Dictionary<string, object>>(
                    "PolMag",
                    r => r.HasOne<Magazyn>().WithMany()
                        .HasForeignKey("MagId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_POLMAG_REF_MAGPO_MAGAZYN"),
                    l => l.HasOne<Polityka>().WithMany()
                        .HasForeignKey("PolId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_POLMAG_REF_POLMA_POLITYKA"),
                    j =>
                    {
                        j.HasKey("PolId", "MagId").HasName("PK_POLMAG");
                        j.HasIndex(new[] { "MagId" }, "idx_MagPol");
                        j.IndexerProperty<decimal>("PolId").HasColumnType("numeric(9, 0)");
                        j.IndexerProperty<decimal>("MagId").HasColumnType("numeric(9, 0)");
                    });
        });

        modelBuilder.Entity<PowKontLoj>(entity =>
        {
            entity.HasKey(e => new { e.NoweKontoId, e.RodzajPow }).HasName("PK_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.PowKontLojNoweKonto)
                .HasForeignKey(d => d.NoweKontoId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_NoweKonto");

            entity.HasOne(d => d.StareKonto).WithMany(p => p.PowKontLojStareKonto)
                .HasForeignKey(d => d.StareKontoId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_StareKonto");
        });

        modelBuilder.Entity<Powiadomienie>(entity =>
        {
            entity.HasKey(e => e.PowiadomienieId).HasName("PK_POWIADOMIENIE");

            entity.HasIndex(e => new { e.ShopNo, e.PosNo }, "IxPowiadomienie_ShopNoPosNo");

            entity.HasIndex(e => e.Status, "IxPowiadomienie_Status");

            entity.Property(e => e.PowiadomienieId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            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.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.PowiadomienieParam)
                .HasForeignKey(d => d.PowiadomienieId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_PowiadomienieParamPowiadomienie");
        });

        modelBuilder.Entity<Powiazanie>(entity =>
        {
            entity.HasKey(e => e.TowId).HasName("PK_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)");
            entity.Property(e => e.OpakId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.Opak).WithMany(p => p.PowiazanieOpak)
                .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<PowiazanieProm>(entity =>
        {
            entity.HasKey(e => new { e.PromId, e.GrupaId, e.Rodzaj });

            entity.Property(e => e.PromId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.GrupaId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.Grupa).WithMany(p => p.PowiazanieProm)
                .HasForeignKey(d => d.GrupaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_PowiazanieProm_GrupaPromocji");
        });

        modelBuilder.Entity<PowiazanieSklep>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.Id, e.Typ }).HasName("PK_POWIAZANIE_SKLEP");

            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.PowiazanieSklep)
                .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.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.PowiazanieUz)
                .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.Property(e => e.UzNSId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Id).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.UzNS).WithMany(p => p.PowiazanieUzNaSklep)
                .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.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.PozAkcyza)
                .HasForeignKey(d => d.GrAkcId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_AkcPoz");

            entity.HasOne(d => d.PozDok).WithMany(p => p.PozAkcyza)
                .HasForeignKey(d => new { d.DokId, d.Kolejnosc })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_PozAkc");
        });

        modelBuilder.Entity<PozCennikDok>(entity =>
        {
            entity.HasKey(e => new { e.DokId, e.TowId, e.SklepId }).HasName("PK_POZCENNIKDOK");

            entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.DoKiedyPrzyjecie).HasColumnType("datetime");

            entity.HasOne(d => d.Sklep).WithMany(p => p.PozCennikDok)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_PozCennikDokSklep");
        });

        modelBuilder.Entity<PozDok>(entity =>
        {
            entity.HasKey(e => new { e.DokId, e.Kolejnosc }).HasName("PK_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)");
            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.PozDok)
                .HasForeignKey(d => d.DokId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_POZDOK_REF_POZDO_DOK");

            entity.HasOne(d => d.Tow).WithMany(p => p.PozDok)
                .HasForeignKey(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_POZDOK_REF_POZTO_TOWAR");
        });

        modelBuilder.Entity<PozDokWBufPowiazanie>(entity =>
        {
            entity.HasKey(e => new { e.DokId, e.Kolejnosc, e.JakiePow, e.KtorePow }).HasName("PK_POZDOKWBUFPOWIAZANIE");

            entity.HasIndex(e => e.Id, "idx_PozDokWBufId");

            entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Id).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Param)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.PozDok).WithMany(p => p.PozDokWBufPowiazanie)
                .HasForeignKey(d => new { d.DokId, d.Kolejnosc })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_PozDokWBufPow");
        });

        modelBuilder.Entity<PozPar>(entity =>
        {
            entity.HasKey(e => new { e.ParId, e.Kolejnosc }).HasName("PK_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);
            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.PozPar)
                .HasForeignKey(d => d.ParId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_POZPAR_REF_POZPA_PARAGON");

            entity.HasOne(d => d.Tow).WithMany(p => p.PozPar)
                .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.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.DodInfo)
                .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.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.PozWz)
                .HasForeignKey(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_POZWZ_REF_TOWWZ_TOWAR");

            entity.HasOne(d => d.Wz).WithMany(p => p.PozWz)
                .HasForeignKey(d => d.WzId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_POZWZ_REF_POZWZ_WZORZEC");
        });

        modelBuilder.Entity<Profil>(entity =>
        {
            entity.HasKey(e => e.ProfilId).HasName("PK_PROFIL");

            entity.Property(e => e.ProfilId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .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.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.ProfilKasa)
                .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.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.ProfilKonfig)
                .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.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)");
            entity.Property(e => e.CenaSpDet).HasColumnType("decimal(15, 4)");
            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.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.PrtMag)
                .HasForeignKey(d => d.MagId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_PrtMagMagazyn");

            entity.HasOne(d => d.Tow).WithMany(p => p.PrtMag)
                .HasForeignKey(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_PrtMagTowar");
        });

        modelBuilder.Entity<RapWartPocz>(entity =>
        {
            entity.HasKey(e => e.RWPId).HasName("PK_RAPWARTPOCZ");

            entity.HasIndex(e => new { e.TypRap, e.Data }, "idx_RWP_TypRapData");

            entity.Property(e => e.RWPId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            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.Property(e => e.RWPId).HasColumnType("numeric(9, 0)");
            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.RapWartPoczDane)
                .HasForeignKey(d => d.MagId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_RAPWARTPOCZDANE_REFERENCE_MAGAZYN");

            entity.HasOne(d => d.RWP).WithMany(p => p.RapWartPoczDane)
                .HasForeignKey(d => d.RWPId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_RAPWARTPOCZDANE_REFERENCE_RAPWARTPOCZ");
        });

        modelBuilder.Entity<Regula>(entity =>
        {
            entity.HasKey(e => e.RegulaId).HasName("PK_REGULA");

            entity.Property(e => e.RegulaId)
                .ValueGeneratedOnAdd()
                .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");
        });

        modelBuilder.Entity<RegulaAsort>(entity =>
        {
            entity.HasKey(e => new { e.RegulaId, e.AsId, e.Znaczenie }).HasName("PK_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.RegulaAsort)
                .HasForeignKey(d => d.AsId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_REGULAAS_REFERENCE_ASORT");

            entity.HasOne(d => d.Regula).WithMany(p => p.RegulaAsort)
                .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.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.RegulaDok)
                .HasForeignKey(d => d.DokId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_RegDokDok");

            entity.HasOne(d => d.Konto).WithMany(p => p.RegulaDok)
                .HasForeignKey(d => d.KontoId)
                .HasConstraintName("Ref_RegDokKonto");

            entity.HasOne(d => d.Regula).WithMany(p => p.RegulaDok)
                .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.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)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.RegulaDok).WithMany(p => p.RegulaDokSzczeg)
                .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.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.Property(e => e.Informacja)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.NazwaTowaru)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Regula).WithMany(p => p.RegulaKod)
                .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.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.RegulaPar)
                .HasForeignKey(d => d.KontoId)
                .HasConstraintName("Ref_RegParKonto");

            entity.HasOne(d => d.Par).WithMany(p => p.RegulaPar)
                .HasForeignKey(d => d.ParId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_RegParPar");

            entity.HasOne(d => d.Regula).WithMany(p => p.RegulaPar)
                .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.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)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.RegulaPar).WithMany(p => p.RegulaParSzczeg)
                .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.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.RegulaParam)
                .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.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.RegulaPozDok)
                .HasForeignKey(d => d.RegulaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_RegPozReg");

            entity.HasOne(d => d.PozDok).WithMany(p => p.RegulaPozDok)
                .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.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.RegulaPozDokSzczeg)
                .HasForeignKey(d => d.RegulaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_RegPozSzReg");

            entity.HasOne(d => d.PozDok).WithMany(p => p.RegulaPozDokSzczeg)
                .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.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.RegulaPozPar)
                .HasForeignKey(d => d.RegulaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_RegPozParReg");

            entity.HasOne(d => d.PozPar).WithMany(p => p.RegulaPozPar)
                .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.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.RegulaPozParSzczeg)
                .HasForeignKey(d => d.RegulaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_RegPozPSzReg");

            entity.HasOne(d => d.PozPar).WithMany(p => p.RegulaPozParSzczeg)
                .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.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.RegulaProg)
                .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.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.RegulaSklep)
                .HasForeignKey(d => d.RegulaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_RegulaSklep_Regula");

            entity.HasOne(d => d.Sklep).WithMany(p => p.RegulaSklep)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_RegulaSklep_Sklep");
        });

        modelBuilder.Entity<RegulaSklepAuth>(entity =>
        {
            entity.HasKey(e => new { e.RegulaId, e.SklepId });

            entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.DataCzasAutoryzacji).HasColumnType("datetime");
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.PcfUser).WithMany(p => p.RegulaSklepAuth)
                .HasForeignKey(d => d.PcfUserId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_RegulaSklepAuth_PcfUser");

            entity.HasOne(d => d.Regula).WithMany(p => p.RegulaSklepAuth)
                .HasForeignKey(d => d.RegulaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_RegulaSklepAuth_Regula");

            entity.HasOne(d => d.Sklep).WithMany(p => p.RegulaSklepAuth)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_RegulaSklepAuth_Sklep");
        });

        modelBuilder.Entity<RegulaTekst>(entity =>
        {
            entity.HasKey(e => new { e.RegulaId, e.Znaczenie });

            entity.Property(e => e.RegulaId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Regula).WithMany(p => p.RegulaTekst)
                .HasForeignKey(d => d.RegulaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_RegulaTekst_Regula");
        });

        modelBuilder.Entity<RegulaTowar>(entity =>
        {
            entity.HasKey(e => new { e.RegulaId, e.TowId, e.Znaczenie }).HasName("PK_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.RegulaTowar)
                .HasForeignKey(d => d.RegulaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_REGULATO_REFERENCE_REGULA");

            entity.HasOne(d => d.Tow).WithMany(p => p.RegulaTowar)
                .HasForeignKey(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_REGULATO_REFERENCE_TOWAR");
        });

        modelBuilder.Entity<Rola>(entity =>
        {
            entity.HasKey(e => e.RolaId).HasName("PK_ROLA");

            entity.Property(e => e.RolaId).ValueGeneratedNever();
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");
        });

        modelBuilder.Entity<RolaUprawnienie>(entity =>
        {
            entity.HasKey(e => new { e.RolaId, e.Rodzaj }).HasName("PK_ROLAUPR");

            entity.HasOne(d => d.Rola).WithMany(p => p.RolaUprawnienie)
                .HasForeignKey(d => d.RolaId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_RolaUprRola");
        });

        modelBuilder.Entity<RozPrtMag>(entity =>
        {
            entity.HasKey(e => new { e.TowId, e.PMId, e.Znaczenie, e.DokId, e.Kolejnosc }).HasName("PK_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)");
            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.RozPrtMag)
                .HasForeignKey(d => new { d.DokId, d.Kolejnosc })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_RozPrtMagPoz");

            entity.HasOne(d => d.PrtMag).WithMany(p => p.RozPrtMag)
                .HasForeignKey(d => new { d.TowId, d.PMId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_RozPrtMagPrt");
        });

        modelBuilder.Entity<RozbicieDodDok>(entity =>
        {
            entity.HasKey(e => new { e.DokId, e.Znaczenie, e.Stawka }).HasName("PK_ROZBDODDOK");

            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.NettoMag).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Podatek).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.PodatekDet).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.PodatekMag).HasColumnType("decimal(15, 4)");

            entity.HasOne(d => d.Dok).WithMany(p => p.RozbicieDodDok)
                .HasForeignKey(d => d.DokId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_RozbDodDokDok");
        });

        modelBuilder.Entity<RozbicieDok>(entity =>
        {
            entity.HasKey(e => new { e.DokId, e.Stawka }).HasName("PK_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.NettoMag).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Podatek).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.PodatekDet).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.PodatekMag).HasColumnType("decimal(15, 4)");

            entity.HasOne(d => d.Dok).WithMany(p => p.RozbicieDok)
                .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.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.RozliczaDok)
                .HasForeignKey(d => d.DokId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_ROZLICZA_REF_DOKZB_DOK");

            entity.HasOne(d => d.RozliczanyDok).WithMany(p => p.RozliczaRozliczanyDok)
                .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.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.Partia).WithMany(p => p.RozliczeniePartii)
                .HasForeignKey(d => new { d.PrtDokId, d.PrtKolejnosc })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_ROZLICZE_REF_PRTRO_PARTIA");

            entity.HasOne(d => d.PozDok).WithMany(p => p.RozliczeniePartii)
                .HasForeignKey(d => new { d.RozDokId, d.RozKolejnosc })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_ROZLICZE_REF_ROZPO_POZDOK");
        });

        modelBuilder.Entity<Sesja>(entity =>
        {
            entity.HasKey(e => e.SesjaId).HasName("PK_SESJA");

            entity.HasIndex(e => e.UzId, "idx_SesjaUzId");

            entity.Property(e => e.SesjaId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Stanowisko)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.UzId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Wersja)
                .HasMaxLength(40)
                .IsUnicode(false);

            entity.HasOne(d => d.Uz).WithMany(p => p.Sesja)
                .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.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.Property(e => e.DKId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(40)
                .IsUnicode(false);

            entity.HasOne(d => d.DK).WithMany(p => p.SkladnikDefinicjiKodu)
                .HasForeignKey(d => d.DKId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLDEFKODU");
        });

        modelBuilder.Entity<SkladnikWzorca>(entity =>
        {
            entity.HasKey(e => e.SkWzId).HasName("PK_SKLADNIKWZORCA");

            entity.HasIndex(e => e.CentrSkWzId, "idx_CentrSkWzId");

            entity.HasIndex(e => new { e.TowIdWzorca, e.Kolejnosc }, "idx_SkladnikWzorca_TowIdWzorca");

            entity.Property(e => e.SkWzId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            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)
                .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.SkladnikWzorca)
                .HasForeignKey(d => d.TowIdWzorca)
                .HasConstraintName("FK_SKLADNIKWZORCA_REFERENCE_TOWAR");
        });

        modelBuilder.Entity<Sklep>(entity =>
        {
            entity.HasKey(e => e.SklepId).HasName("PK_SKLEP");

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.DataBO).HasColumnType("datetime");
            entity.Property(e => e.KrajId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.MagId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.NrSeryjny)
                .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.Sklep)
                .HasForeignKey(d => d.KrajId)
                .HasConstraintName("FK_Ref_KrajSklep");

            entity.HasOne(d => d.Mag).WithMany(p => p.Sklep)
                .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");

            entity.HasMany(d => d.As).WithMany(p => p.Sklep)
                .UsingEntity<Dictionary<string, object>>(
                    "SklepPrzydzial",
                    r => r.HasOne<Asort>().WithMany()
                        .HasForeignKey("AsId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_SKLEPPRZ_REF_SKLEP_ASORT"),
                    l => l.HasOne<Sklep>().WithMany()
                        .HasForeignKey("SklepId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_SKLEPPRZ_REF_SKLEP_SKLEP"),
                    j =>
                    {
                        j.HasKey("SklepId", "AsId").HasName("PK_SKLEPPRZYDZIAL");
                        j.IndexerProperty<decimal>("SklepId").HasColumnType("numeric(9, 0)");
                        j.IndexerProperty<decimal>("AsId").HasColumnType("numeric(9, 0)");
                    });

            entity.HasMany(d => d.Centrala).WithMany(p => p.Sklep1)
                .UsingEntity<Dictionary<string, object>>(
                    "SklepSklep",
                    r => r.HasOne<Sklep>().WithMany()
                        .HasForeignKey("CentralaId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_SKLEPSKL_REF_SKCEN_SKLEP"),
                    l => l.HasOne<Sklep>().WithMany()
                        .HasForeignKey("SklepId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_SKLEPSKL_REF_SKSKL_SKLEP"),
                    j =>
                    {
                        j.HasKey("CentralaId", "SklepId").HasName("PK_SKLEPSKLEP");
                        j.IndexerProperty<decimal>("CentralaId").HasColumnType("numeric(9, 0)");
                        j.IndexerProperty<decimal>("SklepId").HasColumnType("numeric(9, 0)");
                    });

            entity.HasMany(d => d.KPW).WithMany(p => p.Sklep)
                .UsingEntity<Dictionary<string, object>>(
                    "SklepKthPrzydzial",
                    r => r.HasOne<KthParWartosc>().WithMany()
                        .HasForeignKey("KPWId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_SKLEPKTH_REF_SKKTH_KTHPARWA"),
                    l => l.HasOne<Sklep>().WithMany()
                        .HasForeignKey("SklepId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_SKLEPKTH_REF_SKKTH_SKLEP"),
                    j =>
                    {
                        j.HasKey("SklepId", "KPWId").HasName("PK_SKLEPKTHPRZYDZIAL");
                        j.IndexerProperty<decimal>("SklepId").HasColumnType("numeric(9, 0)");
                        j.IndexerProperty<decimal>("KPWId").HasColumnType("numeric(9, 0)");
                    });

            entity.HasMany(d => d.Sklep1).WithMany(p => p.Centrala)
                .UsingEntity<Dictionary<string, object>>(
                    "SklepSklep",
                    r => r.HasOne<Sklep>().WithMany()
                        .HasForeignKey("SklepId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_SKLEPSKL_REF_SKSKL_SKLEP"),
                    l => l.HasOne<Sklep>().WithMany()
                        .HasForeignKey("CentralaId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_SKLEPSKL_REF_SKCEN_SKLEP"),
                    j =>
                    {
                        j.HasKey("CentralaId", "SklepId").HasName("PK_SKLEPSKLEP");
                        j.IndexerProperty<decimal>("CentralaId").HasColumnType("numeric(9, 0)");
                        j.IndexerProperty<decimal>("SklepId").HasColumnType("numeric(9, 0)");
                    });
        });

        modelBuilder.Entity<SklepArtykul>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepArtId }).HasName("PK_SKLEPARTYKUL");

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepArtId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ArtNazwa)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.GlownySklepTowId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.Sklep).WithMany(p => p.SklepArtykul)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPART_REF_SKART_SKLEP");

            entity.HasOne(d => d.SklepTowar).WithMany(p => p.SklepArtykul)
                .HasForeignKey(d => new { d.SklepId, d.GlownySklepTowId })
                .HasConstraintName("FK_SKLARTGLOWNYSKLEPTOWID");
        });

        modelBuilder.Entity<SklepBank>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepBankId });

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepBankId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Adres)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.BankId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.NrRozliBank)
                .HasMaxLength(8)
                .IsUnicode(false);
            entity.Property(e => e.SWIFT)
                .HasMaxLength(11)
                .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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepDKId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.DKId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.DataDo).HasColumnType("datetime");
            entity.Property(e => e.DataOd).HasColumnType("datetime");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.Sklep).WithMany(p => p.SklepDefinicjaKodu)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKDEFKODUSKLEP");
        });

        modelBuilder.Entity<SklepDlugiZasob>(entity =>
        {
            entity.HasKey(e => new { e.ZasobId, e.SklepId });

            entity.HasIndex(e => new { e.SklepId, e.SklepZasobId }, "IxSklepDlugiZasob_SklepIdent");

            entity.Property(e => e.ZasobId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepWersja)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.SklepZasobId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.Zasob).WithMany(p => p.SklepDlugiZasob)
                .HasForeignKey(d => d.ZasobId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SklepDlugiZasob_ZasobId");
        });

        modelBuilder.Entity<SklepDok>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepDokId }).HasName("PK_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.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.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)
                .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.SklepKBId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepKasaId).HasColumnType("numeric(9, 0)");
            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.SklepWalIdPlatnosci).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)");
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.Dok).WithMany(p => p.SklepDok)
                .HasForeignKey(d => d.DokId)
                .HasConstraintName("FK_SKLEPDOK_REF_SKDOK_DOK");

            entity.HasOne(d => d.Sklep).WithMany(p => p.SklepDok)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPDOK_REF_SKLEP_SKLEP");

            entity.HasOne(d => d.SklepKasa).WithMany(p => p.SklepDok)
                .HasForeignKey(d => new { d.SklepId, d.SklepKasaId })
                .HasConstraintName("FK_SKLEPDOK_REF_SKDOK_SKLEPKAS");

            entity.HasOne(d => d.SklepKontr).WithMany(p => p.SklepDokSklepKontr)
                .HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
                .HasConstraintName("FK_SKLEPDOK_REF_OBROT_SKLEPKON");

            entity.HasOne(d => d.SklepMagazyn).WithMany(p => p.SklepDok)
                .HasForeignKey(d => new { d.SklepId, d.SklepMagId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPDOK_REF_SKDOK_SKLEPMAG");

            entity.HasOne(d => d.SklepKontrNavigation).WithMany(p => p.SklepDokSklepKontrNavigation)
                .HasForeignKey(d => new { d.SklepId, d.SklepPlatnikId })
                .HasConstraintName("FK_SKLEPDOK_REF_OBROT_SKLEPPLAT");

            entity.HasOne(d => d.SklepUzytkownik).WithMany(p => p.SklepDok)
                .HasForeignKey(d => new { d.SklepId, d.SklepUzId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPDOK_REF_SKDOK_SKLEPUZY");

            entity.HasOne(d => d.SklepWaluta).WithMany(p => p.SklepDok)
                .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.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.Kwota).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.SklepDok).WithMany(p => p.SklepDokDodKth)
                .HasForeignKey(d => new { d.SklepId, d.SklepDokId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPDOK_REF_SKDDK_SKLEPDOK");

            entity.HasOne(d => d.SklepKontr).WithMany(p => p.SklepDokDodKth)
                .HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPDOK_REF_SKDKD_SKLEPKON");
        });

        modelBuilder.Entity<SklepDokKurs>(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.SklepDok).WithMany(p => p.SklepDokKurs)
                .HasForeignKey(d => new { d.SklepId, d.SklepDokId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLDOKKURS_SKLEPDOK");

            entity.HasOne(d => d.SklepWaluta).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.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.SklepDok).WithMany(p => p.SklepDokPunkty)
                .HasForeignKey(d => new { d.SklepId, d.SklepDokId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPDOK_REF_SKDOK_SKLEPDOK");
        });

        modelBuilder.Entity<SklepDokWaluta>(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.Property(e => e.WalNetto).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.WalNettoDet).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.WalPodatek).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.WalPodatekDet).HasColumnType("decimal(15, 4)");

            entity.HasOne(d => d.SklepDok).WithMany(p => p.SklepDokWaluta)
                .HasForeignKey(d => new { d.SklepId, d.SklepDokId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPDOK_REF_SKDWZ_SKLEPDOK");

            entity.HasOne(d => d.SklepWaluta).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.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.IleWZgrzewce).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Kod)
                .HasMaxLength(30)
                .IsUnicode(false);
            entity.Property(e => e.RabatOdWart).HasColumnType("decimal(15, 4)");

            entity.HasOne(d => d.SklepKontr).WithMany(p => p.SklepDost)
                .HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPDOS_REF_DOSTS_SKLEPKON");

            entity.HasOne(d => d.SklepTowar).WithMany(p => p.SklepDost)
                .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.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.SklepDzienRozl)
                .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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Dzien).HasColumnType("datetime");
            entity.Property(e => e.Wartosc)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepDzienRozl).WithMany(p => p.SklepDzienRozlParam)
                .HasForeignKey(d => new { d.SklepId, d.Dzien })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SkDzienRozlPar");
        });

        modelBuilder.Entity<SklepEmail>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepEmId });

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepEmId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Haslo)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Host)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.KopiaEmail)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Login)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Nadawca)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.Nazwa)
                .HasMaxLength(60)
                .IsUnicode(false);
            entity.Property(e => e.Port)
                .HasMaxLength(5)
                .IsUnicode(false);
            entity.Property(e => e.SklepTEDId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepTEHRId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepTERId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepTEWId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepTEZIId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepUzId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.SklepTrescEmail).WithMany(p => p.SklepEmailSklepTrescEmail)
                .HasForeignKey(d => new { d.SklepId, d.SklepTEDId })
                .HasConstraintName("FK_SklepEmail_TED");

            entity.HasOne(d => d.SklepTrescEmailNavigation).WithMany(p => p.SklepEmailSklepTrescEmailNavigation)
                .HasForeignKey(d => new { d.SklepId, d.SklepTERId })
                .HasConstraintName("FK_SklepEmail_TER");

            entity.HasOne(d => d.SklepTrescEmail1).WithMany(p => p.SklepEmailSklepTrescEmail1)
                .HasForeignKey(d => new { d.SklepId, d.SklepTEWId })
                .HasConstraintName("FK_SklepEmail_TEW");

            entity.HasOne(d => d.SklepUzytkownik).WithMany(p => p.SklepEmail)
                .HasForeignKey(d => new { d.SklepId, d.SklepUzId })
                .HasConstraintName("FK_SklepEmail_Uz");
        });

        modelBuilder.Entity<SklepFlagi>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.TowId }).HasName("PK_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.DoKiedyPrzyjecie).HasColumnType("datetime");
            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.SklepFlagi)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPFLA_REF_SKLEP_SKLEP");

            entity.HasOne(d => d.Tow).WithMany(p => p.SklepFlagi)
                .HasForeignKey(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPFLA_REF_SKLEP_TOWAR");

            entity.HasMany(d => d.Kontr).WithMany(p => p.SklepFlagi)
                .UsingEntity<Dictionary<string, object>>(
                    "SklepNarzDost",
                    r => r.HasOne<Kontrahent>().WithMany()
                        .HasForeignKey("KontrId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_SKLEPNAR_REF_SKLEP_KONTRAHE"),
                    l => l.HasOne<SklepFlagi>().WithMany()
                        .HasForeignKey("SklepId", "TowId")
                        .OnDelete(DeleteBehavior.ClientSetNull)
                        .HasConstraintName("FK_SKLEPNAR_REF_SKLEP_SKLEPFLA"),
                    j =>
                    {
                        j.HasKey("SklepId", "TowId", "KontrId").HasName("PK_SKLEPNARZDOST");
                        j.HasIndex(new[] { "KontrId" }, "idx_SklepNarzDostKth");
                        j.IndexerProperty<decimal>("SklepId").HasColumnType("numeric(9, 0)");
                        j.IndexerProperty<decimal>("TowId").HasColumnType("numeric(9, 0)");
                        j.IndexerProperty<decimal>("KontrId").HasColumnType("numeric(9, 0)");
                    });
        });

        modelBuilder.Entity<SklepFormZgod>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepTypOsId, e.SklepZgId }).HasName("PK_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.SklepTypOs).WithMany(p => p.SklepFormZgod)
                .HasForeignKey(d => new { d.SklepId, d.SklepTypOsId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKFMZG_SKTYPOS");

            entity.HasOne(d => d.SklepZgoda).WithMany(p => p.SklepFormZgod)
                .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.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)
                .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.SklepFormaPlatnPos7)
                .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.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)
                .HasMaxLength(20)
                .IsUnicode(false);

            entity.HasOne(d => d.Sklep).WithMany(p => p.SklepGrupaAkcyzowa)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SkGrAkc");
        });

        modelBuilder.Entity<SklepGrupaPromocji>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepGrupaId });

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepGrupaId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.GrupaId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Opis)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");
        });

        modelBuilder.Entity<SklepGrupaUz>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepUzId }).HasName("PK_SK_GR_UZ");

            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.SklepUzytkownik).WithMany(p => p.SklepGrupaUzSklepUzytkownik)
                .HasForeignKey(d => new { d.SklepId, d.SklepRolaId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPGRU_REF_SKGRR_SKLEPUZY");

            entity.HasOne(d => d.SklepUzytkownikNavigation).WithOne(p => p.SklepGrupaUzSklepUzytkownikNavigation)
                .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.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.SklepMagazyn).WithMany(p => p.SklepIstw)
                .HasForeignKey(d => new { d.SklepId, d.SklepMagId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPIST_REF_SKMAG_SKLEPMAG");

            entity.HasOne(d => d.SklepTowar).WithMany(p => p.SklepIstw)
                .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.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.SklepKartaLoj)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SKrtLoj_Sklep");

            entity.HasOne(d => d.SklepKontoLoj).WithMany(p => p.SklepKartaLoj)
                .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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepKasaId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.NrUnikatowy)
                .HasMaxLength(30)
                .IsUnicode(false);
            entity.Property(e => e.SklepMagId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Stanowisko)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Typ)
                .HasMaxLength(40)
                .IsUnicode(false);

            entity.HasOne(d => d.Sklep).WithMany(p => p.SklepKasa)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPKAS_REF_SKKAS_SKLEP");

            entity.HasOne(d => d.SklepMagazyn).WithMany(p => p.SklepKasa)
                .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.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.SklepFormaPlatnPos7).WithMany(p => p.SklepKasaFormaPlatn)
                .HasForeignKey(d => new { d.SklepId, d.SklepFormaId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKKASAFORMAPLATN_SKFPP7");

            entity.HasOne(d => d.SklepKasa).WithMany(p => p.SklepKasaFormaPlatn)
                .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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepKBId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.KBId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.Numer)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.PowSklepKBId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepBankId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepKBIdOplat).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)
                .HasMaxLength(10)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.SklepBank).WithMany(p => p.SklepKontoBankowe)
                .HasForeignKey(d => new { d.SklepId, d.SklepBankId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPKONTOBANK_SKLEPBANK");

            entity.HasOne(d => d.SklepWaluta).WithMany(p => p.SklepKontoBankowe)
                .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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepKBKId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.KBKId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.Numer)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.PowSklepKBKId).HasColumnType("numeric(9, 0)");
            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.SklepBank).WithMany(p => p.SklepKontoBankoweKontr)
                .HasForeignKey(d => new { d.SklepId, d.SklepBankId })
                .HasConstraintName("FK_SKLEPKONTOBANKKONTR_SKLEPBANK");

            entity.HasOne(d => d.SklepKontr).WithMany(p => p.SklepKontoBankoweKontr)
                .HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPKONTOBANKKONTR_SKLEPKONTR");

            entity.HasOne(d => d.SklepWaluta).WithMany(p => p.SklepKontoBankoweKontr)
                .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.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.SklepKontoLoj)
                .HasForeignKey(d => d.KontoId)
                .HasConstraintName("Ref_SKLoj_KLoj");

            entity.HasOne(d => d.Sklep).WithMany(p => p.SklepKontoLoj)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SKntLoj_Sklep");

            entity.HasOne(d => d.SklepKontr).WithMany(p => p.SklepKontoLoj)
                .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.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)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.CentrKontrId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.EMail)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.Fax)
                .HasMaxLength(60)
                .IsUnicode(false);
            entity.Property(e => e.IndeksCentr)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Kod)
                .HasMaxLength(10)
                .IsUnicode(false);
            entity.Property(e => e.KodKarty)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.KodKontr)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.KodKraju)
                .HasMaxLength(10)
                .IsUnicode(false);
            entity.Property(e => e.Konto)
                .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)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.NIP)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.NaPrzelewie1)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.NaPrzelewie2)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.NrAnalityki)
                .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)
                .HasMaxLength(80)
                .IsUnicode(false);
            entity.Property(e => e.Rezerwa2)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Skrot)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Telefon)
                .HasMaxLength(60)
                .IsUnicode(false);
            entity.Property(e => e.TermWaznKarty).HasColumnType("datetime");
            entity.Property(e => e.Ulica)
                .HasMaxLength(60)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.Kontr).WithMany(p => p.SklepKontr)
                .HasForeignKey(d => d.KontrId)
                .HasConstraintName("FK_SKLEPKON_REF_KTHSK_KONTRAHE");

            entity.HasOne(d => d.Sklep).WithMany(p => p.SklepKontr)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPKON_REF_SKLEP_SKLEP");
        });

        modelBuilder.Entity<SklepKontrOpis>(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)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepKontr).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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepKontrId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.DataBO).HasColumnType("datetime");
            entity.Property(e => e.KodKraju)
                .HasMaxLength(10)
                .IsUnicode(false);
            entity.Property(e => e.NrSeryjny)
                .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.SklepKontrSklep)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SklKontrSklKontr");
        });

        modelBuilder.Entity<SklepKthTypOs>(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.SklepKontr).WithMany(p => p.SklepKthTypOs)
                .HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKKTHTYPOS_SKKTH");

            entity.HasOne(d => d.SklepTypOs).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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepMagId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(40)
                .IsUnicode(false);

            entity.HasOne(d => d.Sklep).WithMany(p => p.SklepMagazyn)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPMAG_REF_SKMAG_SKLEP");
        });

        modelBuilder.Entity<SklepNotatki>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.Kolejnosc }).HasName("PK_SKLEPNOTATKI");

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepTowar).WithMany(p => p.SklepNotatki)
                .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.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)
                .HasMaxLength(60)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepKontr).WithMany(p => p.SklepNrRej)
                .HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SkNrRejKth");
        });

        modelBuilder.Entity<SklepNrRejKarta>(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.SklepKartaLoj).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<SklepOplata>(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)
                .HasMaxLength(120)
                .IsUnicode(false);
            entity.Property(e => e.OplataId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepKBId).HasColumnType("numeric(9, 0)");
            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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepPanelId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .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).HasDefaultValue((short)3);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.Panel).WithMany(p => p.SklepPanel)
                .HasForeignKey(d => d.PanelId)
                .HasConstraintName("FK_SKLEPPANEL_REFERENCE_PANEL");

            entity.HasOne(d => d.SklepUzytkownik).WithMany(p => p.SklepPanel)
                .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.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)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepPanel).WithMany(p => p.SklepPanelParam)
                .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.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)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Typ)
                .HasMaxLength(10)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepParagon).WithMany(p => p.SklepParBon)
                .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.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.SklepParagon).WithMany(p => p.SklepParPunkty)
                .HasForeignKey(d => new { d.SklepId, d.SklepParId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPPAR_REF_SKPAR_SKLEPPAR");
        });

        modelBuilder.Entity<SklepParWaluta>(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.SklepParagon).WithMany(p => p.SklepParWaluta)
                .HasForeignKey(d => new { d.SklepId, d.SklepParId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPPAR_REF_SKPWZ_SKLEPPAR");

            entity.HasOne(d => d.SklepWaluta).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.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)
                .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)");
            entity.Property(e => e.Gotowka).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.GrupyGTU)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.InneFPlat).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Karta).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Kasjer)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.KodKarty)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.NIP)
                .HasMaxLength(40)
                .IsUnicode(false);
            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.SklepParagon)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPPAR_REF_SKLEP_SKLEP");

            entity.HasOne(d => d.SklepKasa).WithMany(p => p.SklepParagon)
                .HasForeignKey(d => new { d.SklepId, d.SklepKasaId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPPAR_REF_SKPAR_SKLEPKAS");

            entity.HasOne(d => d.SklepWaluta).WithMany(p => p.SklepParagon)
                .HasForeignKey(d => new { d.SklepId, d.SklepWalId })
                .HasConstraintName("FK_SKLEPPAR_REF_SKPAR_SKLEPWAL");
        });

        modelBuilder.Entity<SklepPartia>(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.SklepTowar).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.SklepPartia)
                .HasForeignKey<SklepPartia>(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.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.SklepKontoLoj).WithMany(p => p.SklepPowKontLojSklepKontoLoj)
                .HasForeignKey(d => new { d.SklepId, d.SklepNoweKontoId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SklepNoweKonto");

            entity.HasOne(d => d.SklepKontoLojNavigation).WithMany(p => p.SklepPowKontLojSklepKontoLojNavigation)
                .HasForeignKey(d => new { d.SklepId, d.SklepStareKontoId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SklepStareKonto");
        });

        modelBuilder.Entity<SklepPowiazanieProm>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepPromId, e.SklepGrupaId, e.Rodzaj }).HasName("PK_SklPowiazanieProm");

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepPromId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepGrupaId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.SklepGrupaPromocji).WithMany(p => p.SklepPowiazanieProm)
                .HasForeignKey(d => new { d.SklepId, d.SklepGrupaId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SklPowProm_SklGrupaPromocji");
        });

        modelBuilder.Entity<SklepPowiazanieUz>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepUzId, e.RodzajPow, e.Id }).HasName("PK_SK_POW_UZ");

            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.SklepUzytkownik).WithMany(p => p.SklepPowiazanieUz)
                .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.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.SklepGrupaAkcyzowa).WithMany(p => p.SklepPozAkcyza)
                .HasForeignKey(d => new { d.SklepId, d.SklepGrAkcId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SkAkcPoz");

            entity.HasOne(d => d.SklepPozDok).WithMany(p => p.SklepPozAkcyza)
                .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.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)");
            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.SklepDok).WithMany(p => p.SklepPozDok)
                .HasForeignKey(d => new { d.SklepId, d.SklepDokId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPPOZ_REF_SKPOZ_SKLEPDOK");

            entity.HasOne(d => d.SklepTowar).WithMany(p => p.SklepPozDok)
                .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.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);
            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.SklepParagon).WithMany(p => p.SklepPozPar)
                .HasForeignKey(d => new { d.SklepId, d.SklepParId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPPOZ_REF_SKPOZ_SKLEPPAR");

            entity.HasOne(d => d.SklepTowar).WithMany(p => p.SklepPozPar)
                .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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepParId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.DodInfo)
                .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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepProfilId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .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.SklepProfil)
                .HasForeignKey(d => d.ProfilId)
                .HasConstraintName("FK_SKLEPPROFIL_REFERENCE_PROFIL");

            entity.HasOne(d => d.Sklep).WithMany(p => p.SklepProfil)
                .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.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.SklepProfil).WithMany(p => p.SklepProfilKonfig)
                .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.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)");
            entity.Property(e => e.CenaSpDet).HasColumnType("decimal(15, 4)");
            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.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.SklepMagazyn).WithMany(p => p.SklepPrtMag)
                .HasForeignKey(d => new { d.SklepId, d.SklepMagId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SkPrtMagMagazyn");

            entity.HasOne(d => d.SklepTowar).WithMany(p => p.SklepPrtMag)
                .HasForeignKey(d => new { d.SklepId, d.SklepTowId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SkPrtMagTowar");
        });

        modelBuilder.Entity<SklepRapWartPocz>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepRWPId }).HasName("PK_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)");
            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.SklepRapWartPocz)
                .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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepRWPId).HasColumnType("numeric(9, 0)");
            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.SklepMagazyn).WithMany(p => p.SklepRapWartPoczDane)
                .HasForeignKey(d => new { d.SklepId, d.SklepMagId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPRAPWARTPOCZDANE_REFERENCE_SKLEPMAG");

            entity.HasOne(d => d.SklepRapWartPocz).WithMany(p => p.SklepRapWartPoczDane)
                .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.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.SklepRegula)
                .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.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)
                .HasMaxLength(40)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepRegula).WithMany(p => p.SklepRegulaAsort)
                .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.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.SklepRegulaDok)
                .HasForeignKey(d => d.KontoId)
                .HasConstraintName("Ref_SkRegDokKonto");

            entity.HasOne(d => d.SklepDok).WithMany(p => p.SklepRegulaDok)
                .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.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)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepRegulaDok).WithMany(p => p.SklepRegulaDokSzczeg)
                .HasForeignKey(d => new { d.SklepId, d.SklepDokId, d.SklepRegulaId, d.Kolejnosc })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SklRgDokSzczegSklRgDok");
        });

        modelBuilder.Entity<SklepRegulaKod>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepRegulaId, e.Kod, e.Znaczenie });

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepRegulaId).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.Property(e => e.Informacja)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.NazwaTowaru)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepRegula).WithMany(p => p.SklepRegulaKod)
                .HasForeignKey(d => new { d.SklepId, d.SklepRegulaId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKL_REGULAKOD_REGULA");
        });

        modelBuilder.Entity<SklepRegulaPar>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepParId, e.SklepRegulaId, e.Kolejnosc }).HasName("PK_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.SklepRegulaPar)
                .HasForeignKey(d => d.KontoId)
                .HasConstraintName("Ref_SkRegParKonto");

            entity.HasOne(d => d.SklepParagon).WithMany(p => p.SklepRegulaPar)
                .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.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)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepRegulaPar).WithMany(p => p.SklepRegulaParSzczeg)
                .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.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.SklepRegulaParam)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPREGULAPA_REFERENCE_SKLEP");

            entity.HasOne(d => d.SklepRegula).WithMany(p => p.SklepRegulaParam)
                .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.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.SklepRegulaPozDok)
                .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.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.SklepRegulaPozDokSzczeg)
                .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.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.SklepRegulaPozPar)
                .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.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.SklepRegulaPozParSzczeg)
                .HasForeignKey(d => new { d.SklepId, d.SklepParId, d.Kolejnosc })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SkRegPozPSzPoz");
        });

        modelBuilder.Entity<SklepRegulaTekst>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepRegulaId, e.Znaczenie });

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepRegulaId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepRegula).WithMany(p => p.SklepRegulaTekst)
                .HasForeignKey(d => new { d.SklepId, d.SklepRegulaId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SkRegulaTekst_SkRegula");
        });

        modelBuilder.Entity<SklepRegulaTowar>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepRegulaId, e.SklepTowId, e.Znaczenie }).HasName("PK_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.SklepRegula).WithMany(p => p.SklepRegulaTowar)
                .HasForeignKey(d => new { d.SklepId, d.SklepRegulaId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPREGULATO_REFERENCE_SKLEPREGULA");

            entity.HasOne(d => d.SklepTowar).WithMany(p => p.SklepRegulaTowar)
                .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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.CentrRola).WithMany(p => p.SklepRola)
                .HasForeignKey(d => d.CentrRolaId)
                .HasConstraintName("Ref_SklepRolaRola");

            entity.HasOne(d => d.Sklep).WithMany(p => p.SklepRola)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SklepRolaSklep");
        });

        modelBuilder.Entity<SklepRolaUprawnienie>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepRolaId, e.Rodzaj }).HasName("PK_SKLROLAUPR");

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.SklepRola).WithMany(p => p.SklepRolaUprawnienie)
                .HasForeignKey(d => new { d.SklepId, d.SklepRolaId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SklRolaUprSklRola");
        });

        modelBuilder.Entity<SklepRozPrtMag>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.PMId, e.Znaczenie, e.SklepDokId, e.Kolejnosc }).HasName("PK_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)");
            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.SklepRozPrtMag)
                .HasForeignKey(d => new { d.SklepId, d.SklepDokId, d.Kolejnosc })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SkRozPrtMagPoz");

            entity.HasOne(d => d.SklepPrtMag).WithMany(p => p.SklepRozPrtMag)
                .HasForeignKey(d => new { d.SklepId, d.SklepTowId, d.PMId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SkRozPrtMagPrt");
        });

        modelBuilder.Entity<SklepRozbicieDodDok>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.Znaczenie, e.Stawka }).HasName("PK_SKLROZBDODDOK");

            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.NettoMag).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Podatek).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.PodatekDet).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.PodatekMag).HasColumnType("decimal(15, 4)");

            entity.HasOne(d => d.SklepDok).WithMany(p => p.SklepRozbicieDodDok)
                .HasForeignKey(d => new { d.SklepId, d.SklepDokId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SklepRozbDodDokDok");
        });

        modelBuilder.Entity<SklepRozbicieDok>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepDokId, e.Stawka }).HasName("PK_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.NettoMag).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Podatek).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.PodatekDet).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.PodatekMag).HasColumnType("decimal(15, 4)");

            entity.HasOne(d => d.SklepDok).WithMany(p => p.SklepRozbicieDok)
                .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.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.SklepPartia).WithMany(p => p.SklepRozlPartii)
                .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.SklepRozlPartii)
                .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.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.SklepDok).WithMany(p => p.SklepRozliczaSklepDok)
                .HasForeignKey(d => new { d.RozliczanySklepId, d.RozliczanySklepDokId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPROZ_REF_SKKOG_SKLEPDOK");

            entity.HasOne(d => d.SklepDokNavigation).WithMany(p => p.SklepRozliczaSklepDokNavigation)
                .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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepDKId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(40)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepDefinicjaKodu).WithMany(p => p.SklepSkladnikDefinicjiKodu)
                .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.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)
                .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.SklepTowar).WithMany(p => p.SklepSkladnikWzorca)
                .HasForeignKey(d => new { d.SklepId, d.SklepTowIdWzorca })
                .HasConstraintName("FK_SKSKLADNIKWZORCA_REFERENCE_SKTOWAR");
        });

        modelBuilder.Entity<SklepStanPrtMag>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.Dzien, e.SklepTowId, e.PMId }).HasName("PK_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)");
            entity.Property(e => e.StanPrt).HasColumnType("decimal(15, 4)");

            entity.HasOne(d => d.SklepDzienRozl).WithMany(p => p.SklepStanPrtMag)
                .HasForeignKey(d => new { d.SklepId, d.Dzien })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SkStanPrtDzien");

            entity.HasOne(d => d.SklepPrtMag).WithMany(p => p.SklepStanPrtMag)
                .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.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)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepPrtMag).WithMany(p => p.SklepSzczegPrtMag)
                .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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepDok).WithMany(p => p.SklepTekstDok)
                .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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepDokId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepPozDok).WithMany(p => p.SklepTekstPoz)
                .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.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)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepZgoda).WithMany(p => p.SklepTekstZgody)
                .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.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)");
            entity.Property(e => e.KodCN)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Sklad).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.SklepGrAkcId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.SklepGrupaAkcyzowa).WithMany(p => p.SklepTowAkcyza)
                .HasForeignKey(d => new { d.SklepId, d.SklepGrAkcId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SkAkcTow");

            entity.HasOne(d => d.SklepTowar).WithMany(p => p.SklepTowAkcyza)
                .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.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.SklepTowDodatekSklepTowar)
                .HasForeignKey(d => new { d.SklepId, d.DodSklepTowId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SkDodTow");

            entity.HasOne(d => d.SklepTowarNavigation).WithMany(p => p.SklepTowDodatekSklepTowarNavigation)
                .HasForeignKey(d => new { d.SklepId, d.SklepTowId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SkTowDod");
        });

        modelBuilder.Entity<SklepTowIntParam>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.Znaczenie }).HasName("PK_SKLEPTOWINTPARAM");

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.SklepTowar).WithMany(p => p.SklepTowIntParam)
                .HasForeignKey(d => new { d.SklepId, d.SklepTowId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SkTowIntParamSkTowar");
        });

        modelBuilder.Entity<SklepTowKod>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.Kolejnosc }).HasName("PK_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)");
            entity.Property(e => e.Kod)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Skrot)
                .HasMaxLength(120)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepTowar).WithMany(p => p.SklepTowKod)
                .HasForeignKey(d => new { d.SklepId, d.SklepTowId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPTOW_REF_KODSK_SKLEPTOW");
        });

        modelBuilder.Entity<SklepTowParWiseBase>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.ParId });

            entity.HasIndex(e => e.ParId, "idx_SklepTowParWB_ParId");

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepZasobId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Par).WithMany(p => p.SklepTowParWiseBase)
                .HasForeignKey(d => d.ParId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SklepTowParWB_ParId");

            entity.HasOne(d => d.SklepTowar).WithMany(p => p.SklepTowParWiseBase)
                .HasForeignKey(d => new { d.SklepId, d.SklepTowId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SklepTowParWB_SklepTowId");
        });

        modelBuilder.Entity<SklepTowPowiazanie>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.Znaczenie }).HasName("PK_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.SklepTowPowiazanieSklepTowar)
                .HasForeignKey(d => new { d.SklepId, d.PowSklepTowId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SkPowTowPow_SkTow");

            entity.HasOne(d => d.SklepTowarNavigation).WithMany(p => p.SklepTowPowiazanieSklepTowarNavigation)
                .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.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.SklepTowar).WithMany(p => p.SklepTowStraty)
                .HasForeignKey(d => new { d.SklepId, d.SklepTowId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKTWSTR_TOW");
        });

        modelBuilder.Entity<SklepTowZamiennik>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepTowId }).HasName("PK_SKLEPTOWZAMIENNIK");

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepZmId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.SklepTowar).WithOne(p => p.SklepTowZamiennik)
                .HasForeignKey<SklepTowZamiennik>(d => new { d.SklepId, d.SklepTowId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SklepTowZamiennik_Tow");

            entity.HasOne(d => d.SklepZamiennik).WithMany(p => p.SklepTowZamiennik)
                .HasForeignKey(d => new { d.SklepId, d.SklepZmId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SklepTowZamiennik_Zam");
        });

        modelBuilder.Entity<SklepTowZdjecia>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepTowId, e.Kolejnosc });

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepTowId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepZasobId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.SklepTowar).WithMany(p => p.SklepTowZdjecia)
                .HasForeignKey(d => new { d.SklepId, d.SklepTowId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SkTowZdjecia_SkTow");
        });

        modelBuilder.Entity<SklepTowar>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepTowId }).HasName("PK_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)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.CKU)
                .HasMaxLength(20)
                .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.GrupaGTU)
                .HasMaxLength(3)
                .IsUnicode(false);
            entity.Property(e => e.HurtRabat).HasColumnType("decimal(10, 4)");
            entity.Property(e => e.IleWCalosci).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.IleWOpak).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.IleWZgrzewce).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.JM)
                .HasMaxLength(10)
                .IsUnicode(false);
            entity.Property(e => e.Kategoria)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.KodCN)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.KodKrajuPochodzenia)
                .HasMaxLength(10)
                .IsUnicode(false);
            entity.Property(e => e.KodSklepu)
                .HasMaxLength(30)
                .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)
                .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)
                .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.ProgPromocji).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.PrzeliczJM)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Rezerwa1)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Rezerwa2)
                .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.SklepTowar)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPTOW_REF_SKLEP_SKLEP");

            entity.HasOne(d => d.Tow).WithMany(p => p.SklepTowar)
                .HasForeignKey(d => d.TowId)
                .HasConstraintName("FK_SKLEPTOW_REF_SKLEP_TOWAR");

            entity.HasOne(d => d.SklepArtykulNavigation).WithMany(p => p.SklepTowarNavigation)
                .HasForeignKey(d => new { d.SklepId, d.SklepArtId })
                .HasConstraintName("FK_SKLEPTOW_REF_SKTOW_SKLEPART");

            entity.HasOne(d => d.SklepKontr).WithMany(p => p.SklepTowar)
                .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.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.Ilosc).HasColumnType("decimal(15, 4)");

            entity.HasOne(d => d.SklepSkladnikWzorca).WithMany(p => p.SklepTowarSkladnika)
                .HasForeignKey(d => new { d.SklepId, d.SklepSkWzId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKTOWARSKLADNIKA_REFERENCE_SKSKLADNIKWZORCA");

            entity.HasOne(d => d.SklepTowar).WithMany(p => p.SklepTowarSkladnika)
                .HasForeignKey(d => new { d.SklepId, d.SklepTowId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKTOWARSKLADNIKA_REFERENCE_SKTOWAR");
        });

        modelBuilder.Entity<SklepTrescEmail>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepTEId });

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepTEId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(60)
                .IsUnicode(false);
            entity.Property(e => e.SklepUzId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.SklepUzytkownik).WithMany(p => p.SklepTrescEmail)
                .HasForeignKey(d => new { d.SklepId, d.SklepUzId })
                .HasConstraintName("FK_SklepTrescEmail_Uz");
        });

        modelBuilder.Entity<SklepTrescEmailTekst>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepTEId, e.Kolejnosc, e.Znaczenie });

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepTEId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tresc)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepTrescEmail).WithMany(p => p.SklepTrescEmailTekst)
                .HasForeignKey(d => new { d.SklepId, d.SklepTEId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SklepTrescEmail_Pe");
        });

        modelBuilder.Entity<SklepTypOs>(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)
                .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.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepUzId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.SklepUzytkownik).WithMany(p => p.SklepUprawnienie)
                .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.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)
                .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)
                .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.SklepUzytkownik)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPUZY_REF_SKUZ_SKLEP");

            entity.HasOne(d => d.Uz).WithMany(p => p.SklepUzytkownik)
                .HasForeignKey(d => d.UzId)
                .HasConstraintName("FK_SKLEPUZYTKOWINK_REFERENCE_UZYTKOWNIK");

            entity.HasOne(d => d.SklepProfil).WithMany(p => p.SklepUzytkownik)
                .HasForeignKey(d => new { d.SklepId, d.SklepProfilId })
                .HasConstraintName("FK_SKLEPUZYTKOWINK_REFERENCE_SKLEPPROFIL");
        });

        modelBuilder.Entity<SklepWaluta>(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)
                .HasMaxLength(10)
                .IsUnicode(false);
            entity.Property(e => e.Kurs).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.Nazwa)
                .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.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.SklepDok).WithMany(p => p.SklepZaleznoscSklepDok)
                .HasForeignKey(d => new { d.PoprzedniSklepId, d.PoprzedniSklepDokId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPZAL_REF_SKDOD_SKLEPDOK");

            entity.HasOne(d => d.SklepDokNavigation).WithOne(p => p.SklepZaleznoscSklepDokNavigation)
                .HasForeignKey<SklepZaleznosc>(d => new { d.SklepId, d.SklepDokId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKLEPZAL_REF_SKODD_SKLEPDOK");
        });

        modelBuilder.Entity<SklepZamiennik>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.SklepZmId }).HasName("PK_SKLEPZAMIENNIK");

            entity.Property(e => e.SklepId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepZmId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ZmId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Zmiana).HasColumnType("datetime");
        });

        modelBuilder.Entity<SklepZasob>(entity =>
        {
            entity.HasKey(e => new { e.SklepId, e.Tabela, e.Id, e.Typ }).HasName("PK_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)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Sklep).WithMany(p => p.SklepZasob)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_SklepZasobSklep");
        });

        modelBuilder.Entity<SklepZdarzOs>(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.SklepKontr).WithMany(p => p.SklepZdarzOs)
                .HasForeignKey(d => new { d.SklepId, d.SklepKontrId })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKZDOS_SKKTH");

            entity.HasOne(d => d.SklepTypOs).WithMany(p => p.SklepZdarzOs)
                .HasForeignKey(d => new { d.SklepId, d.SklepTypOsId })
                .HasConstraintName("FK_SKZDOS_SKTPOS");

            entity.HasOne(d => d.SklepUzytkownik).WithMany(p => p.SklepZdarzOs)
                .HasForeignKey(d => new { d.SklepId, d.SklepUzId })
                .HasConstraintName("FK_SKZDOSUZ");

            entity.HasOne(d => d.SklepZgoda).WithMany(p => p.SklepZdarzOs)
                .HasForeignKey(d => new { d.SklepId, d.SklepZgId })
                .HasConstraintName("FK_SKZDOS_SKZG");
        });

        modelBuilder.Entity<SklepZdarzOsOpis>(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)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.SklepZdarzOs).WithMany(p => p.SklepZdarzOsOpis)
                .HasForeignKey(d => new { d.SklepId, d.SklepKontrId, d.Kiedy })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_SKZDOSOPIS");
        });

        modelBuilder.Entity<SklepZgoda>(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)
                .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.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)");
            entity.Property(e => e.SklepID).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CzasID).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.SklepTowID).HasColumnType("numeric(9, 0)");
            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)");
            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.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)");
            entity.Property(e => e.StanPrt).HasColumnType("decimal(15, 4)");

            entity.HasOne(d => d.DzienNavigation).WithMany(p => p.StanPrtMag)
                .HasForeignKey(d => d.Dzien)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_StanPrtDzien");

            entity.HasOne(d => d.PrtMag).WithMany(p => p.StanPrtMag)
                .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.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)
                .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.StanZgody)
                .HasForeignKey(d => d.KontrId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_STZG_KTH");

            entity.HasOne(d => d.Zg).WithMany(p => p.StanZgody)
                .HasForeignKey(d => d.ZgId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_STZG_ZG");
        });

        modelBuilder.Entity<Struktura_7_3>(entity =>
        {
            entity.HasKey(e => e.ModId).HasName("PK_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<Subsys>(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)");
            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.Subsys)
                .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.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.PMId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.PrtMag).WithMany(p => p.SzczegPrtMag)
                .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.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.TabelaAkcyzowa)
                .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.HasIndex(e => new { e.Tekst, e.Znaczenie }, "idx_TekstDokTekstZnaczenie");

            entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Dok).WithMany(p => p.TekstDok)
                .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.HasIndex(e => e.Znaczenie, "idx_TekstPoz_Znaczenie");

            entity.Property(e => e.DokId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.PozDok).WithMany(p => p.TekstPoz)
                .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.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)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.Zg).WithMany(p => p.TekstZgody)
                .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.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)");
            entity.Property(e => e.KodCN)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Sklad).HasColumnType("decimal(15, 4)");

            entity.HasOne(d => d.GrAkc).WithMany(p => p.TowAkcyza)
                .HasForeignKey(d => d.GrAkcId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_AkcTow");

            entity.HasOne(d => d.Tow).WithMany(p => p.TowAkcyza)
                .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.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.TowDodatekDodTow)
                .HasForeignKey(d => d.DodTowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_DodTow");

            entity.HasOne(d => d.Tow).WithMany(p => p.TowDodatekTow)
                .HasForeignKey(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_TowDod");
        });

        modelBuilder.Entity<TowIntParam>(entity =>
        {
            entity.HasKey(e => new { e.TowId, e.Znaczenie }).HasName("PK_TOWIntPARAM");

            entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.Tow).WithMany(p => p.TowIntParam)
                .HasForeignKey(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_TowIntParamTowar");
        });

        modelBuilder.Entity<TowKraj>(entity =>
        {
            entity.HasKey(e => new { e.TowId, e.KrajId }).HasName("PK_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(255)
                .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(120)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.Kraj).WithMany(p => p.TowKraj)
                .HasForeignKey(d => d.KrajId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_Ref_KrajTow");

            entity.HasOne(d => d.Tow).WithMany(p => p.TowKraj)
                .HasForeignKey(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_Ref_TowKraj");
        });

        modelBuilder.Entity<TowParWiseBase>(entity =>
        {
            entity.HasKey(e => new { e.TowId, e.ParId });

            entity.HasIndex(e => e.ParId, "idx_TowParWB_ParId");

            entity.HasIndex(e => e.ZasobId, "idx_TowParWB_ZasobId");

            entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ParId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.ZasobId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.Par).WithMany(p => p.TowParWiseBase)
                .HasForeignKey(d => d.ParId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_TowParWB_ParId");

            entity.HasOne(d => d.Tow).WithMany(p => p.TowParWiseBase)
                .HasForeignKey(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_TowParWB_TowId");
        });

        modelBuilder.Entity<TowPowiazanie>(entity =>
        {
            entity.HasKey(e => new { e.TowId, e.Znaczenie }).HasName("PK_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.TowPowiazaniePowTow)
                .HasForeignKey(d => d.PowTowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_PowTowPow_Tow");

            entity.HasOne(d => d.Tow).WithMany(p => p.TowPowiazanieTow)
                .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.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.TowStraty)
                .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.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.TowStratyDlaSklepu)
                .HasForeignKey(d => d.SklepId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_TWSTRSKL_SKL");

            entity.HasOne(d => d.TowStraty).WithMany(p => p.TowStratyDlaSklepu)
                .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.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.TowWartosc)
                .HasForeignKey(d => d.ParId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_TOWWARTO_REF_PARTO_PARAMETR");

            entity.HasOne(d => d.Tow).WithMany(p => p.TowWartosc)
                .HasForeignKey(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_TOWWARTO_REF_TOWWA_TOWAR");
        });

        modelBuilder.Entity<TowZamiennik>(entity =>
        {
            entity.HasKey(e => e.TowId).HasName("PK_TOWZAMIENNIK");

            entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ZmId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.Tow).WithOne(p => p.TowZamiennik)
                .HasForeignKey<TowZamiennik>(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_TowZamiennik_Tow");

            entity.HasOne(d => d.Zm).WithMany(p => p.TowZamiennik)
                .HasForeignKey(d => d.ZmId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_TowZamiennik_Zam");
        });

        modelBuilder.Entity<TowZdjecia>(entity =>
        {
            entity.HasKey(e => new { e.TowId, e.Kolejnosc });

            entity.HasIndex(e => e.ZasobId, "idx_TowZdjecia_ZasobId");

            entity.Property(e => e.TowId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ZasobId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.Tow).WithMany(p => p.TowZdjecia)
                .HasForeignKey(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_TowZdjecia_TowId");
        });

        modelBuilder.Entity<Towar>(entity =>
        {
            entity.HasKey(e => e.TowId).HasName("PK_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)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ArtId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.AsId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CKU)
                .HasMaxLength(20)
                .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.GrupaGTU)
                .HasMaxLength(3)
                .IsUnicode(false);
            entity.Property(e => e.HurtRabat).HasColumnType("decimal(10, 4)");
            entity.Property(e => e.IleWCalosci).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.IleWZgrzewce).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.JMId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.KatId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Kod)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.KodCN)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.KodSklepu)
                .HasMaxLength(30)
                .IsUnicode(false);
            entity.Property(e => e.KodZgrzewki)
                .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)
                .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)
                .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.Producent).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ProgPromocji).HasColumnType("decimal(15, 4)");
            entity.Property(e => e.PrzeliczJM)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.Rezerwa1)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Rezerwa2)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Skrot)
                .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.Towar)
                .HasForeignKey(d => d.ArtId)
                .HasConstraintName("FK_TOWAR_REF_TOWAR_ARTYKUL");

            entity.HasOne(d => d.As).WithMany(p => p.Towar)
                .HasForeignKey(d => d.AsId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_TOWAR_REF_TOWAS_ASORT");

            entity.HasOne(d => d.JM).WithMany(p => p.Towar)
                .HasForeignKey(d => d.JMId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_TOWAR_REF_TOWJM_JM");

            entity.HasOne(d => d.Kat).WithMany(p => p.Towar)
                .HasForeignKey(d => d.KatId)
                .HasConstraintName("FK_TOWAR_REF_TOWKA_KATEGORI");

            entity.HasOne(d => d.KrajIdPochodzeniaNavigation).WithMany(p => p.Towar)
                .HasForeignKey(d => d.KrajIdPochodzenia)
                .HasConstraintName("FK_Ref_TowarKrajPochodzenia");

            entity.HasOne(d => d.ProducentNavigation).WithMany(p => p.Towar)
                .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.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.Ilosc).HasColumnType("decimal(15, 4)");

            entity.HasOne(d => d.SkWz).WithMany(p => p.TowarSkladnika)
                .HasForeignKey(d => d.SkWzId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_TOWARSKLADNIKA_REFERENCE_SKLADNIKWZORCA");

            entity.HasOne(d => d.Tow).WithMany(p => p.TowarSkladnika)
                .HasForeignKey(d => d.TowId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_TOWARSKLADNIKA_REFERENCE_TOWAR");
        });

        modelBuilder.Entity<TrescEmail>(entity =>
        {
            entity.HasKey(e => e.TEId);

            entity.Property(e => e.TEId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(60)
                .IsUnicode(false);
            entity.Property(e => e.UzId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.Uz).WithMany(p => p.TrescEmail)
                .HasForeignKey(d => d.UzId)
                .HasConstraintName("FK_TrescEmail_Uz");
        });

        modelBuilder.Entity<TrescEmailTekst>(entity =>
        {
            entity.HasKey(e => new { e.TEId, e.Kolejnosc, e.Znaczenie });

            entity.Property(e => e.TEId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tresc)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.TE).WithMany(p => p.TrescEmailTekst)
                .HasForeignKey(d => d.TEId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_TrescEmail_Pe");
        });

        modelBuilder.Entity<TypOs>(entity =>
        {
            entity.HasKey(e => e.TypOsId).HasName("PK_TYPOS");

            entity.HasIndex(e => e.Zmiana, "idx_TYPOS_ZMIANA");

            entity.Property(e => e.TypOsId)
                .ValueGeneratedOnAdd()
                .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)
                .HasMaxLength(60)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");
        });

        modelBuilder.Entity<Ulica>(entity =>
        {
            entity.HasKey(e => e.UlId);

            entity.Property(e => e.UlId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.MId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Zmiana).HasColumnType("datetime");

            entity.HasOne(d => d.MIdNavigation).WithMany(p => p.Ulica)
                .HasForeignKey(d => d.MId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_Ulica_MId");
        });

        modelBuilder.Entity<Uprawnienie>(entity =>
        {
            entity.HasKey(e => new { e.UzId, e.Rodzaj }).HasName("PK_UPRAWNIENIE");

            entity.Property(e => e.UzId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.Uz).WithMany(p => p.Uprawnienie)
                .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.Property(e => e.UzNSId).HasColumnType("numeric(9, 0)");

            entity.HasOne(d => d.UzNS).WithMany(p => p.UprawnienieNaSklep)
                .HasForeignKey(d => d.UzNSId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("Ref_UprNaSklepUzNaSklep");
        });

        modelBuilder.Entity<UzNaSklep>(entity =>
        {
            entity.HasKey(e => e.UzNSId).HasName("PK_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)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Haslo)
                .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)
                .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)
                .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.UzNaSklep)
                .HasForeignKey(d => d.SklepId)
                .HasConstraintName("Ref_UzNaSklepSklep");

            entity.HasOne(d => d.SklepUzytkownik).WithMany(p => p.UzNaSklep)
                .HasForeignKey(d => new { d.SklepId, d.SklepUzId })
                .HasConstraintName("Ref_UzNaSklepSklepUz");
        });

        modelBuilder.Entity<Uzytkownik>(entity =>
        {
            entity.HasKey(e => e.UzId).HasName("PK_UZYTKOWNIK");

            entity.HasIndex(e => e.CentrUzId, "idx_CentrUzId");

            entity.Property(e => e.UzId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrUzId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrUzNSId).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)
                .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)
                .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.Uzytkownik)
                .HasForeignKey(d => d.ProfilId)
                .HasConstraintName("FK_UZYTKOWINK_REFERENCE_PROFIL");
        });

        modelBuilder.Entity<Vat>(entity =>
        {
            entity.HasKey(e => e.Stawka).HasName("PK_VAT");

            entity.Property(e => e.Stawka).ValueGeneratedNever();
        });

        modelBuilder.Entity<Waluta>(entity =>
        {
            entity.HasKey(e => e.WalId).HasName("PK_WALUTA");

            entity.HasIndex(e => e.CentrWalId, "idx_CentrWalId");

            entity.Property(e => e.WalId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrWalId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Kod)
                .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)
                .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<Wersja_7_2>(entity =>
        {
            entity.HasKey(e => e.Upgrade).HasName("PK_WERSJA_7_2");

            entity.Property(e => e.Upgrade).ValueGeneratedNever();
            entity.Property(e => e.Nazwa)
                .HasMaxLength(255)
                .IsUnicode(false);
        });

        modelBuilder.Entity<Wzorzec>(entity =>
        {
            entity.HasKey(e => e.WzId).HasName("PK_WZORZEC");

            entity.HasIndex(e => e.CentrWzId, "idx_CentrWzId");

            entity.Property(e => e.WzId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrWzId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Nazwa)
                .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.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.ZaleznoscPoprzedniDok)
                .HasForeignKey(d => d.PoprzedniDokId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_ZALEZNOS_REF_DODOK_DOK");
        });

        modelBuilder.Entity<Zamiennik>(entity =>
        {
            entity.HasKey(e => e.ZmId).HasName("PK_ZAMIENNIK");

            entity.Property(e => e.ZmId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            entity.Property(e => e.CentrZmId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Zmiana).HasColumnType("datetime");
        });

        modelBuilder.Entity<Zasob>(entity =>
        {
            entity.HasKey(e => new { e.Tabela, e.Id, e.Typ }).HasName("PK_ZASOB");

            entity.Property(e => e.Id).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Typ)
                .HasMaxLength(40)
                .IsUnicode(false);
            entity.Property(e => e.Sciezka)
                .HasMaxLength(255)
                .IsUnicode(false);
        });

        modelBuilder.Entity<ZdarzLoj>(entity =>
        {
            entity.HasKey(e => e.ZdarzLojId).HasName("PK_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.HasIndex(e => e.TransUUID, "IxZdarzLoj_TransUUID");

            entity.Property(e => e.ZdarzLojId)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            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);

            entity.HasOne(d => d.Karta).WithMany(p => p.ZdarzLoj)
                .HasForeignKey(d => d.KartaId)
                .HasConstraintName("Ref_ZdarzKarta");

            entity.HasOne(d => d.Konto).WithMany(p => p.ZdarzLoj)
                .HasForeignKey(d => d.KontoId)
                .HasConstraintName("Ref_ZdarzKonto");
        });

        modelBuilder.Entity<ZdarzOs>(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<ZdarzOsOpis>(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)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.ZdarzOs).WithMany(p => p.ZdarzOsOpis)
                .HasForeignKey(d => new { d.KontrId, d.Kiedy })
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_ZDOSOPIS");
        });

        modelBuilder.Entity<Zgoda>(entity =>
        {
            entity.HasKey(e => e.ZgId).HasName("PK_ZGODA");

            entity.HasIndex(e => e.Zmiana, "idx_ZG_ZMIANA");

            entity.Property(e => e.ZgId)
                .ValueGeneratedOnAdd()
                .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)
                .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.Property(e => e.KasaId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.ZlecId).HasColumnType("numeric(9, 0)");
            entity.Property(e => e.Tekst)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Zlecenie).WithMany(p => p.ZlecKomunikat)
                .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.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)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Zlecenie).WithMany(p => p.ZlecParam)
                .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.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.Zlecenie)
                .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.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)
                .ValueGeneratedOnAdd()
                .HasColumnType("numeric(9, 0)");
            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)
                .HasMaxLength(40)
                .IsUnicode(false);

            entity.HasOne(d => d.Sesja).WithMany(p => p.Zmiana)
                .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.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.ZmianaTabeli)
                .HasForeignKey(d => d.ZmId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK_ZMIANATA_REF_ZMTAB_ZMIANA");
        });

        OnModelCreatingPartial(modelBuilder);
    }

    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
