-- phpMyAdmin SQL Dump
-- version 5.2.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: May 13, 2025 at 06:33 PM
-- Server version: 10.5.26-MariaDB-log
-- PHP Version: 8.2.28

SET FOREIGN_KEY_CHECKS=0;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `ulahkotnostsi_karpo-si`
--

-- --------------------------------------------------------

--
-- Table structure for table `addresses`
--

CREATE TABLE `addresses` (
  `id` int(10) UNSIGNED NOT NULL,
  `md5` varchar(32) DEFAULT NULL COMMENT 'MD5 celotnega zapisa (brez polja id).',
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Status naslova.',
  `title` tinyint(4) DEFAULT NULL COMMENT 'Spol oz. nagovor stranke.',
  `first_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Ime osebe. Če stranka ni oseba, pusti prazno.',
  `last_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Priimek osebe. Če stranka ni oseba, pusti prazno.',
  `company` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Naziv organizacije, npr. naziv šole, ime podjetja.',
  `street_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID ulica iz sistema ulic.',
  `street` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Naziv ulice. Če ne gre drugače, je lahko zraven tudi hišna številka.',
  `house_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID hiše iz sistema ulic.',
  `house_no` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Hišna številka.',
  `address_line_2` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Dodatno polje za naslov.',
  `city_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID kraja iz sistema ulic.',
  `zip` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Poštna številka.',
  `city` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Naziv kraja.',
  `state` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Regija, zvezna država, provinca, …',
  `country` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Država.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `banks`
--

CREATE TABLE `banks` (
  `id` tinyint(3) UNSIGNED NOT NULL,
  `oznaka` varchar(2) NOT NULL COMMENT 'Oznaka banke (5. in 6. mesto v IBAN)',
  `bic` varchar(255) NOT NULL COMMENT 'BIC banke.',
  `naziv` varchar(255) DEFAULT NULL COMMENT 'Naziv banke.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `cache`
--

CREATE TABLE `cache` (
  `key` varchar(255) NOT NULL,
  `value` mediumtext NOT NULL,
  `expiration` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `cache_locks`
--

CREATE TABLE `cache_locks` (
  `key` varchar(255) NOT NULL,
  `owner` varchar(255) NOT NULL,
  `expiration` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `cash_registers`
--

CREATE TABLE `cash_registers` (
  `id` int(10) UNSIGNED NOT NULL,
  `identifier` varchar(255) NOT NULL COMMENT 'Oznaka blagajne - identična oznaki lokacije v Furs aplikaciji.',
  `city_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Kraj izdaje računa na blagajni.',
  `public_ip` varchar(255) DEFAULT NULL COMMENT 'Javni IP - določimo blagajne v fizični poslovni enoti. Če IP ni vpisan, je blagajna mobilna',
  `local_ip` varchar(255) DEFAULT NULL COMMENT 'Lokalni IP. Preverja se v JS delu. Če se zapis sklada z lokalnim ip-jem računalnika, se ta zapis servira formi kot izbrana blagajna',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `cities`
--

CREATE TABLE `cities` (
  `id` int(10) UNSIGNED NOT NULL,
  `city` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Naziv kraja.',
  `zip` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'Poštna številka.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `clients`
--

CREATE TABLE `clients` (
  `id` int(10) UNSIGNED NOT NULL,
  `position` int(10) UNSIGNED DEFAULT NULL,
  `parent_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Če stranka spada k določeni drugi stranki, sem vpišem id te stranke.',
  `status` tinyint(4) NOT NULL DEFAULT 0,
  `company` varchar(255) DEFAULT NULL COMMENT 'Kratek naziv podjetja ali organizacije.',
  `name` varchar(255) DEFAULT NULL COMMENT 'Naziv stranke. Vpišite poln naziv podjetja ali organizacije, kot se mora pojaviti na računu.',
  `street` varchar(255) DEFAULT NULL COMMENT 'Ulica in hišna številka.',
  `address_line_2` varchar(255) DEFAULT NULL COMMENT 'Dodatno polje za naslov stranke.',
  `zip` varchar(255) DEFAULT NULL COMMENT 'Poštna številka.',
  `city` varchar(255) DEFAULT NULL COMMENT 'Kraj.',
  `email` varchar(255) DEFAULT NULL COMMENT 'E-mail naslov stranke. Če ni za posamične primere določeno drugače, se maili pošiljajo iz tega naslova.',
  `phone` varchar(64) DEFAULT NULL COMMENT 'Splošna telefonska številka stranke. Samodejno se uporabi, kjer je potrebno.',
  `remark` text DEFAULT NULL,
  `identifier` varchar(255) NOT NULL COMMENT 'Unikatna oznaka stranke. Dobiš jo iz Site::Client() metode',
  `country_id` int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Osnovna država, v kateri deluje stranka. Naslov stranke je v tej državi.',
  `plan` tinyint(4) DEFAULT NULL COMMENT 'Naročniški paket stranke.',
  `plan_valid_to` datetime DEFAULT NULL COMMENT 'Datum, do katerega velja naročniški paket stranke',
  `google_tag_manager_code` varchar(255) DEFAULT NULL COMMENT 'Številka stranke za google tag manager, npr. GTM-5XLM4JS.',
  `google_tag` varchar(255) DEFAULT NULL COMMENT 'Google Tag koda za Google Analytics (in v prihodnosti še za kaj). Vpišite kodo, ki jo dobite, ko ustvarjate Google Analytics property, npr. G-M76QDXRV4V. Če imate Google Tag Manager in če ste v njem nastavili Google Analytics, potem pustite to polje prazno in nastavite polje Google Tag Manager Code!',
  `test_site` tinyint(4) DEFAULT NULL COMMENT 'Ali ima stranka testno stran? Opcije za to so v tables.php.',
  `wizard_form_submission_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID oddaje obrazca, s katerim je bila narejena stran.',
  `wizard_created_at` datetime DEFAULT NULL COMMENT 'Datum izvedbe čarovnika za postavitev strani (če je bila stran postavljena z SetupWizard).',
  `plan_extension_request_at` datetime DEFAULT NULL COMMENT 'Datum zahtevka za podaljšanje veljavnosti strani (velja za zastonj stranke) .',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `contents`
--

CREATE TABLE `contents` (
  `id` int(10) UNSIGNED NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `contentable_id` int(10) UNSIGNED NOT NULL,
  `contentable_type` varchar(128) NOT NULL,
  `type` tinyint(4) DEFAULT NULL COMMENT 'Tip vsebine (besedila).',
  `html` text DEFAULT NULL COMMENT 'HTML zapis vsebine (besedila).',
  `plain` text DEFAULT NULL COMMENT 'Plain text verzija vsebine (besedila). Uporabljamo za iskanje po strani in se vedno vpiše samodejno.',
  `session_id` varchar(255) DEFAULT NULL COMMENT 'Če vsebina velja samo za določeni session_id (npr. za testiranje urejanja), sem vpišite ta session_id.',
  `template_id` tinyint(4) DEFAULT NULL COMMENT 'Predloga besedila, ki je bila uporabljena pri vstavljanju elementa. Na osnovi tega lahko novim enakim elementom vstavimo vzorčno besedilo.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by_id` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `counters`
--

CREATE TABLE `counters` (
  `id` int(10) UNSIGNED NOT NULL,
  `type` tinyint(4) NOT NULL COMMENT 'Tip števca. Tipi števcev so v Prefs.',
  `scope` varchar(255) DEFAULT NULL COMMENT 'Dodatne vrednosti, na osnovi katerih definiramo posamični tip števca. Imena polj morajo biti definirana v Prefs.',
  `year` smallint(6) DEFAULT NULL COMMENT 'Leto, na katero se nanaša števec. Če se števec ne nanaša na leto, je vrednost NULL.',
  `last_value` int(10) UNSIGNED DEFAULT NULL COMMENT 'Zadnja uporabljena vrednost števca. Naslednji zapis mora dobiti za 1 večjo vrednost.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `countries`
--

CREATE TABLE `countries` (
  `id` int(10) UNSIGNED NOT NULL,
  `position` int(10) UNSIGNED DEFAULT NULL COMMENT 'Pozicija jezika.',
  `status` tinyint(4) NOT NULL DEFAULT 0,
  `code2` varchar(2) NOT NULL COMMENT 'Dvomestna jezikovna koda po standardu ISO 3166-1.',
  `code3` varchar(3) NOT NULL COMMENT 'Trimestna jezikovna koda po standardu ISO 3166-1.',
  `cc_tld` varchar(5) NOT NULL COMMENT 'Vrhnja spletna domena države (ccTLD)',
  `name` varchar(255) NOT NULL COMMENT 'Naziv države v angleščini, npr. za Nemčijo je to Germany.',
  `local_name` varchar(255) NOT NULL COMMENT 'Naziv države v jeziku države, npr. za Nemčijo je to Deutschland.',
  `flag_image` varchar(255) DEFAULT NULL COMMENT 'Pot do zastave jezika, če naj bo drugačna, kot jo dodeli sistem sam. Pot se mora začeti z znakom /.',
  `language_code` varchar(2) NOT NULL COMMENT 'Dvomestna oznaka jezika države po standardu ISO 639.',
  `language_name` varchar(255) DEFAULT NULL COMMENT 'Naziv jezika v angleščini, npr. German.',
  `local_language_name` varchar(255) DEFAULT NULL COMMENT 'Naziv jezika v v jeziku države, npr. Deutsch.',
  `currency_symbol` varchar(255) DEFAULT NULL COMMENT 'Simbol valute, kot se izpiše na spletni strani in v Monimi, npr. €.',
  `currency_code` varchar(255) DEFAULT NULL COMMENT 'Koda valute, kot jo uporabimo v komunikaciji z drugimi strežniki, npr. EUR.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `coupons`
--

CREATE TABLE `coupons` (
  `id` int(10) UNSIGNED NOT NULL,
  `position` int(10) UNSIGNED DEFAULT NULL COMMENT 'Pozicija kupona v seznamu. Ob kreiranju naj bo enaka kot id.',
  `parent_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id starša kupona (če znotraj enega kupona kreiramo kupone z različnimi unique številkami.',
  `code` varchar(32) NOT NULL COMMENT 'Koda kupona. Mora biti unikatna (torej se ne sme nikoli ponoviti).',
  `description` text DEFAULT NULL COMMENT 'Opis kupona.',
  `valid_from` timestamp NULL DEFAULT NULL COMMENT 'Datum in čas, od katerega naprej velja kupon. Pustite prazno, če naj začne veljati takoj.',
  `valid_to` timestamp NULL DEFAULT NULL COMMENT 'Datum in čas, do katerega velja kupon. Pustite prazno, če naj kupon velja trajno.',
  `use_max_times` smallint(5) UNSIGNED DEFAULT NULL COMMENT 'Koliko krat lahko stranke uporabijo (unovčijo) posamičen kupon. Kupon se šteje za uporabljen, ko zanj obstaja vsaj en izdan dokument (naročilo, predračun, račun, ...).',
  `used_times` int(11) DEFAULT NULL COMMENT 'Koliko krat je bil kupon doslej uporabljen (unovčen). Kupon se šteje za uporabljen, ko zanj obstaja vsaj en izdan dokument (naročilo, predračun, račun, ...).',
  `voucher_amount` decimal(10,4) DEFAULT NULL COMMENT 'Znesek dobropisa, ki ga prinaša kupon.',
  `free_shipping` tinyint(4) DEFAULT NULL COMMENT 'Ali kupon prinaša tudi brezplačno poštnino?.',
  `free_shipping_above` decimal(10,4) DEFAULT NULL COMMENT 'Če je vpisan znesek, se brezplačna poštnina upošteva šele, če je skupni znesek naročila višji ali enak vpisanemu znesku.',
  `discount_pricelist_id` smallint(5) UNSIGNED DEFAULT NULL COMMENT 'Kateri cenik se uporabi, ko uporabnik vpiše kupon? V ceniku nastavite vse popuste oz. cene, nato pa ga izberete tukaj. Cenik mora biti veljaven datumsko in za ustrezen tip naročila (tip veljavnosti mora biti 1 - Dovoljen).',
  `min_quantity` tinyint(4) DEFAULT NULL COMMENT 'Najmanjša količina izdelkov, ki mora biti v košarici, da se kupon upošteva.',
  `min_amount` decimal(10,4) DEFAULT NULL COMMENT 'Najmanjši znesek izdelkov, ki mora biti v košarici, da se kupon upošteva. V znesek izdelkov se ne upošteva poštnina.',
  `locked` tinyint(4) DEFAULT NULL COMMENT 'Ali je ta kupon zaklenjen? Zaklenjenih kuponov ni mogoče vpisati pri oddaji naročila, ampak samo preko posebnih obrazcev, npr. Hitro naročanje. Zaklenjenih kuponov prav tako ni mogoče odstraniti iz košarice.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `extra_attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `coupon_document`
--

CREATE TABLE `coupon_document` (
  `id` int(10) UNSIGNED NOT NULL,
  `coupon_id` int(10) UNSIGNED NOT NULL COMMENT 'coupons table - id.',
  `document_id` int(10) UNSIGNED NOT NULL COMMENT 'documents table - id.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `coupon_item`
--

CREATE TABLE `coupon_item` (
  `id` int(10) UNSIGNED NOT NULL,
  `coupon_id` int(10) UNSIGNED NOT NULL,
  `item_id` int(10) UNSIGNED NOT NULL,
  `type` tinyint(4) NOT NULL COMMENT 'Tip izdelka v kuponu (promocijski, izločen, naštet).',
  `price` decimal(10,4) NOT NULL DEFAULT 0.0000 COMMENT 'Posebna promocijska cena izdelka, če ponujamo izdelek po promocijski ceni.',
  `quantity` decimal(7,4) NOT NULL DEFAULT 1.0000 COMMENT 'Privzeta količina izdelka, če se samodejno dodaja.',
  `max_quantity` decimal(7,4) DEFAULT NULL COMMENT 'Največja količina izdelka, ki ga lahko stranka dobi ali kupi po posebni ceni iz kupona.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `couriers`
--

CREATE TABLE `couriers` (
  `id` tinyint(3) UNSIGNED NOT NULL,
  `position` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Za sortiranje.',
  `parent_id` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Glavna dostavna služba, če je ta dostavna služba samo del druge dostavne službe, npr. Paketomat.',
  `name` varchar(255) NOT NULL COMMENT 'Naziv dostavne službe.',
  `web_label` varchar(255) DEFAULT NULL COMMENT 'Naziv dostavne službe na spletni strani. če pustite prazno, se prikaže naziv dostavne službe.',
  `pos` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Ali dostavno službo lahko izberejo v prodajalni?.',
  `remote` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Ali dostavno službo lahko izberejo v prodaji na daljavo (spletna trgovina)?.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `courier_services`
--

CREATE TABLE `courier_services` (
  `id` tinyint(3) UNSIGNED NOT NULL,
  `courier_id` tinyint(3) UNSIGNED NOT NULL COMMENT 'Id dostavne službe.',
  `description` text DEFAULT NULL COMMENT 'Opis storitve.',
  `service_code` varchar(255) DEFAULT NULL COMMENT 'Črkovna oznaka storitve, določena s strani dostavne službe - se praviloma izpiše na spremnici.',
  `price` decimal(10,4) DEFAULT NULL COMMENT 'Cena storitve. Če je variabilna, pusti prazno in napiši ustrezno funkcijo.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `courier_service_fees`
--

CREATE TABLE `courier_service_fees` (
  `id` int(10) UNSIGNED NOT NULL,
  `courier_service_id` int(10) UNSIGNED NOT NULL,
  `valid_from` timestamp NULL DEFAULT NULL COMMENT 'Od kdaj naprej velja poštnina. Pustite prazno, če naj začne veljati takoj.',
  `valid_to` timestamp NULL DEFAULT NULL COMMENT 'Do kdaj velja poštnina. Pustite prazno, če naj velja neomejeno.',
  `mass_from` int(11) DEFAULT NULL COMMENT 'Masa, od katere naprej velja poštnina (v gramih).',
  `mass_to` int(11) DEFAULT NULL COMMENT 'Masa, do vključno katere velja poštnina.',
  `fee` decimal(10,4) DEFAULT NULL COMMENT 'Znesek poštnine za paket te mase.',
  `fee_when_same_address` decimal(10,4) DEFAULT NULL COMMENT 'Znesek poštnine za paket te mase, če gre za naslednji paket za istega naslovnika.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `customers`
--

CREATE TABLE `customers` (
  `id` int(10) UNSIGNED NOT NULL,
  `customer_no` varchar(50) DEFAULT NULL COMMENT 'Številka kupca. Če stranka nima številke kupca, pusti prazno.',
  `external_customer_no` varchar(20) DEFAULT NULL COMMENT 'Zunanja številka stranke (npr. članska št. društva ipd).',
  `courier_id` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Dostavna služba, ki ji pripada bencinski servis/paketomat/etc.. Pomembno samo pri type > 100.',
  `type` tinyint(4) NOT NULL COMMENT 'Tip stranke. Glej translations.',
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Status stranke.',
  `source_id` smallint(5) UNSIGNED DEFAULT NULL COMMENT 'ID vira naslova.',
  `email` varchar(255) DEFAULT NULL COMMENT 'E-mail naslov stranke. S tem se tudi prijavlja v sistem.',
  `email_2` varchar(255) DEFAULT NULL COMMENT 'Drugi email naslov stranke.',
  `email_3` varchar(255) DEFAULT NULL COMMENT 'Tretji email naslov stranke.',
  `www` varchar(255) DEFAULT NULL COMMENT 'Spletna stran',
  `gdpr_allowed` tinyint(4) DEFAULT NULL COMMENT 'Ali je stranka dovolila oz. prepovedala pošiljanje komercialnih sporočil v skladu z uredbo GDPR (t.i. soglasje)?',
  `gdpr_allowed_source` int(10) UNSIGNED DEFAULT NULL COMMENT 'Vir, iz katerega je bilo poslano soglasje/prepoved v skladu z uredbo GDPR. Praviloma je to številka obrazca.',
  `gdpr_allowed_at` timestamp NULL DEFAULT NULL COMMENT 'Kdaj nam je stranka nazadnje poslala soglasje/prepoved v skladu z uredbo GDPR?',
  `gdpr_allowed_ip_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Ip naslov, iz katerega je stranka poslala soglasje/prepoved v skladu z uredbo GDPR?',
  `address_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID naslova. Naslovi so v ločeni tabeli.',
  `mobile` varchar(255) DEFAULT NULL COMMENT 'Mobilna telefonska številka. Dovoljena je samo ena številka.',
  `mobile_2` varchar(255) DEFAULT NULL COMMENT 'Druga mobilna telefonska številka. V polju je dovoljena samo ena telefonska številka.',
  `mobile_3` varchar(255) DEFAULT NULL COMMENT 'Tretja mobilna telefonska številka. V polju je dovoljena samo ena telefonska številka.',
  `phone` varchar(255) DEFAULT NULL COMMENT 'Stacionarna telefonska številka. Dovoljena je samo ena številka.',
  `phone_2` varchar(255) DEFAULT NULL COMMENT 'Druga stacionarna telefonska številka. V polju je dovoljena samo ena telefonska številka.',
  `phone_3` varchar(255) DEFAULT NULL COMMENT 'Tretja stacionarna telefonska številka. V polju je dovoljena samo ena telefonska številka.',
  `fax` varchar(255) DEFAULT NULL COMMENT 'Faks številka.',
  `davcna_st` varchar(255) DEFAULT NULL COMMENT 'Davčna številka oz. ID za DDV.',
  `maticna_st` varchar(255) DEFAULT NULL COMMENT 'Matična številka.',
  `zalozba` varchar(20) DEFAULT NULL COMMENT 'Oznaka založbe. Se ujema z items.zalozba.',
  `iban` varchar(255) DEFAULT NULL COMMENT 'IBAN številka transakcijskega računa. Vsebovati mora tudi kodo države na začetku, npr. SI56).',
  `current_year_proformas_amount` decimal(10,4) DEFAULT NULL COMMENT 'Znesek naročil (predračunov) stranke v tekočem letu.',
  `current_year_invoices_amount` decimal(10,4) DEFAULT NULL COMMENT 'Znesek nakupov (računov) stranke v tekočem letu.',
  `current_year_invoices_rvc_amount` decimal(10,4) DEFAULT NULL COMMENT 'Znesek RVC vseh nakupov (računov) stranke v tekočem letu.',
  `current_year_invoices_count` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Število računov v tekočem letu.',
  `current_year_seasonal` tinyint(4) DEFAULT NULL COMMENT 'Ali je stranka v tekočem letu kupovala v sezoni ali izven sezone?',
  `current_year_product_types` tinyint(4) DEFAULT NULL COMMENT 'Ali je stranka v tekočem letu kupovala delovne zvezke ali potrebščine?',
  `previous_year_proformas_amount` decimal(10,4) DEFAULT NULL COMMENT 'Znesek naročil (predračunov) stranke v preteklem letu.',
  `previous_year_invoices_amount` decimal(10,4) DEFAULT NULL COMMENT 'Znesek nakupov (računov) stranke v preteklem letu.',
  `previous_year_invoices_rvc_amount` decimal(10,4) DEFAULT NULL COMMENT 'Znesek RVC vseh nakupov (računov) stranke v preteklem letu.',
  `previous_year_invoices_count` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Število računov v preteklem letu.',
  `previous_year_seasonal` tinyint(4) DEFAULT NULL COMMENT 'Ali je stranka v preteklem letu kupovala v sezoni ali izven sezone?',
  `previous_year_product_types` tinyint(4) DEFAULT NULL COMMENT 'Ali je stranka v preteklem letu kupovala delovne zvezke ali potrebščine?',
  `all_years_proformas_amount` decimal(10,4) DEFAULT NULL COMMENT 'Znesek naročil (predračunov) stranke v vseh letih.',
  `all_years_invoices_amount` decimal(10,4) DEFAULT NULL COMMENT 'Znesek nakupov (računov) stranke v vseh letih.',
  `all_years_invoices_rvc_amount` decimal(10,4) DEFAULT NULL COMMENT 'Znesek RVC vseh nakupov (računov) stranke v vseh letih.',
  `all_years_invoices_count` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Število računov stranke v vseh letih.',
  `all_years_seasonal` tinyint(4) DEFAULT NULL COMMENT 'Ali je stranka v vseh letih kupovala v sezoni ali izven sezone?',
  `all_years_product_types` tinyint(4) DEFAULT NULL COMMENT 'Ali je stranka v vseh letih kupovala delovne zvezke ali potrebščine?',
  `last_invoice_year` smallint(6) DEFAULT NULL COMMENT 'Leto, v katerem smo stranki izdali zadnji račun.',
  `first_ordered_at` timestamp NULL DEFAULT NULL COMMENT 'Datum čisto prvega naročila stranke. S tem prepoznamo, iz katerega leta je stranka.',
  `due_days` smallint(6) DEFAULT NULL COMMENT 'Privzeti rok plačila za stranko v dnevih.',
  `pricelist_id` smallint(5) UNSIGNED DEFAULT NULL COMMENT 'Cenik, ki se samodejno upošteva pri tej stranki, če je pricelists_ordertypes.allowed = 3.',
  `warning_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Opozorilo. Se pojavi kot pop-up vedno, ko kdo dostopa do stranke.',
  `remark_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Zaznamek se pojavi na mestu, kjer so napisani podatki o stranki.',
  `decider_type` tinyint(4) DEFAULT NULL COMMENT 'Kdo sprejema odločitve (npr. na šoli, v podjetju)? Tukaj je vrednost iz polja type, npr. če odločitve sprejema ravnatelj, je v polju vrednost 71.',
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` int(10) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` int(10) UNSIGNED DEFAULT NULL,
  `last_saved_at` timestamp NULL DEFAULT NULL,
  `last_saved_by_id` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `customer_relations`
--

CREATE TABLE `customer_relations` (
  `id` int(10) UNSIGNED NOT NULL,
  `parent_id` int(10) UNSIGNED NOT NULL COMMENT 'Številka nosilnega kupca. Povezava na customers.id.',
  `child_id` int(10) UNSIGNED NOT NULL COMMENT 'Številka podrejenega kupca. Povezava na customers.id.',
  `type` tinyint(4) NOT NULL COMMENT 'Tip povezave (kaj je podrejeni kupec?).',
  `kontaktna_oseba` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Ali je podrejeni kupec glavna kontaktna oseba na šoli oz. v podjetju?',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `customer_sources`
--

CREATE TABLE `customer_sources` (
  `id` smallint(5) UNSIGNED NOT NULL,
  `code` varchar(20) DEFAULT NULL COMMENT 'Koda izvora stranke.',
  `description` text DEFAULT NULL COMMENT 'Opis izvora stranke.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `documents`
--

CREATE TABLE `documents` (
  `id` int(10) UNSIGNED NOT NULL,
  `origin_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Številka dokumenta, na podlagi katerega je bil kreiran ta dokument.',
  `order_no` int(10) UNSIGNED DEFAULT NULL COMMENT 'Številka naročila znotraj leta. Polje služi tudi za sestavljanje sklica na položnicah.',
  `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Status dokumenta. Shematični prikaz statusov dokumentov in pozicij najdete <a href="/help/statusi_dokumentov_in_pozicij.html" target="_blank">tukaj</a>.',
  `document_no` varchar(20) DEFAULT NULL COMMENT 'Številka dokumenta. Dva dokumenta ne moreta imeti iste številke, niti v različnih letih.',
  `year` smallint(6) DEFAULT NULL COMMENT 'Leto izdaje dokumenta. Potrebujemo za številčenje dokumentov.',
  `type` tinyint(4) NOT NULL COMMENT 'Tip dokumenta:',
  `subtype` tinyint(4) DEFAULT NULL COMMENT 'Tip naročila. Po tem polju dokumente razdelimo v skupine, vsaka skupina ima svoje številčenje dokumentov.',
  `web_order_type` tinyint(4) DEFAULT NULL COMMENT 'Vrsta spletnega naročila.',
  `reminder_type` tinyint(4) DEFAULT NULL COMMENT 'Vrsta opomina glede na tip izvornega dokumenta in zaporedje opominov, npr. Predračuni - 2. opomin.',
  `order_medium` tinyint(4) DEFAULT NULL COMMENT 'Medij, preko katerega smo dobili naročilo.',
  `external_document` varchar(255) DEFAULT NULL COMMENT 'Številka kupčeve naročilnice (se bo izpisala tudi na dokumentu, npr. računu). Pri prevzemih je to številka dobavnice.',
  `form_submission_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID oddaje spletnega obrazca, ki je osnova za kreiranje tega dokumenta.',
  `ordered_at` timestamp NULL DEFAULT NULL COMMENT 'Datum in čas oddaje naročila.',
  `issued_at` timestamp NULL DEFAULT NULL COMMENT 'Datum (in čas) izdaje dokumenta.',
  `issued_by_id` int(10) UNSIGNED DEFAULT NULL,
  `issued_by_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Ime in priimek uporabnika, ki je izdal dokument.',
  `cash_register_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Oznaka blagajne, ki se naj uporabi pri pošiljanju dokumenta na FURS.',
  `issued_city_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Kraj izdaje računa na blagajni.',
  `provided_from` timestamp NULL DEFAULT NULL COMMENT 'Datum odpreme paketa oz. datum začetka opravljanja storitve. Če pustite prazno, se bo samodejno vpisal datum izdaje računa.',
  `provided_to` timestamp NULL DEFAULT NULL COMMENT 'Datum konca opravljanja storitve. Ta datum je osnova za obračun DDV. Če pustite prazno, se bo samodejno vpisal datum odpreme oz. datum izdaje računa.',
  `counter` int(10) UNSIGNED DEFAULT NULL COMMENT 'Zaporedna številka dokumenta (istega tipa dokumenta in istega tipa naročila) znotraj leta.',
  `print_counter` smallint(6) DEFAULT NULL COMMENT 'Zaporedna številka kopije računa za davčne blagajne.',
  `customer_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID prejemnika (npr. otroka, poslovne enote, ...).',
  `buyer_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID osebe, na katero glasi dokument (plačnik).',
  `ship_to_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Uporabnik za dostavo paketa, če je drugačen od kupca oz. prejemnika.',
  `address_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID naslova, ki se pojavi na dokumentu. Ko se dokument izda, se naslov na dokumentu več ne sme spremeniti.',
  `komercialist_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Komercialist, ki je zaslužen za naročilo (za obračun provizij).',
  `ship_on` timestamp NULL DEFAULT NULL COMMENT 'Stranka želi dostavo paketa na ta datum.',
  `template` tinyint(4) DEFAULT NULL COMMENT 'Predloga dokumenta, če je dokument narejen na osnovi predloge.',
  `qr` varchar(255) DEFAULT NULL COMMENT 'QR koda davčnega potrjevanja računov.',
  `zoi` varchar(255) DEFAULT NULL COMMENT 'ZOI številka davčnega potrjevanja računov.',
  `eor` varchar(255) DEFAULT NULL COMMENT 'EOR številka davčnega potrjevanja računov.',
  `pages_document` tinyint(4) DEFAULT NULL COMMENT 'Število strani dokumenta samega (brez položnic).',
  `pages_upn` tinyint(4) DEFAULT NULL COMMENT 'Število strani UPN nalogov.',
  `printed_at` timestamp NULL DEFAULT NULL COMMENT 'Datum in čas prvega masovnega tiska dokumenta.',
  `eracun_at` timestamp NULL DEFAULT NULL COMMENT 'Datum in čas zadnjega izvoza računa v e-Račun.',
  `scanned_at` timestamp NULL DEFAULT NULL COMMENT 'Datum in čas skeniranja paketa na izhodnem scannerju.',
  `shipping_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID poštne listine, s katero je bil paket odposlan.',
  `shipping_list_exclude` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1 = ne dodaj na oddajni popis , 0 = dodaj normalno',
  `courier_id` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Dostavna služba, ki se naj oz. se je uporabila za dokument.',
  `parcel_no` int(11) DEFAULT NULL COMMENT 'Številka paketa pri dostavni službi.',
  `parcel_code` varchar(255) DEFAULT NULL COMMENT 'Koda dostavne službe za posamičen paket, npr. pri Pošti Slovenije CF številka.',
  `parcel_current` smallint(6) DEFAULT NULL COMMENT 'Zaporedni del pošiljke - ce ima pošiljka vec paketov',
  `parcel_count` smallint(6) DEFAULT NULL COMMENT 'Skupaj paketov v pošiljki',
  `shipped_at` timestamp NULL DEFAULT NULL COMMENT 'Datum in čas, ko je bil paket odposlan iz hiše.',
  `send_per_email` tinyint(4) DEFAULT NULL COMMENT 'Ali se stranka strinja, da se ji dokument pošlje po e-pošti namesto po navadni pošti?',
  `sent_per_email_at` timestamp NULL DEFAULT NULL COMMENT 'Datum in čas, ko je bil dokument prvič avtomatsko poslan po elektronski pošti.',
  `sent_per_email_queue_id` int(11) DEFAULT NULL COMMENT 'Queue ID v tabeli jobs ali failed_jobs',
  `abandoned_cart_mailing_count` tinyint(4) DEFAULT NULL COMMENT 'Kolikokrat smo že poslali mailing za zapuščeno košarico za to naročilo.',
  `abandoned_cart_mailing_sent_at` timestamp NULL DEFAULT NULL COMMENT 'Datum pošiljanja mailinga za zapuščeno košarico.',
  `remark_internal_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Interna opomba na dokumentu. Vidna je samo na zaslonu in se nikoli ne tiska. Namenjena je samo interni uporabi, zato je niti nikoli ne smemo zaupati stranki, niti po telefonu.',
  `remark_print_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Zaznamek, ki se izpiše na dokumentu. Ta zaznamek SE PRENAŠA med različnimi vrstami dokumentov istega naročila (npr. če ga naredite na predračunu, SE BO prenesel tudi na račun in obratno).',
  `remark_parcel_print_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Zaznamek, ki se izpiše na poštni spremnici. Prenaša se med dokumenti.',
  `remark_protected_print_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Zaznamek, ki se izpiše na dokumentu in SE NE PRENAŠA med različnimi vrstami dokumentov (npr. če ga naredite na predračunu, se NE BO prenesel na račun ali dobavnico).',
  `remark_customer_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Opomba, ki jo je podala stranka, npr. ob oddaji naročila ali kasneje.',
  `free_shipping_text` int(11) DEFAULT NULL COMMENT 'Razlogi za brezplačno poštnino.',
  `log_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Poročilo napak in drugih pomembnih aktivnosti ob množičnem izdajanju dokumentov.',
  `pricelist_id` smallint(5) UNSIGNED DEFAULT NULL COMMENT 'Cenik, ki se še dodatno k ostalim veljavnim cenikom lahko uporabi za dokument.',
  `payment_method_id` tinyint(4) UNSIGNED DEFAULT NULL COMMENT 'ID načina plačila.',
  `payment_auth_id` varchar(30) DEFAULT NULL COMMENT 'Id bankart transkacije (paymentID).',
  `payment_auth_code` varchar(255) DEFAULT NULL COMMENT 'Avtorizacijska koda plačila.',
  `payment_auth_at` timestamp NULL DEFAULT NULL COMMENT 'Datum in čas avtorizacije plačila.',
  `payment_auth_amount` decimal(10,4) DEFAULT NULL COMMENT 'Znesek avtorizacije plačila.',
  `installments` tinyint(4) DEFAULT NULL COMMENT 'Število obrokov pri plačilih na obroke.',
  `amount` decimal(10,4) DEFAULT NULL COMMENT 'Skupni znesek dokumenta z DDV.',
  `amount_shipping` decimal(10,4) DEFAULT NULL COMMENT 'Znesek poštnine. Ni vključen v znesku polja amount.',
  `amount_other_payers` decimal(10,4) DEFAULT NULL COMMENT 'Znesek, ki ga plačajo drugi plačniki, npr. DZ za 1. razred. Ne vsebuje regresiranega zneska.',
  `amount_regresirano` decimal(10,4) DEFAULT NULL COMMENT 'Regresirani znesek na dokumentu.',
  `waiting_reason` tinyint(4) DEFAULT NULL COMMENT 'Če naročilo čaka na nadaljnjo obdelavo, lahko nastavite vzrok čakanja. Vzrok ostane zapisan tudi po tem, ko dokument obdelamo ali izbrišemo.',
  `amount_net` decimal(10,4) DEFAULT NULL COMMENT 'Skupni znesek dokumenta brez DDV.',
  `amount_paid` decimal(10,4) DEFAULT NULL COMMENT 'Skupni znesek dejanskih plačil, vezanih na dokument.',
  `amount_open` decimal(10,4) DEFAULT NULL COMMENT 'Neplačani znesek, vezan na dokument, ne glede na zapadlost plačil.',
  `amount_upn` decimal(10,4) DEFAULT NULL COMMENT 'Znesek na položnici. Lahko je združen znesek za več dokumentov hkrati.',
  `payment_status` tinyint(4) DEFAULT NULL COMMENT 'Status plačila. ',
  `next_due_date` timestamp NULL DEFAULT NULL COMMENT 'Čas, ko zapade naslednje plačilo dokumenta, če sploh. Pomembno za izdajanje opominov.',
  `paid_percent` decimal(9,4) DEFAULT NULL COMMENT 'V kolikšni meri je dokument že plačan?',
  `hold_dunning_until` timestamp NULL DEFAULT NULL COMMENT 'Datum, do katerega stranki ne pošiljamo opominov, tudi če ima zapadle obveznosti.',
  `reserved_percent` decimal(7,4) DEFAULT NULL COMMENT 'Kolikšen del količine na pozicijah dokumenta je rezerviran v skladišču?',
  `positions_count` smallint(6) DEFAULT NULL COMMENT 'Skupno število veljavnih pozicij na dokumentu.',
  `positions_certain` smallint(6) DEFAULT NULL COMMENT 'Število zagotovo dobavljivih pozicij na dokumentu (items.free > 0).',
  `positions_probable` smallint(6) DEFAULT NULL COMMENT 'Število verjetno dobavljivih pozicij na dokumentu (items.free == 0 and items.stock > 0).',
  `positions_delivered` smallint(6) DEFAULT NULL COMMENT 'Skupno število dobavljenih pozicij na dokumentu.',
  `estimated_delivery_date` date DEFAULT NULL COMMENT 'Datum predvidene dobave izdelkov. Posamične pozicije lahko imajo drugačen datum.',
  `estimated_delivery_remark` text DEFAULT NULL COMMENT 'Opomba glede predvidene dobave izdelkov. Posamične pozicije lahko imajo še dodatne opombe, ki se tičejo samo tistih pozicij.',
  `no_shipping` tinyint(4) DEFAULT NULL COMMENT 'Ali naj se za dokument ne obračunava poštnina?',
  `no_stock` tinyint(4) DEFAULT NULL COMMENT 'Ali so pozicije dokumenta izločene iz računanja zaloge (na primer pri papirnicah in delovnih zvezkih za 1. razred).',
  `cost_price_neutral` tinyint(4) DEFAULT NULL COMMENT 'Ali mora biti skupna nabavna vrednost dokumenta enaka 0,00? To je potrebno pri skladiščnih zapisnikih, ki preknjižujejo iz enega izdelka na drugega (npr. sestavljanje kompletov), saj se vrednost skladišča ne sme spremeniti.',
  `weight` int(11) DEFAULT NULL COMMENT 'Teža paketa v gramih.',
  `session_id` varchar(40) DEFAULT NULL COMMENT 'Laravel session id. Po tem prepoznamo naročila, ki še niso oddana in zato še nimajo podatkov o kupcu.',
  `ip_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Ip naslova, iz katerega je prišel zahtevek.',
  `user_agent_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Brskalnik, s katerim uporabnik ustvari oz. zaključi naročilo na spletu. S pomočjo tega lažje razrešimo uporabnikove težave.',
  `customer_unique_identifier_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Uuid stranke (customer).',
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` int(10) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL COMMENT 'Čas, ko je bil zapis nazadnje spremenjen (s katero koli proceduro).',
  `updated_by_id` int(10) UNSIGNED DEFAULT NULL,
  `last_saved_at` timestamp NULL DEFAULT NULL COMMENT 'Čas, ko je uporabnik nazadnje shranil dokument (s klikom na gumb).',
  `last_saved_by_id` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `document_position`
--

CREATE TABLE `document_position` (
  `id` int(10) UNSIGNED NOT NULL,
  `document_id` int(10) UNSIGNED NOT NULL,
  `position_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `document_relations`
--

CREATE TABLE `document_relations` (
  `id` int(10) UNSIGNED NOT NULL,
  `source_id` int(10) UNSIGNED NOT NULL COMMENT 'ID izvornega dokumenta - iz njega kreiramo dokument z target_i.',
  `target_id` int(10) UNSIGNED NOT NULL COMMENT 'ID ciljnega dokumenta.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `eans`
--

CREATE TABLE `eans` (
  `id` int(10) UNSIGNED NOT NULL,
  `year` smallint(6) DEFAULT NULL COMMENT 'Leto, na katero se nanaša zapis. Če je izpolnjeno, se nanaša na 31.12. tistega leta in se vidi samo v zgodovini.',
  `item_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID izdelka.',
  `ean_code` varchar(13) DEFAULT NULL COMMENT 'EAN koda dolžine 8 ali 13 znakov.',
  `type` tinyint(4) DEFAULT NULL COMMENT 'Tip EAN kode.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `exceptions`
--

CREATE TABLE `exceptions` (
  `id` int(10) UNSIGNED NOT NULL,
  `class` varchar(255) DEFAULT NULL COMMENT 'Exception class.',
  `file_line` text DEFAULT NULL COMMENT 'File name and line number where exception occurred.',
  `uri` text DEFAULT NULL COMMENT 'URL strani, kjer se je zgodila napaka. Če URL strani ni znan, se tukaj pojavi URL spletnega mesta.',
  `referer` text DEFAULT NULL COMMENT 'HTTP referer, da lažje ugotovimo, kaj povzroča napake.',
  `ip_address` varchar(255) DEFAULT NULL COMMENT 'IP naslov, iz katerega je prišla zahteva, ki je povzročila napako.',
  `message` text DEFAULT NULL COMMENT 'Sporočilo napake. Uporabniku v produkciji javimo drugačno sporočilo.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` varchar(255) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `forms`
--

CREATE TABLE `forms` (
  `id` int(10) UNSIGNED NOT NULL,
  `position` int(11) DEFAULT NULL COMMENT 'Vrstni red obrazcev v seznamu. Ko ustvariš obrazec, dobi to polje isto vrednost kot polje id, nato pa se lahko s sortiranjem spremeni.',
  `name` char(255) DEFAULT NULL COMMENT 'Ime obrazca (da ga lahko prepoznamo v seznamu obrazcev).',
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `internal_email` varchar(255) DEFAULT NULL COMMENT 'Interni email naslov, na katerega se naj pošlje potrditveno sporočilo ob oddaji obrazca. Pustite prazno, če ne želite prejeti obvestila, ko uporabnik odda obrazec. Če želite uporabiti privzeti elektronski naslov podjejta, vpišite kodo {company_email}.',
  `user_email` tinyint(4) DEFAULT NULL COMMENT 'Ali naj se potrditveno sporočilo pošlje tudi na e-mail naslov, ki ga je uporabnik vpisal pri oddaji obrazca. Če v obrazcu obstaja več polj tipa email, se sporočilo pošlje samo na prvega. Če ne obstaja nobeno polje tipa email ali polje ni izpolnjeno, se sporočilo ne pošlje (ker naslovnik ni znan).',
  `page_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Stran, na kateri se nahaja predloga sporočila, ki se pošlje ob oddaji obrazca.',
  `redirect_to_after_submit` varchar(255) DEFAULT NULL COMMENT 'Če želimo, da brskalnik po uspešni oddaji obrazca uporabnika kam preusmeri, sem vpišemo relativni ali absolutni URL naslov. Če ne vpišemo, brskalnik samo prikaže sporočilo o uspešni oddaji obrazca.',
  `steps_visibility` tinyint(4) DEFAULT NULL COMMENT 'V primeru, da ima obrazec več korakov, kako naj bodo vidni posamični koraki?',
  `label_position` tinyint(4) DEFAULT NULL COMMENT 'Položaj nazivov polj glede na podatkovna polja obrazca. Nastavitev velja za celoten obrazec, pri posamičnih poljih lahko izberete drugačne nastavitve.',
  `width` smallint(6) DEFAULT NULL COMMENT 'Širina obrazca v px. Polja se razporedijo znotraj te širine. Če za obrazec ni toliko prostora (npr. na mobilnih napravah), se polja ustrezno zožijo.',
  `label_width` smallint(6) DEFAULT NULL COMMENT 'Privzeta širina nazivov polj v px. Pustite prazno, če želite uporabiti privzeto širino nazivov polj.',
  `field_width` smallint(6) DEFAULT NULL COMMENT 'Privzeta širina polj v px. Pustite prazno, če želite uporabiti privzeto širino polj.',
  `unsubmitted_valid_minutes` int(10) UNSIGNED DEFAULT NULL COMMENT 'Kako dolgo veljajo podatki v neoddanem obrazcu.',
  `importable` tinyint(4) DEFAULT NULL COMMENT 'Ali se podatke obrazca da izvoziti v datoteko oz. uvoziti iz datoteke?',
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` int(10) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` int(10) UNSIGNED DEFAULT NULL,
  `last_saved_at` timestamp NULL DEFAULT NULL,
  `last_saved_by_id` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `form_fields`
--

CREATE TABLE `form_fields` (
  `id` int(10) UNSIGNED NOT NULL,
  `position` int(11) DEFAULT NULL,
  `form_id` int(10) UNSIGNED DEFAULT NULL,
  `type` tinyint(4) DEFAULT NULL,
  `decimals` tinyint(4) DEFAULT NULL COMMENT 'Na koliko decimalnih mest se naj izpiše vrednost v polju?',
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `show_only_if` varchar(255) DEFAULT NULL COMMENT 'Polje se prikaže v obrazcu in v potrditvenem sporočilu samo, če je drugo polje nastavljeno na določeno vrednost.',
  `same_row` tinyint(4) DEFAULT NULL COMMENT 'Ali se naj polje postavi v isto vrsto kot prejšnje polje (če je na formi dovolj prostora za to)?',
  `name` varchar(255) DEFAULT NULL COMMENT 'HTML name tag polja na obrazcu, če naj bo drugačno od privzetega name taga.',
  `add_to_confirmation_message` tinyint(4) DEFAULT NULL COMMENT 'Ali se polje in podatek v polju doda v potrditveno sporočilo?',
  `icon` varchar(255) DEFAULT NULL COMMENT 'Ikona, ki se naj pojavi zraven naziva polja ali v gumbu.',
  `label` varchar(255) DEFAULT NULL,
  `one_line` tinyint(4) DEFAULT NULL COMMENT 'Ali naj se naziv polja izpiše levo od polja (če je dovolj prostora)?',
  `placeholder` varchar(255) DEFAULT NULL COMMENT 'Besedilo, ki čaka v polju, ko ni vpisan noben podatek.',
  `help` text DEFAULT NULL COMMENT 'Pomoč za izpolnjevanje polja (kratko navodilo uporabniku, predvsem kaj naj vpiše v polje).',
  `label_width` smallint(6) DEFAULT NULL COMMENT 'Širina naziva polja v px. Pustite prazno, če želite uporabiti privzeto širino naziva polja.',
  `field_width` smallint(6) DEFAULT NULL COMMENT 'Širina polja v px. Pustite prazno, če želite uporabiti privzeto širino polja.',
  `rows` tinyint(4) DEFAULT NULL COMMENT 'Število vrstic, ki naj se naenkrat prikažejo v elementu.',
  `mandatory` tinyint(4) DEFAULT NULL COMMENT 'Ali mora uporabnik obvezno izpolniti polje?',
  `default_value` text DEFAULT NULL COMMENT 'Privzeta vrednost polja.',
  `min` int(11) DEFAULT NULL COMMENT 'Najmanjša vrednost v polju. Pri besedilnih poljih je to najmanjše število znakov, ki se lahko vpiše v polje.',
  `max` int(11) DEFAULT NULL COMMENT 'Največja vrednost v polju. Pri besedilnih poljih je to največje število znakov, ki se lahko vpiše v polje. Pri datotečnih poljih je to največje število datotek, ki jih uporabnik lahko naloži.',
  `source` mediumtext DEFAULT NULL COMMENT 'Vir podatkov za polja, kjer lahko uporabnik izbira vrednosti. Če ne podamo, sistem poskusi vir najti samodejno. Podamo lahko besedila, npr. ''translations.tables.documents.waiting_reason'' ali ''settings.web_page_element_types'', id drugega polja iz istega obrazca ali array objektov, ki imajo vsaj ključa id in value, npr. [{id: 0, value: ''Rdeča''}, {id: 2, value: ''Modra''}])',
  `save_to_column` varchar(255) DEFAULT NULL COMMENT 'V katero polje modela se naj shrani podatek, ki ga je uporabnik vpisal. Uporabiš lahko dot-sintakso, npr. "first_name" ali pa "buyer.first_name".',
  `change_function` varchar(255) DEFAULT NULL COMMENT 'Ime Vue funkcije, ki se naj sproži, ko uporabnik spremeni vrednost v polju. Funkcija mora biti napisana posebej za to. Funkcije, ki se tičejo samo določene stranke, naj se začnejo z identifierjem stranke in podčrtajem, npr. za Rol Group bi bilo ime funkcije rol_group_test.',
  `additional_props` mediumtext DEFAULT NULL COMMENT 'Dodatni parametri, ki jih želimo podati data-input komponenti; a za njih nimamo polja v bazi. Zapišite v JSON obliki, na primer : [{ "untabbable": true, "downsize": false}]. Za pomoč pri uporabi glej DataInput.vue.',
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` int(10) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` int(10) UNSIGNED DEFAULT NULL,
  `last_saved_by_id` int(10) UNSIGNED DEFAULT NULL,
  `last_saved_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `form_submissions`
--

CREATE TABLE `form_submissions` (
  `id` int(10) UNSIGNED NOT NULL,
  `form_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID forme, ki je bila oddana.',
  `client_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id stranke, če ima stranka več sestrskih strani.',
  `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Status oddaje obrazca.',
  `ip_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID ip-ja, iz katerega je bila oddana forma.',
  `user_agent_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Brskalnik uporabnika.',
  `session_id` varchar(40) DEFAULT NULL COMMENT 'Laravel session id. Po tem prepoznamo uporabnika in napolnimo formo z obstoječimi podatki, če obstajajo.',
  `recaptcha_score` decimal(2,1) DEFAULT NULL COMMENT 'Rezultat preverjanja na Google reCAPTCHA. 1.0 pomeni zelo verjetno človek, 0.0 pomeni zelo verjetno pajek.',
  `document_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Dokument, ki je nastal z oddajo tega obrazca (praviloma spletno naročilo).',
  `amount` decimal(9,2) DEFAULT NULL COMMENT 'Znesek izdelkov v obrazcu. Vsebuje že upoštevan popust, ne vsebuje pa poštnine.',
  `total` decimal(9,2) DEFAULT NULL COMMENT 'Skupni znesek izdelkov in poštnine na obrazcu.',
  `payment_intent_id` varchar(100) DEFAULT NULL COMMENT 'PaymentIntent id. Potrebujemo, da lahko v primeru 3D Secure avtorizacije plačila (npr. Stripe) najdemo stran, na katero moramo vrniti stranko, da ji napišemo, da je vse OK.',
  `payment_amount` decimal(9,2) DEFAULT NULL COMMENT 'Znesek plačila, ki je vezano na oddajo obrazca.',
  `paid_at` timestamp NULL DEFAULT NULL COMMENT 'Čas, ko je bilo plačilo uspešno izvedeno.',
  `paid_amount` decimal(9,2) DEFAULT NULL COMMENT 'Skupni znesek, ki je bil plačan vezano na oddajo obrazca.',
  `uri_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'URL strani, iz katere je bila odposlana forma. Ista forma se namreč lahko pojavi na več straneh, pa tudi URL strani se lahko spremeni, zato je dobro imeti informacijo o tem, iz katerega URL-je je bila forma oddana.',
  `customer_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID stranke, ki je oddala obrazec (če ga vemo).',
  `email` varchar(255) DEFAULT NULL COMMENT 'Email naslov, ki je bil vpisan v obrazec (če sploh obstaja polje email).',
  `submitted_at` timestamp NULL DEFAULT NULL COMMENT 'Datum in ura zadnjega poskusa oddaje obrazca. Ni nujno, da je bil obrazec v resnici tudi uspešno oddan - glej polje status.',
  `valid_until` timestamp NULL DEFAULT NULL COMMENT 'Do kdaj so podatki forme veljavni.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `form_submission_fields`
--

CREATE TABLE `form_submission_fields` (
  `id` int(10) UNSIGNED NOT NULL,
  `form_submission_id` int(10) UNSIGNED DEFAULT NULL,
  `form_field_id` int(10) UNSIGNED DEFAULT NULL,
  `value` mediumtext DEFAULT NULL COMMENT 'Vrednost, ki jo je uporabnik vpisal v polje, ko je oddal obrazec.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `houses`
--

CREATE TABLE `houses` (
  `id` int(10) UNSIGNED NOT NULL,
  `house_id` int(11) NOT NULL COMMENT 'ID hiše',
  `house_no` varchar(255) DEFAULT NULL COMMENT 'Hišna številka',
  `street_id` int(10) UNSIGNED NOT NULL COMMENT 'ID streets',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `imageables`
--

CREATE TABLE `imageables` (
  `id` int(10) UNSIGNED NOT NULL,
  `image_id` int(10) UNSIGNED NOT NULL COMMENT 'Id slike (images.id).',
  `imageable_id` int(10) UNSIGNED NOT NULL COMMENT 'Id iz modela, na katerega se nanaša relacija. Glej https://laravel.com/docs/master/eloquent-relationships#many-to-many-polymorphic-relations za pomoč.',
  `imageable_type` varchar(100) NOT NULL COMMENT 'Ime modela, na katerega se nanaša relacija. Glej https://laravel.com/docs/master/eloquent-relationships#many-to-many-polymorphic-relations za pomoč.',
  `type` smallint(6) DEFAULT NULL COMMENT 'Tip slike. Tipi so definirani v Settings in v prevodih tables.php.',
  `caption` text DEFAULT NULL COMMENT 'Besedilo podnapisa pod sliko. V podnapis pod sliko lahko podate dodatne informacije, ki se nanašajo na sliko v kontekstu mesta, kjer je slika objavljena. Lahko napišete tudi kakšne zanimivosti o sliki. Primer: Vsaj enourni sprehodi z dojenčkom lahko bistveno izboljšajo otrokovo zdravje in kasnejši razvoj. V to besedilo ne vpisujte opisa same slike (to spada v polje Alt).',
  `background_repeat` tinyint(4) DEFAULT NULL COMMENT 'Na kakšen način naj se slika za ozadje ponavlja (CSS background-repeat)?',
  `background_size` tinyint(4) DEFAULT NULL COMMENT 'Kako naj se slika za ozadje zmanjša ali poveča, da zavzame ves razpoložljiv prostor (CSS background-size).',
  `background_position_x` decimal(7,4) DEFAULT NULL COMMENT 'Vodoravni položaj slike za ozadje v %.',
  `background_position_y` decimal(7,4) DEFAULT NULL COMMENT 'Navpični položaj slike za ozadje v %.',
  `background_darken_percent` tinyint(4) DEFAULT NULL COMMENT 'Za koliko % naj se potemni ali posvetli slika za ozadje, če imamo preko napisano besedilo?',
  `position` int(10) UNSIGNED DEFAULT NULL COMMENT 'Potrebujemo za spreminjanje vrstnega reda slik (drag and drop).',
  `session_id` varchar(255) DEFAULT NULL COMMENT 'Če stran velja samo za določeni session_id (npr. za testiranje urejanja), sem vpišite ta session_id.',
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` int(10) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `images`
--

CREATE TABLE `images` (
  `id` int(10) UNSIGNED NOT NULL,
  `filename` varchar(512) NOT NULL COMMENT 'Ime datoteke slike skupaj s potjo znotraj direktorija /public. Pozor: ime je text sensitive!',
  `uri` varchar(255) DEFAULT NULL COMMENT 'Relativni URL do datoteke, če se le-ta nahaja znotraj public diskov.',
  `alt` text DEFAULT NULL COMMENT 'Besedilo, ki opisuje sliko (image alt tag). Potrebujemo za tiste, ki ne morejo videti slike (npr. slepi in slabovidni). Prav tako potrebujejo spletni iskalniki, da vedo, kaj je na sliki. V besedilo vpišite zgolj opis vsebine slike (npr. Mama z dojenčkom v parku). Ne vpisujte besedila, ki se nanaša na spletno stran v povezavi s to sliko (tako besedilo spada v podnapis slike).',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `ips`
--

CREATE TABLE `ips` (
  `id` int(10) UNSIGNED NOT NULL,
  `ip_address` varchar(255) DEFAULT NULL COMMENT 'Ip naslov obiskovalca strani. Lahko je IPv4 ali IPv6 naslov.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `items`
--

CREATE TABLE `items` (
  `id` int(10) UNSIGNED NOT NULL,
  `position` int(10) UNSIGNED DEFAULT NULL COMMENT 'Vrstni red izdelkov. Ko ustvariš izdelek, dobi to polje isto vrednost kot polje id, nato pa se lahko s sortiranjem spremeni.',
  `item_no` varchar(255) DEFAULT NULL COMMENT 'Unikatna šifra izdelka.',
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `exclude_from_search` tinyint(4) DEFAULT NULL COMMENT 'Ali naj bo izdelek izločen iz iskanja po strani?',
  `name` varchar(255) DEFAULT NULL COMMENT 'Naziv izdelka. Samodejno se sestavi iz delov naziva izdelka.',
  `name_general` varchar(255) DEFAULT NULL COMMENT 'Splošni del naziva izdelka, lahko vsebuje tudi blagovno znamko. Skupaj z ostalimi deli se združi v skupni naziv izdelka.',
  `name_model` varchar(255) DEFAULT NULL COMMENT 'Ime modela. Skupaj z ostalimi deli naziva se združi v skupni naziv izdelka.',
  `name_variant` varchar(255) DEFAULT NULL COMMENT 'Različica izdelka, npr. barva ali velikost. Skupaj z ostalimi deli se združi v skupni naziv izdelka.',
  `name_quantity` varchar(255) DEFAULT NULL COMMENT 'Količinski del naziva izdelka, npr. 100 listov ali 4 kosi. Skupaj z ostalimi deli se združi v skupni naziv izdelka.',
  `remark_text_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Interna opomba izdelka: interne informacije o izdelku, pojasnila, ...',
  `variant_parent_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID nosilnega izdelka, če gre za različice izdelka (barvo, velikost, paket, model, ...).',
  `variant_type_1_id` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Tip različic izdelka po prvem kriteriju. Nastavimo samo izdelkom, ki imajo različice (nosilnim).',
  `variant_type_2_id` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Tip različic izdelka po drugem kriteriju. Nastavimo samo izdelkom, ki imajo različice (nosilnim).',
  `variant_type_3_id` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Tip različic izdelka po tretjem kriteriju. Nastavimo samo izdelkom, ki imajo različice (nosilnim).',
  `variant_type_4_id` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Tip različic izdelka po četrtem kriteriju. Nastavimo samo izdelkom, ki imajo različice (nosilnim).',
  `variant_type_1_value` varchar(255) DEFAULT NULL COMMENT 'Vrednost različice po prvem kriteriju, npr. rdeča, zelena. Vrednost je odvisna od tipa različic po prvem kriteriju. Nastavimo samo izdelkom, ki so različice.',
  `variant_type_2_value` varchar(255) DEFAULT NULL COMMENT 'Vrednost različice po drugem kriteriju, npr. rdeča, zelena. Vrednost je odvisna od tipa različic po drugem kriteriju. Nastavimo samo izdelkom, ki so različice.',
  `variant_type_3_value` varchar(255) DEFAULT NULL COMMENT 'Vrednost različice po tretjem kriteriju, npr. rdeča, zelena. Vrednost je odvisna od tipa različic po tretjem kriteriju. Nastavimo samo izdelkom, ki so različice.',
  `variant_type_4_value` varchar(255) DEFAULT NULL COMMENT 'Vrednost različice po četrtem kriteriju, npr. rdeča, zelena. Vrednost je odvisna od tipa različic po četrtem kriteriju. Nastavimo samo izdelkom, ki so različice.',
  `min_quantity` int(11) DEFAULT NULL COMMENT 'Najmanjša možna količina pri naročilu na spletu. Če ne nastavite, se upošteva nastavitev iz blagovne skupine oziroma iz splošnih nastavitev.',
  `max_quantity` int(11) DEFAULT NULL COMMENT 'Največja možna količina pri naročilu na spletu. Če ne nastavite, se upošteva nastavitev iz blagovne skupine oziroma iz splošnih nastavitev.',
  `warning_quantity` int(11) DEFAULT NULL COMMENT 'Količina, pri kateri uporabnika opozorimo, da morda naroča preveliko količino izdelka, vendar kljub temu dopustimo naročilo s tako veliko količino. Če ne nastavite, se upošteva nastavitev iz blagovne skupine oziroma iz splošnih nastavitev.',
  `limited_quantity` int(11) DEFAULT NULL COMMENT 'Pri kateri količini spletna stran prikaže, da je zaloga omejena? Če ne nastavite, se upošteva nastavitev iz blagovne skupine oziroma iz splošnih nastavitev.',
  `available_quantity` int(11) DEFAULT NULL COMMENT 'Količina izdelka, ki je na voljo za naročanje. Če je vpisana, vsako naročilo to količino zmanjša.',
  `stock_quantity` int(11) DEFAULT NULL COMMENT 'Fizična skupna zaloga izdelka na vseh skladiščnih mestih. V skupno zalogo se ne šteje količina izdelkov, ki ni na voljo za prodajo (npr. poškodovani izdelki).',
  `unavailable_quantity` int(11) DEFAULT NULL COMMENT 'Fizična skupna zaloga, ki ni na voljo za prodajo (npr. poškodovani izdelki, izdelki v ponovnem pakiranju, popravilu, kontroli, ...).',
  `next_delivery_at` timestamp NULL DEFAULT NULL COMMENT 'Datum predvidene naslednje dobave izdelka. Se prikaže na spletni strani, če je status izdelka ustrezen in če je datum v prihodnosti. Pri nastavljanju datuma imejte v mislih tudi, ali bo količina naslednje dobave pokrila še nedobavljena naročila.',
  `vat_id` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Privzeta stopnja DDV za ta izdelek.',
  `unit_of_measure` varchar(255) DEFAULT NULL COMMENT 'Enota mere, v kateri prodajamo izdelek. Pustite prazno, če gre za kos, sicer vpišite enoto (npr. m, ura, liter, kg, g, ...).',
  `length` int(10) UNSIGNED DEFAULT NULL COMMENT 'Dolžina izdelka v mm skupaj s embalažo. Dolžina je mera izdelka po daljši vodoravni stranici.',
  `width` int(10) UNSIGNED DEFAULT NULL COMMENT 'Širina izdelka v mm skupaj s embalažo. Širina je mera izdelka po krajši vodoravni stranici.',
  `height` int(10) UNSIGNED DEFAULT NULL COMMENT 'Višina izdelka v mm skupaj s embalažo. Višina je mera izdelka po navpični stranici.',
  `weight` int(10) UNSIGNED DEFAULT NULL COMMENT 'Masa izdelka v g skupaj z embalažo.',
  `last_saved_at` timestamp NULL DEFAULT NULL,
  `last_saved_by_id` int(10) UNSIGNED DEFAULT NULL,
  `created_by_id` int(10) UNSIGNED DEFAULT NULL,
  `updated_by_id` int(10) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `item_groups`
--

CREATE TABLE `item_groups` (
  `id` int(10) UNSIGNED NOT NULL,
  `parent_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID nadrejene skupine izdelkov.',
  `code` varchar(255) DEFAULT NULL COMMENT 'Šifra skupine izdelkov.',
  `full_code` varchar(255) DEFAULT NULL COMMENT 'Celotna koda skupine, ki vsebuje tudi nadrejene skupine, ločeno s pikami, npr. 1.2.4.',
  `description` varchar(255) DEFAULT NULL COMMENT 'Oznaka skupine izdelkov.',
  `full_description` text NOT NULL COMMENT 'Celoten naziv skupine, ki vsebuje tudi nazive nadrejenih skupin.',
  `vat_id` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Pričakovana stopnja DDV za to blagovno skupino. Ko uporabniki shranjujejo izdelek v to blagovno skupino, jih sistem opozori, če izdelek nima te stopnje DDV.',
  `shop_visible_from` timestamp NULL DEFAULT NULL COMMENT 'Od kdaj naprej naj bo skupina vidna na spletni strani? Pustite prazno, če naj bo vidna takoj. Če pustite prazni obe polju (od in do), bo skupina vidna na spletu.',
  `shop_visible_to` timestamp NULL DEFAULT NULL COMMENT 'Do kdaj naj bo skupina vidna na spletni strani? Pustite prazno, če naj bo vidna trajno. Če pustite prazni obe polju (od in do), bo skupina vidna na spletu.',
  `image` varchar(255) DEFAULT NULL COMMENT 'Slika, ki se naloži kot slika v ploščici (ikona), če je stran prikazana kot ploščica.',
  `background_image` varchar(255) DEFAULT NULL COMMENT 'Slika, ki se naj naloži za ozadje.',
  `free_shipping_valid_from` timestamp NULL DEFAULT NULL COMMENT 'Datum, OD katerega velja brezplačna poštnina za celotno blagovno skupino. Če pustite prazno in vpišete konec veljavnosti, začne veljati takoj.',
  `free_shipping_valid_to` timestamp NULL DEFAULT NULL COMMENT 'Datum, DO katerega velja brezplačna poštnina za celotno blagovno skupino. Če pustite prazno in vpišete začetek veljavnosti, velja trajno.',
  `free_shipping_min_quantity` decimal(10,4) DEFAULT 1.0000 COMMENT 'Poštnina je brezplačna, če kupec naroči vsaj takšno količino izdelkov iz te blagovne skupine.',
  `limited_quantity` decimal(10,4) DEFAULT NULL COMMENT 'Pri kateri količini spletna stran prikaže, da je zaloga omejena? Če ne nastavite, se upošteva nastavitev iz nadrejene blagovne skupine.',
  `min_quantity` decimal(10,4) DEFAULT NULL COMMENT 'Najmanjša možna količina pri naročilu na spletu. Če ne nastavite, se upošteva nastavitev iz nadrejene blagovne skupine oziroma količina 1.',
  `max_quantity` decimal(10,4) DEFAULT NULL COMMENT 'Največja možna količina pri naročilu na spletu. Če ne nastavite, se upošteva nastavitev iz nadrejene blagovne skupine.',
  `warning_quantity` decimal(10,4) DEFAULT NULL COMMENT 'Količina, pri kateri uporabnika opozorimo, da morda naroča preveliko količino izdelka. Če ne nastavite, se upošteva nastavitev iz nadrejene blagovne skupine.',
  `banner_file_name` varchar(255) DEFAULT NULL COMMENT 'Ime banner slike.',
  `banner_file_name_mobile` varchar(255) DEFAULT NULL COMMENT 'Ime banner slike na mobilnih napravah.',
  `banner_link` varchar(255) DEFAULT NULL COMMENT 'Povezava, na katero kaže banner.',
  `banner_position` tinyint(4) DEFAULT NULL COMMENT 'Pozicija bannerja na spletni strani.',
  `banner_valid_from` timestamp NULL DEFAULT NULL COMMENT 'Banner veljaven od',
  `banner_visible_group` tinyint(4) DEFAULT NULL COMMENT 'Prikaži v skupini.',
  `banner_visible_subgroup` tinyint(4) DEFAULT NULL COMMENT 'Prikaži tudi v podrejenih skupinah',
  `banner_visible_item` tinyint(4) DEFAULT NULL COMMENT 'Prikaži tudi pri izdelkih',
  `banner_valid_to` timestamp NULL DEFAULT NULL COMMENT 'Banner veljaven do',
  `banner_client_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Stran, na kateri se naj prikaže banner, če ima stranka več sestrskih strani.',
  `has_web_items` tinyint(4) DEFAULT NULL COMMENT 'Ali ima blagovna skupina izdelke, ki se lahko prikažejo na spletu? Izdelki so lahko bodisi v skupini ali pa v podrejenih skupinah.',
  `level_1_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id nadrejene skupine na nivoju 1.',
  `level_2_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id nadrejene skupine na nivoju 2.',
  `level_3_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id nadrejene skupine na nivoju 3.',
  `level_4_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id nadrejene skupine na nivoju 4.',
  `level_5_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id nadrejene skupine na nivoju 5.',
  `level_6_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id nadrejene skupine na nivoju 6.',
  `level_7_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id nadrejene skupine na nivoju 7.',
  `level_8_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id nadrejene skupine na nivoju 8.',
  `level_9_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id nadrejene skupine na nivoju 9.',
  `level_1` text DEFAULT NULL COMMENT 'Polna koda in opis nadrejene skupine na nivoju 1.',
  `level_2` text DEFAULT NULL COMMENT 'Polna koda in opis nadrejene skupine na nivoju 2.',
  `level_3` text DEFAULT NULL COMMENT 'Polna koda in opis nadrejene skupine na nivoju 3.',
  `level_4` text DEFAULT NULL COMMENT 'Polna koda in opis nadrejene skupine na nivoju 4.',
  `level_5` text DEFAULT NULL COMMENT 'Polna koda in opis nadrejene skupine na nivoju 5.',
  `level_6` text DEFAULT NULL COMMENT 'Polna koda in opis nadrejene skupine na nivoju 6.',
  `level_7` text DEFAULT NULL COMMENT 'Polna koda in opis nadrejene skupine na nivoju 7.',
  `level_8` text DEFAULT NULL COMMENT 'Polna koda in opis nadrejene skupine na nivoju 8.',
  `level_9` text DEFAULT NULL COMMENT 'Polna koda in opis nadrejene skupine na nivoju 9.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `item_item_group`
--

CREATE TABLE `item_item_group` (
  `id` int(10) UNSIGNED NOT NULL,
  `item_id` int(10) UNSIGNED DEFAULT NULL,
  `item_group_id` int(10) UNSIGNED DEFAULT NULL,
  `type` tinyint(4) DEFAULT NULL COMMENT 'Tip relacije. Možnosti so v Prefs.php.',
  `main` tinyint(4) DEFAULT NULL COMMENT 'Ali je blagovna skupina glavna blagovna skupina relacije?',
  `prio` tinyint(4) DEFAULT NULL COMMENT 'Prioriteta izdelka v trenutku uvrstitve v blagovno skupino. Izdelki z nižjo številko so na vrsti prej. Null pomeni, da je bil izdelek ročno prestavljen na drugo mesto v skupini.',
  `position` int(10) UNSIGNED DEFAULT NULL COMMENT 'Za potrebe sortiranja.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `jobs`
--

CREATE TABLE `jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `queue` varchar(255) NOT NULL,
  `payload` longtext NOT NULL,
  `attempts` tinyint(3) UNSIGNED NOT NULL,
  `reserved_at` int(10) UNSIGNED DEFAULT NULL,
  `available_at` int(10) UNSIGNED NOT NULL,
  `created_at` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `messages`
--

CREATE TABLE `messages` (
  `id` int(10) UNSIGNED NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 0,
  `messageable_type` varchar(255) NOT NULL,
  `messageable_id` int(10) UNSIGNED NOT NULL,
  `page_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Stran, kjer se nahaja predloga sporočila.',
  `subject_text_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Zadeva sporočila.',
  `to_type` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Tip prejemnika, ki mu je namenjeno to sporočilo (npr. kupec, prodajalec, urednik, ...).',
  `medium` tinyint(4) DEFAULT NULL COMMENT 'Medij sporočila (email, SMS, ...). Vsako sporočilo pošljemo samo po enem mediju. Če želimo poslati isto sporočilo po več medijih, ustvarimo več enakih sporočil.',
  `queue_name` varchar(15) DEFAULT NULL COMMENT 'Čakalna vrsta, skozi katero bo (je bilo) sporočilo poslano. Če izberete čakalno vrsto ''low'', lahko pride do zamud pri pošiljanju, če je v čakalni vrsti veliko opravil.',
  `attachments` text DEFAULT NULL COMMENT 'Priponke, ki so bile pripete sporočilu, v točno taki obliki, kot so bile pripete.',
  `send_at` timestamp NULL DEFAULT NULL COMMENT 'Datum kdaj naj se pošlje sporočilo.',
  `failed_at` timestamp NULL DEFAULT NULL COMMENT 'Datum in čas zadnje napake pri pošiljanju (job se premakne v failed_jobs).',
  `failed_count` tinyint(4) DEFAULT NULL COMMENT 'Kolikokrat je pošiljanje sporočila spodletelo?',
  `succeeded_at` datetime DEFAULT NULL COMMENT 'Datum in čas, ko je bilo sporočilo uspešno poslano.',
  `queued_at` timestamp NULL DEFAULT NULL COMMENT 'Datum in čas, ko je bilo sporočilo postavljeno v čakalno vrsto za pošiljanje.',
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` int(10) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `message_recipient`
--

CREATE TABLE `message_recipient` (
  `id` int(10) UNSIGNED NOT NULL,
  `type` tinyint(4) NOT NULL COMMENT 'Tip prejemnika sporočila (Od:, Za:, Kp:, Skp:).',
  `message_id` int(10) UNSIGNED DEFAULT NULL,
  `recipient_id` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2024_05_03_120408_images_add_alt_column', 1),
(2, '2024_05_03_121048_imageables_add_caption_column', 1),
(3, '2024_05_05_013542_imageables_add_background_darken_percent', 1),
(4, '2024_05_07_135934_pages_add_gaps_columns', 1),
(5, '2024_05_10_125908_pages_font_size_to_smallint', 1),
(7, '2024_05_14_224659_pages_add_shadow_column', 2),
(8, '2024_05_22_113400_pages_add_template_column', 3),
(9, '2024_06_16_161402_page_texts_add_template', 4),
(10, '2024_06_17_103952_create_contents_table', 4),
(11, '2024_08_21_144944_pages_update_color_set', 5),
(12, '2024_09_12_094727_pages_add_original_id_column', 6),
(13, '2024_11_05_123121_pages_add_modified_at_column', 6),
(14, '2024_11_16_095635_pages_add_selectable_column', 6),
(15, '2024_12_13_154046_pages_status_change_default', 6),
(16, '2024_12_20_210057_karpo_adjust_elements', 7),
(17, '2024_12_21_182355_pages_remove_unused_columns', 7),
(18, '2024_12_21_183953_drop_page_texts_table', 7),
(19, '2024_12_29_010352_karpo_erase_all_forms', 8),
(20, '2024_12_29_224312_form_fields_overhaul', 8),
(21, '2025_01_01_104335_pages_add_form_field_id_column', 8),
(22, '2025_01_01_192156_contents_remove_icon_prefix', 8),
(23, '2025_01_02_130845_convert_status_columns_to_non_nullable', 8),
(24, '2025_01_02_132403_forms_add_status_column', 8),
(25, '2025_01_03_230715_drop_form_submission_sessions_table', 8),
(26, '2025_01_06_122624_create_user_agents_table', 8),
(27, '2025_01_06_125152_form_submissions_change_user_agent_column', 8),
(28, '2025_01_10_152306_clients_add_columns', 9),
(29, '2025_01_11_125826_message_templates_overhaul', 9),
(30, '2025_01_11_215320_create_recipients_table', 9),
(31, '2025_01_11_215357_create_message_recipient_table', 9),
(32, '2025_01_11_215516_messages_overhaul', 9),
(33, '2025_01_11_232746_remove_obsolete_tables', 9),
(34, '2025_01_12_000943_bigint_to_int', 9),
(35, '2025_01_12_003743_texts_to_varchar', 9),
(36, '2025_01_12_012816_clients_default_country_code', 9),
(37, '2025_01_13_115904_pages_rename_edit_restrictions', 9),
(38, '2025_01_14_142218_pages_add_blade_column', 9),
(39, '2025_01_19_103432_clients_add_company_column', 9),
(40, '2025_01_21_201321_messages_reform', 9),
(41, '2025_01_21_205316_texts_reform', 9),
(42, '2025_01_22_165029_forms_add_page_id', 9),
(43, '2025_01_29_083754_form_fileds_remove_auto_correct', 9),
(44, '2025_01_31_092031_clients_add_google_tag_column', 10),
(45, '2025_02_12_135545_create_table_counters', 11),
(46, '2025_02_15_142349_create_customer_columns', 12),
(47, '2025_02_23_120827_karpo_modify_field_515', 12),
(48, '2025_02_24_095302_payment_methods_overhaul', 12),
(49, '2025_02_27_235215_form_submissions_payment_fields', 12),
(50, '2025_03_11_101800_uris_change_text_to_varchar', 12),
(51, '2025_03_11_145812_form_submissions_add_paid_amount_column', 12),
(52, '2025_03_12_130617_form_submissions_uri_id_comment', 12),
(53, '2025_03_14_224650_create_exceptions_table', 12),
(54, '2025_03_15_220005_items_drop_foreign_keys', 12),
(55, '2025_03_15_220101_drop_items_table', 12),
(56, '2025_03_15_221720_create_variant_types_table', 12),
(57, '2025_03_15_221727_create_new_items_table', 12),
(58, '2025_03_15_225917_texts_move_content_column', 12),
(59, '2025_03_16_003837_vat_description_nullable', 12),
(60, '2025_03_21_121839_prices_add_items_foreign_key', 12),
(61, '2025_03_21_122341_prices_to_integers', 12),
(62, '2025_04_05_121219_pages_add_item_id_foreign', 12),
(63, '2025_04_07_105950_documents_remove_order_group', 12),
(64, '2025_04_07_134525_form_submissions_add_order_columns', 12),
(65, '2025_04_18_140924_positions_add_item_id_foreign', 12),
(66, '2025_04_18_141106_form_fields_add_form_id_foreign', 12),
(67, '2025_04_18_211324_counters_add_scope_column', 12),
(68, '2025_04_20_092045_clients_add_phone', 12),
(69, '2025_04_20_094600_contents_change_data', 12),
(70, '2025_04_20_095825_documents_add_amount_shipping_column', 12),
(71, '2025_04_24_213528_exceptions_add_referrer_column', 12),
(72, '2025_04_24_233523_delete_content_for_exception_message', 12),
(73, '2025_04_25_001956_forms_change_company_email_data', 12),
(74, '2025_05_12_110321_karpo_narocilnica_abonma', 13);

-- --------------------------------------------------------

--
-- Table structure for table `pages`
--

CREATE TABLE `pages` (
  `id` int(10) UNSIGNED NOT NULL,
  `parent_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Nadrejena stran.',
  `original_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Element, ki je osnova za vsebino tega elementa.',
  `position` int(11) DEFAULT NULL COMMENT 'Vrstni red strani. Ko ustvariš stran, dobi to polje isto vrednost kot polje id, nato pa se lahko s sortiranjem spremeni.',
  `element_type` tinyint(4) DEFAULT NULL,
  `template` tinyint(4) DEFAULT NULL COMMENT 'Predloga, na osnovi katere je bil vstavljen element. Če je bil element vstavljen kot del neke predloge, je to polje NULL. Predloge so Prefs::web_page_element_types.',
  `blade` varchar(255) DEFAULT NULL COMMENT 'Blade template, ki se naj uporabi za prikaz te strani, ko je zapis prikazan kot stran. Vpišite samo ime brez .blade.php. Če ne vpišete, se uporabi page.blade.php.',
  `restrictions` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Omejitve, ki jih ima uporabnik pri urejanju tega elementa.',
  `sw_wizard_name` varchar(255) DEFAULT NULL COMMENT 'Setup wizard: wizard_name, da lahko najdemo stran, ki pripada določenemu koraku čarovnika.',
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Status strani (objavljena, skrita, izbrisana, ...).',
  `shown_from` timestamp NULL DEFAULT NULL COMMENT 'Datum in čas od katerega naprej naj bo stran vidna. Pustite prazno, če naj bo vidna takoj.',
  `shown_to` timestamp NULL DEFAULT NULL COMMENT 'Datum in čas do katerega naprej naj bo stran vidna. Pustite prazno, če naj bo vidna za vedno.',
  `hide_on` tinyint(4) DEFAULT NULL COMMENT 'Element lahko skrijete na določenih tipih naprav, npr. na mobilnikih skrijete kakšen nepomemben element, da ne zavzema prostora po nepotrebnem.',
  `is_page` tinyint(4) DEFAULT NULL COMMENT 'Določite, ali element vodi na podstran oz. ali ima kakšno drugo funkcijo (npr. prikaz iskanja).',
  `item_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Izdelek, ki je predstavljen na tej strani.',
  `item_group_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Blagovna skupina, ki je predstavljena na tej strani.',
  `redirect_to` varchar(255) DEFAULT NULL COMMENT 'Kam naj brskalnik preusmeri uporabnika, ko klikne na elementu? Vpišite absolutni URL (npr. https://www.domena.si/neka-mapa/neka-izdelek) ali relativni URL (/neka-mapa/nek-izdelek).',
  `embed_code` text DEFAULT NULL COMMENT 'HTML koda vdelave elementa, na primer koda, s katero vdelate video v stran.',
  `auto_uri` tinyint(4) DEFAULT 1 COMMENT 'Ali naj se URL naslov strani posodablja samodejno glede na naslov strani? V primeru spremembe naslova, se spremeni tudi URL naslov, prejšnji URL naslov pa še naprej deluje (obiskovalce preusmeri na novi naslov).',
  `country_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Oznaka države, ki ji je stran namenjena. S tem definiramo tudi jezik strani. Če ne določimo, se jezik prenese iz nadrejene strani ali splošnih nastavitev.',
  `published_at` timestamp NULL DEFAULT NULL COMMENT 'Čas, ko je bila stran prvič objavljena. Uporabi se kot datum za rubrike, kot so novice in podobno. Čas se nastavi samodejno, vendar ga je mogoče tudi spremeniti.',
  `form_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Obrazec, ki se naj prikaže v elementu.',
  `form_field_id` int(10) UNSIGNED DEFAULT NULL,
  `menu_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Meni, ki naj bo prikazan v elementu. Če pustite prazno, se bo prikazal glavni meni.',
  `color_profile` tinyint(4) DEFAULT NULL COMMENT 'Barvni profil strani in vseh podrejenih strani.',
  `page_color_set` tinyint(4) DEFAULT NULL COMMENT 'Barvna shema strani in vseh podrejenih strani.',
  `page_color_set_override` tinyint(4) DEFAULT NULL COMMENT 'Izberite, če želite povoziti barve barvne sheme strani z lastnimi barvami.',
  `color_set` tinyint(4) DEFAULT NULL COMMENT 'Barvna shema elementa.',
  `color_set_override` tinyint(4) DEFAULT NULL COMMENT 'Izberite, če želite povoziti barve barvne sheme elementa z lastnimi barvami.',
  `page_background_color` varchar(255) DEFAULT NULL COMMENT 'Barva ozadja strani. Če določite sliko za ozadje, se bo barva ozadja upoštevala samo tam, kjer slika ne zavzema celotne površine strani.',
  `background_color` varchar(255) DEFAULT NULL COMMENT 'Barva ozadja elementa. Če določite sliko za ozadje elementa, se bo barva ozadja elementa upoštevala samo tam, kjer slika ne zavzema celotne površine elementa.',
  `page_text_color` varchar(255) DEFAULT NULL COMMENT 'Barva pisave strani.',
  `text_color` varchar(255) DEFAULT NULL COMMENT 'Barva pisave, ko je stran prikazana kot odsek na neki drugi strani.',
  `page_heading_color` varchar(255) DEFAULT NULL COMMENT 'Barva naslovov na strani.',
  `heading_color` varchar(255) DEFAULT NULL COMMENT 'Barva naslovov, ko je stran prikazana kot odsek na neki drugi strani.',
  `page_link_color` varchar(255) DEFAULT NULL COMMENT 'Barva povezav na strani.',
  `link_color` varchar(255) DEFAULT NULL COMMENT 'Barva povezav, ko je stran prikazana kot odsek na neki drugi strani.',
  `page_border_color` varchar(255) DEFAULT NULL COMMENT 'Barva črt na strani.',
  `border_color` varchar(255) DEFAULT NULL COMMENT 'Barva črt, ko je stran prikazana kot odsek na neki drugi strani.',
  `page_margins` tinyint(4) DEFAULT NULL COMMENT 'Kolikšen naj bo odmik (prazen prostor) od robov elementov strani?',
  `margins` tinyint(4) DEFAULT NULL COMMENT 'Kolikšen naj bo odmik (prazen prostor) od roba elementa?',
  `page_gaps` tinyint(4) DEFAULT NULL COMMENT 'Kolikšen naj bo razmik (prazen prostor) med elementi na strani?',
  `gaps` tinyint(4) DEFAULT NULL COMMENT 'Kolikšen naj bo razmik (prazen prostor) med elementi znotraj tega elementa?',
  `borders` tinyint(4) DEFAULT NULL COMMENT 'Ali naj ima element obrobe?',
  `border_radius` tinyint(4) DEFAULT NULL COMMENT 'Ali naj ima element zaobljene robove? Določite lahko, kako močno naj bodo zaobljeni.',
  `shadow` tinyint(4) DEFAULT NULL COMMENT 'Ali naj ima element senco?',
  `horizontal_alignment` tinyint(4) DEFAULT NULL COMMENT 'Vodoravna poravnava elementov znotraj tega elementa.',
  `vertical_alignment` tinyint(4) DEFAULT NULL COMMENT 'Navpična poravnava elementov znotraj tega elementa.',
  `font_size` smallint(6) DEFAULT NULL COMMENT 'Relativna velikost pisave za vse gradnike elementa. Vsi gradniki elementa (tudi v morebitnih elementih znotraj tega elementa) so bodo sorazmerno povečali oz. pomanjšali.',
  `css` text DEFAULT NULL COMMENT 'Dodatni css slogi, ki se vključijo v element. Avtor je odgovoren za pravilno sintakso slogov, npr.: margin-top: 1em.',
  `width` smallint(6) DEFAULT NULL COMMENT 'Širina elementa v px. Širina se samodejno zmanjša, če v brskalniku ni na voljo toliko širine (npr. na mobilnih napravah).',
  `height` smallint(6) DEFAULT NULL COMMENT 'Višina elementa v px. Višina se samodejno poveča, če je potrebno, da se v elementu lahko prikaže celotna njegova vsebina (npr. na mobilnih napravah).',
  `social_plugins` tinyint(4) DEFAULT NULL COMMENT 'Ali naj se na strani prikažejo vtičniki socialnih omrežij, kot so Facebook Like button?',
  `session_id` varchar(255) DEFAULT NULL COMMENT 'Če stran velja samo za določeni session_id (npr. za testiranje urejanja), sem vpišite ta session_id.',
  `modified_at` timestamp NULL DEFAULT NULL COMMENT 'Čas, ko je bila vsebina strani nazadnje spremenjena. Čas se nastavi samodejno, vendar ga je mogoče tudi spremeniti ali izbrisati.',
  `last_saved_at` timestamp NULL DEFAULT NULL,
  `last_saved_by_id` int(10) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` int(10) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `page_tag`
--

CREATE TABLE `page_tag` (
  `id` int(10) UNSIGNED NOT NULL,
  `page_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Stran, za katero velja tag.',
  `tag_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Tag, ki velja za stran.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `password_resets`
--

CREATE TABLE `password_resets` (
  `email` varchar(255) NOT NULL,
  `token` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `password_reset_tokens`
--

CREATE TABLE `password_reset_tokens` (
  `email` varchar(255) NOT NULL,
  `token` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `payments`
--

CREATE TABLE `payments` (
  `id` int(10) UNSIGNED NOT NULL,
  `status` tinyint(4) NOT NULL COMMENT 'Status plačila',
  `related_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Številka povezanega plačila (preknjižbe med dokumenti)',
  `order_no` int(10) UNSIGNED DEFAULT NULL COMMENT 'Številka naročila, na katero se nanaša plačilo.',
  `document_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id predračuna / računa, na katerega se nanaša plačilo.',
  `customer_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id stranke, ki je plačnik tega obroka, če je drugačen od kupca na dokumentu.',
  `customer_document_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id dokumenta (računa), na katerem je plačilo, ki ima drugega plačnika, zaračunano drugemu plačniku.',
  `counter` tinyint(4) DEFAULT NULL COMMENT 'Zaporedna številka plačila znotraj istega order_no, da jih lahko updatamo, če je potrebno.',
  `due_date` timestamp NULL DEFAULT NULL COMMENT 'Rok plačila.',
  `amount_expected` decimal(10,4) DEFAULT NULL COMMENT 'Pričakovani znesek plačila.',
  `amount_expected_manual` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Ročno nastavljena višina obroka',
  `payment_method_id` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'ID pričakovanega načina plačila.',
  `paid_method_id` tinyint(4) DEFAULT NULL COMMENT 'Način plačila s katerim je bil znesek resnično plačan',
  `amount_paid` decimal(10,4) DEFAULT NULL COMMENT 'Dejansko plačani znesek.',
  `paid_at` timestamp NULL DEFAULT NULL COMMENT 'Datum (in čas) plačila.',
  `payment_package_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Oznaka import xml paketa',
  `reference_model` tinyint(4) DEFAULT 12 COMMENT 'Model sklica. Praviloma SI12, pri katerem se računa kontrolka.',
  `reference` varchar(13) DEFAULT NULL COMMENT 'Sklic za plačilo.',
  `imported_name` varchar(255) DEFAULT NULL COMMENT 'Naziv plačnika, kot smo ga uvozili od banke.',
  `imported_address` varchar(255) DEFAULT NULL COMMENT 'Naslov plačnika, kot smo ga uvozili od banke.',
  `imported_reference_model` tinyint(1) DEFAULT NULL COMMENT 'Model sklica plačila, kot smo ga uvozili od banke.',
  `imported_reference` varchar(13) DEFAULT NULL COMMENT 'Sklic, kot smo ga uvozili od banke.',
  `imported_amount` decimal(10,4) DEFAULT NULL COMMENT 'Znesek plačila, kot smo ga uvozili od banke.',
  `imported_txid` varchar(255) DEFAULT NULL COMMENT 'Številka transakcije, kot jo dobimo od banke.',
  `imported_remark_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Namen plačila, kot ga dobimo od banke.',
  `matching_suggestions` text DEFAULT NULL,
  `bpi_no` varchar(255) DEFAULT NULL COMMENT 'Številka blagajniškega prejemka oz. izdatka',
  `error_status` tinyint(3) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` int(10) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `payment_methods`
--

CREATE TABLE `payment_methods` (
  `id` tinyint(3) UNSIGNED NOT NULL,
  `position` tinyint(1) DEFAULT NULL COMMENT 'Za sortiranje.',
  `label` varchar(255) DEFAULT NULL COMMENT 'Naziv načina plačila, ki se pojavi na spletni strani in na vseh dokumentih.',
  `web` tinyint(4) DEFAULT NULL COMMENT 'Ali se način plačila lahko pojavi na spletni strani?',
  `pos` tinyint(4) DEFAULT NULL COMMENT 'Ali se način plačila lahko uporabi pri osebni prodaji oz. pri izstavitvi dokumentov?',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `payment_packages`
--

CREATE TABLE `payment_packages` (
  `id` int(10) UNSIGNED NOT NULL,
  `status` tinyint(4) NOT NULL COMMENT 'Status plačila.',
  `package_id` varchar(255) NOT NULL COMMENT 'ID številka paketa, kot ga dobimo od banke.',
  `statement_id` varchar(255) NOT NULL COMMENT 'Številka izpiska, kot ga dobimo iz banke.',
  `bank_id` tinyint(3) UNSIGNED NOT NULL COMMENT 'ID banke',
  `package_amount` decimal(8,2) NOT NULL COMMENT 'Skupni znesek vseh plačil v paketu.',
  `records_total` smallint(5) UNSIGNED NOT NULL COMMENT 'Število vseh vrstic.',
  `records_matched` smallint(5) UNSIGNED NOT NULL COMMENT 'Število samodejno obdelanih zapisov.',
  `records_unmatched` smallint(5) UNSIGNED NOT NULL COMMENT 'Število zapisov, ki jih ni bilo mogoče samodejno obdelati.',
  `records_error` int(10) UNSIGNED DEFAULT NULL COMMENT 'Število vrstic z napakami.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `imported_at` timestamp NULL DEFAULT NULL COMMENT 'Datum uvoza paketa.',
  `issued_at` timestamp NULL DEFAULT NULL COMMENT 'Kdaj je bil paket kreiran (podatek banke iz XML datoteke) ',
  `processed_at` timestamp NULL DEFAULT NULL COMMENT 'Kdaj smo paket obdelali (če smo paket uvozili in obdelali ločeno)'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `personal_access_tokens`
--

CREATE TABLE `personal_access_tokens` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tokenable_type` varchar(255) NOT NULL,
  `tokenable_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `token` varchar(64) NOT NULL,
  `abilities` text DEFAULT NULL,
  `last_used_at` timestamp NULL DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `positions`
--

CREATE TABLE `positions` (
  `id` int(10) UNSIGNED NOT NULL,
  `item_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID izdelka iz tabele items.',
  `position` int(10) UNSIGNED DEFAULT NULL COMMENT 'Zaporedni položaj pozicije v košarici (ali pa morda tudi na dokumentih).',
  `user_replaced_item_at` timestamp NULL DEFAULT NULL COMMENT 'Čas, ko je uporabnik nazadnje zamenjal izdelek v košarici z drugim izdelkom.',
  `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Status pozicije. Shematični prikaz statusov dokumentov in pozicij najdete <a href="/help/statusi_dokumentov_in_pozicij.html" target="_blank">tukaj</a>.',
  `reason` tinyint(4) DEFAULT NULL COMMENT 'Razlog vnosa pozicije. Se uporablja samo, če imamo kakšen poseben razlog, na primer pri reklamacijah.',
  `group_no` int(10) UNSIGNED DEFAULT NULL COMMENT 'Številka, ki določa, katere pozicije na dokumentu spadajo skupaj (npr. na skladiščnem zapisniku, če mora biti nevtralen glede nabavne cene).',
  `quantity` decimal(10,4) NOT NULL DEFAULT 1.0000 COMMENT 'Količina izdelka.',
  `price` decimal(16,9) DEFAULT NULL COMMENT 'Cena pozicije z DDV.',
  `pricelist_id` smallint(5) UNSIGNED DEFAULT NULL COMMENT 'Cenik, iz katerega je bila vzeta cena. ',
  `original_price` decimal(16,9) DEFAULT NULL COMMENT 'Redna cena izdelka v času izdaje dokumenta (od nje se obračunava popust).',
  `discount` decimal(7,4) DEFAULT NULL COMMENT 'Odstotek popusta. Samo kot informacija, da ga lahko izpišemo na dokumentu, ker ga ne moremo izračunati iz obeh cen zaradi zaokroževanja cen navzdol.',
  `document_costs` decimal(16,9) DEFAULT NULL COMMENT 'Del odvisnih stroškov dokumenta (npr. prevzema), ki pripada enemu kosu dotične pozicije.',
  `cost_price` decimal(16,9) DEFAULT NULL COMMENT 'Nabavna cena izdelka na poziciji. Pri prevzemih je to privzeta prodajna cena z DDV.',
  `average_cost_price` decimal(16,9) DEFAULT NULL COMMENT 'Povprečna nabavna cena izdelka v skladišču PO dogodku (po vhodu oz. izhodu blaga).',
  `stock` decimal(10,4) DEFAULT NULL COMMENT 'Stanje zaloge po dogodku.',
  `stock_counter` int(11) DEFAULT NULL COMMENT 'Zaporedna številka pozicije v skladiščnem dnevniku.',
  `stock_at` timestamp NULL DEFAULT NULL COMMENT 'Datum in čas izdaje dokumenta, s katerim je bila pozicija odposlana, prevzeta oz. je bilo z njim spremenjeno skladiščno stanje.',
  `stock_document_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Dokument, s katerim je bila pozicija odposlana, prevzeta oz. je bilo z njim spremenjeno skladiščno stanje.',
  `vat_id` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Stopnja DDV.',
  `payment_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Na katero plačilo je vezana pozicija, če je vezana na točno določene pozicije (npr. delovni zvezki za 1. razred).',
  `description_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Naziv izdelka. Ker se ne sme spreminjati, ga shranjujemo v tabelo texts, sem pa pride samo id.',
  `remark_customer_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Opomba, ki jo ob oddaji naročila vpiše kupec.',
  `remark_print_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Opomba, ki se izpiše na dokumentu pri poziciji.',
  `estimated_delivery_date` date DEFAULT NULL COMMENT 'Datum predvidene dobave izdelkov pozicije. Ča ima tudi dokument vpisan datum predvidene dobave, velja ta, ki je vpisan na poziciji.',
  `estimated_delivery_remark` text DEFAULT NULL COMMENT 'Opomba glede predvidene dobave izdelkov te pozicije.',
  `scanned_quantity` int(10) UNSIGNED DEFAULT NULL COMMENT 'Količina poskeniranih izdelkov',
  `no_stock` tinyint(4) DEFAULT NULL COMMENT 'Ali je pozicija izločena iz računanja zaloge (na primer pri papirnicah in delovnih zvezkih za 1. razred).',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `position_relations`
--

CREATE TABLE `position_relations` (
  `id` int(10) UNSIGNED NOT NULL,
  `parent_id` int(10) UNSIGNED NOT NULL,
  `child_id` int(10) UNSIGNED NOT NULL,
  `type` tinyint(4) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `pricelists`
--

CREATE TABLE `pricelists` (
  `id` smallint(5) UNSIGNED NOT NULL,
  `year` smallint(6) DEFAULT NULL COMMENT 'Leto, v katerem velja cenik (opis). Za trajne cenike pustimo prazno.',
  `position` smallint(6) DEFAULT NULL COMMENT 'Pozicija cenika v seznamu cenikov.',
  `description` text DEFAULT NULL COMMENT 'Naziv cenika',
  `valid_from` timestamp NULL DEFAULT NULL COMMENT 'Od kdaj naprej velja cenik?',
  `valid_to` timestamp NULL DEFAULT NULL COMMENT 'Do kdaj velja cenik?',
  `parent_id` smallint(5) UNSIGNED DEFAULT 1 COMMENT 'ID nadrejenega cenika (v primeru popustov moramo vedeti, iz katerega cenika se jemljejo osnovne cene za izračun popustov).',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `pricelists_subtypes`
--

CREATE TABLE `pricelists_subtypes` (
  `id` int(10) UNSIGNED NOT NULL,
  `pricelist_id` smallint(5) UNSIGNED DEFAULT NULL,
  `subtype` tinyint(4) NOT NULL DEFAULT 9 COMMENT 'Podtip dokumenta (documents.subtype).',
  `allowed` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Ali se cenik lahko uporabi za določen tip naročila? Zapisov z vrednostjo 0 v bistvu ne potrebujemo.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `prices`
--

CREATE TABLE `prices` (
  `id` int(10) UNSIGNED NOT NULL,
  `pricelist_id` smallint(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'ID cenika',
  `item_group_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Blagovna skupina, za katero velja cena, če so izpolnjeni vsi pogoji.',
  `item_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Izdelek, za katerega velja cena, če so izpolnjeni vsi pogoji.',
  `type` tinyint(4) DEFAULT NULL COMMENT 'Tip cene oz. popusta. Nekateri tipi se upoštevajo samo, če so izpolnjeni določeni pogoji.',
  `price` decimal(10,4) DEFAULT NULL COMMENT 'Prodajna cena z DDV. Vpisana je lahko samo ena cena (brez ali z DDV).',
  `price_net` decimal(10,4) DEFAULT NULL COMMENT 'Prodajna cena brez DDV. Vpisana je lahko samo ena cena (brez ali z DDV).',
  `discount` decimal(7,4) DEFAULT NULL COMMENT 'Odstotek popusta. Če je vpisana cena, se popust obračuna še na vpisano ceno (sicer pa na ceno iz nadrejenega cenika).',
  `min_item_quantity` int(11) DEFAULT NULL COMMENT 'Najmanjša količina, ki mora biti na poziciji, da se cena oz. popust sploh upošteva.',
  `condition_type` tinyint(4) DEFAULT NULL COMMENT 'Na katere izdelke v košarici se nanaša pogoj najmanjše količine oz. najmanjšega zneska pri popustih na celotne blagovne skupine.',
  `min_quantity` int(11) DEFAULT NULL COMMENT 'Minimalna količina ustreznih izdelkov, ki mora biti v košarici, da se cena oz. popust sploh lahko upošteva.',
  `min_amount` decimal(10,2) DEFAULT NULL COMMENT 'Minimalni skupni znesek vseh izdelkov v košarici po rednih cenah, da se popust sploh lahko upošteva.',
  `max_quantity` int(11) DEFAULT NULL COMMENT 'Največja količina izdelkov, pri kateri se upošteva cena oz. popust.',
  `valid_from` timestamp NULL DEFAULT NULL COMMENT 'Od kdaj naprej je veljavna cena? Če ni določeno, začne veljati takoj. Dodatno k temu velja še omejitev na ravni cenika.',
  `valid_to` timestamp NULL DEFAULT NULL COMMENT 'Do kdaj je veljavna cena?. Če ni določeno, velja za vedno. Dodatno k temu velja še omejitev na ravni cenika.',
  `remark` text DEFAULT NULL COMMENT 'Opomba, če so jo želite dopisati k ceni. Opomba ne vpliva na delovanje programa, ampak je vidna samo uporabnikom, da lažje spremljate cene.',
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` int(10) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `recipients`
--

CREATE TABLE `recipients` (
  `id` int(10) UNSIGNED NOT NULL,
  `email` varchar(255) NOT NULL COMMENT 'Email prejemnika. Izpisal se bo v glavi sporočila v ustreznem polju (Za:, Kp:, Skp:). Pri drugih tipih sporočil se lahko tukaj pojavi druga vrsta podatka, npr. telefonska številka, uporabniško ime, ...',
  `name` varchar(255) DEFAULT NULL COMMENT 'Ime prejemnika, kot bo vidno v glavi sporočila v ustreznem polju (Za:, Kp:, Skp:).'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL,
  `user_id` int(10) UNSIGNED DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` longtext NOT NULL,
  `last_activity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `settings`
--

CREATE TABLE `settings` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL COMMENT 'Ključ nastavitve kot string.',
  `value` text DEFAULT NULL COMMENT 'Vrednost nastavitve. Glej model Setting.php za več info.',
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` int(10) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `shippings`
--

CREATE TABLE `shippings` (
  `id` int(10) UNSIGNED NOT NULL,
  `courier_id` tinyint(3) UNSIGNED NOT NULL COMMENT 'Dostavna služba.',
  `shipped_at` datetime DEFAULT NULL COMMENT 'Datum in čas pošiljanja paketov s to pošiljko.',
  `count` smallint(6) DEFAULT NULL COMMENT 'Število paketov na pošiljki.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `transmission_status` tinyint(4) DEFAULT NULL COMMENT 'Status pošiljanja na web servis. null : neposlano , -1 : error , 0 : čaka , 1 : OK',
  `transmission_guid` text DEFAULT NULL COMMENT 'Unikatni žeton prenosa',
  `transmission_data` longtext DEFAULT NULL COMMENT 'Komunikacija z web servisom - serialized',
  `transmitted_at` datetime DEFAULT NULL COMMENT 'Datum in ura zadnje komunikacije',
  `transmission_verbal_response` text DEFAULT NULL COMMENT 'Verbalni status web servis odgovora',
  `transmission_verbal_description` text DEFAULT NULL COMMENT 'Opis web servis odgovora',
  `transmission_reply_id` int(11) DEFAULT NULL COMMENT 'ID poštne listine ki jo dodeli pošta pri uspešnem odgovoru'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `streets`
--

CREATE TABLE `streets` (
  `id` int(10) UNSIGNED NOT NULL,
  `street` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Naziv ulice.',
  `city_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `tags`
--

CREATE TABLE `tags` (
  `id` int(10) UNSIGNED NOT NULL,
  `position` int(10) UNSIGNED DEFAULT NULL COMMENT 'Polje za vrstni red zapisov. Se polni samodejno.',
  `parent_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Nadrejena oznaka (tag).',
  `level` tinyint(4) DEFAULT NULL COMMENT 'Nivo oznake (taga). Nivo 1 pomeni, da oznaka nima starša, nivo 2 pomeni, da ima samo starša, nivo 3 pomeni, da ima poleg starša tudi starega starša. Polje se polni samodejno.',
  `sort_string` varchar(255) DEFAULT NULL COMMENT 'Interno besedilo, ki nam služi za sortiranje oznak v gridu (da so sortirani po nivojih).',
  `label` varchar(255) DEFAULT NULL COMMENT 'Naziv oznake (taga).',
  `full_label` text DEFAULT NULL COMMENT 'Celotni naziv oznake (z nazivi vseh nadrejenih oznak). Polje se polni samodejno.',
  `text_color` varchar(255) DEFAULT NULL COMMENT 'Barva pisave oznake (taga).',
  `background_color` varchar(255) DEFAULT NULL COMMENT 'Barva ozadja oznake (taga).',
  `inherited_text_color` varchar(255) DEFAULT NULL COMMENT 'Barva pisave oznake (taga), prepisana iz nadrejene oznake, ker ta nima določene barve.',
  `inherited_background_color` varchar(255) DEFAULT NULL COMMENT 'Barva ozadja oznake (taga), prepisana iz nadrejene oznake, ker ta nima določene barve.',
  `ponder` smallint(5) UNSIGNED NOT NULL DEFAULT 10 COMMENT 'Teža oznake (taga). Upošteva se pri izračunu relevantnosti strani.',
  `is_hidden` tinyint(4) DEFAULT NULL COMMENT 'Ali je oznaka skrita? Če je skrita, se upošteva pri izračunu relevantnosti strani, ampak se na straneh ne prikazuje.',
  `internal_remark` text DEFAULT NULL COMMENT 'Interna opomba.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `texts`
--

CREATE TABLE `texts` (
  `id` int(10) UNSIGNED NOT NULL,
  `content` text DEFAULT NULL COMMENT 'Besedilo, ki ga shranjujemo.',
  `hash` char(64) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `unique_identifiers`
--

CREATE TABLE `unique_identifiers` (
  `id` int(10) UNSIGNED NOT NULL,
  `table_name` varchar(255) NOT NULL COMMENT 'Ime tabele, na katero se nanaša uuid',
  `table_id` int(10) UNSIGNED NOT NULL COMMENT 'ID zapisa v tabeli table_name, na katero se nanaša uuid.',
  `type` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Tip unikatnega identifikatorja.',
  `valid_to` timestamp NULL DEFAULT NULL COMMENT 'Do kdaj je uuid veljaven.',
  `uuid` char(36) NOT NULL COMMENT 'Unikatna oznaka zapisa - ustvari se z Str::orderedUuid()',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `uris`
--

CREATE TABLE `uris` (
  `id` int(10) UNSIGNED NOT NULL,
  `page_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Stran, za katero velja URL.',
  `uri_address` varchar(2000) CHARACTER SET ascii COLLATE ascii_general_ci DEFAULT NULL COMMENT 'Relativni ali absolutni URL naslov strani (torej brez https:// in domene ali s tem). Za povezave na lastno stran uporabimo relatvni URL naslov.',
  `session_id` varchar(255) DEFAULT NULL COMMENT 'Če URL velja samo za določeni session_id (npr. za testiranje urejanja), sem vpišite ta session_id.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(10) UNSIGNED NOT NULL,
  `first_name` varchar(255) DEFAULT NULL COMMENT 'Ime uporabnika.',
  `last_name` varchar(255) DEFAULT NULL COMMENT 'Priimek uporabnika.',
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Status uporabnika.',
  `email` varchar(255) NOT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `remark_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Interne opombe pri uporabniku.',
  `remember_token` varchar(100) DEFAULT NULL,
  `davcna_st` varchar(8) DEFAULT NULL COMMENT 'Davčna številka uporabnika. Potrebno za davčne blagajne.',
  `admin` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Administrator',
  `notification_medium` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Na kakšen način želi uporabnik prejemati obvestila ?',
  `tel_call_uri` varchar(255) DEFAULT NULL COMMENT 'Ali naj klik na ikono izhodnega klica v Monimi sproži klic zavihku brskalnika? Vpišite default ali URL za klic (URL-ju se na konec doda telefonska številka).',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `permissions_array` longtext DEFAULT NULL COMMENT 'JSON string, ki ga je prej vrnila funkcija User->UserPermissions, zdaj pa se ustvari ob vsakem shranjevanju uporabnika in potem prebere direktno iz baze.',
  `extra_attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `stripe_id` varchar(255) DEFAULT NULL,
  `pm_type` varchar(255) DEFAULT NULL,
  `pm_last_four` varchar(4) DEFAULT NULL,
  `trial_ends_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `user_agents`
--

CREATE TABLE `user_agents` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_agent_text` text DEFAULT NULL COMMENT 'Besedilo HTTP_USER_AGENT.',
  `device_type` tinyint(4) DEFAULT NULL COMMENT 'Tip naprave (namizna, tablica, mobilna, bot).',
  `browser_name` varchar(255) DEFAULT NULL COMMENT 'Ime brskalnika, npr. Firefox 3.6, Chrome 42.',
  `platform_name` varchar(255) DEFAULT NULL COMMENT 'Ime operacijskega sistema, npr. Windows 10. Pozor: Windows 11 se izpiše kot Windows 10, ker ima isti kernel.',
  `device_name` varchar(255) DEFAULT NULL COMMENT 'Ime naprave, npr. Apple iPad.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `variant_types`
--

CREATE TABLE `variant_types` (
  `id` tinyint(3) UNSIGNED NOT NULL,
  `name` varchar(255) DEFAULT NULL COMMENT 'Naziv tipa različice, npr. Barva, Velikost, Model, ...',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_slovenian_ci;

-- --------------------------------------------------------

--
-- Table structure for table `vats`
--

CREATE TABLE `vats` (
  `id` tinyint(3) UNSIGNED NOT NULL,
  `vat_rate` decimal(5,2) NOT NULL COMMENT 'Stopnja DDV v odstotkih.',
  `description` text DEFAULT NULL,
  `valid_from` timestamp NULL DEFAULT NULL,
  `valid_to` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `addresses`
--
ALTER TABLE `addresses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `addresses_first_name_index` (`first_name`(40)),
  ADD KEY `addresses_last_name_index` (`last_name`(40)),
  ADD KEY `addresses_company_index` (`company`(40)),
  ADD KEY `addresses_street_index` (`street`(40)),
  ADD KEY `addresses_city_index` (`city`(40)),
  ADD KEY `addresses_house_no_index` (`house_no`),
  ADD KEY `addresses_zip_index` (`zip`),
  ADD KEY `addresses_house_id_foreign` (`house_id`),
  ADD KEY `addresses_street_id_foreign` (`street_id`),
  ADD KEY `addresses_city_id_foreign` (`city_id`),
  ADD KEY `addresses_status_index` (`status`),
  ADD KEY `addresses_md5_unique` (`md5`) USING BTREE;

--
-- Indexes for table `banks`
--
ALTER TABLE `banks`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `banks_oznaka_unique` (`oznaka`);

--
-- Indexes for table `cache`
--
ALTER TABLE `cache`
  ADD PRIMARY KEY (`key`);

--
-- Indexes for table `cache_locks`
--
ALTER TABLE `cache_locks`
  ADD PRIMARY KEY (`key`);

--
-- Indexes for table `cash_registers`
--
ALTER TABLE `cash_registers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cash_registers_public_ip_index` (`public_ip`(40)),
  ADD KEY `cash_registers_local_ip_index` (`local_ip`(40)),
  ADD KEY `cash_registers_city_id_foreign` (`city_id`);

--
-- Indexes for table `cities`
--
ALTER TABLE `cities`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cities_city(100)_index` (`city`(100)),
  ADD KEY `cities_zip_index` (`zip`);

--
-- Indexes for table `clients`
--
ALTER TABLE `clients`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `clients_identifier_unique` (`identifier`),
  ADD KEY `clients_status_index` (`status`),
  ADD KEY `clients_plan_extension_request_at_index` (`plan_extension_request_at`),
  ADD KEY `clients_wizard_created_at_index` (`wizard_created_at`),
  ADD KEY `clients_plan_valid_to_index` (`plan_valid_to`),
  ADD KEY `clients_plan_index` (`plan`),
  ADD KEY `clients_position_index` (`position`),
  ADD KEY `clients_parent_id_foreign` (`parent_id`),
  ADD KEY `clients_wizard_form_submission_id_index` (`wizard_form_submission_id`);

--
-- Indexes for table `contents`
--
ALTER TABLE `contents`
  ADD PRIMARY KEY (`id`),
  ADD KEY `contents_contentable_id_contentable_type_status_index` (`contentable_id`,`contentable_type`,`status`);

--
-- Indexes for table `counters`
--
ALTER TABLE `counters`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `counters_type_year_scope_unique` (`type`,`year`,`scope`);

--
-- Indexes for table `countries`
--
ALTER TABLE `countries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `countries_position_index` (`position`),
  ADD KEY `countries_code2_index` (`code2`),
  ADD KEY `countries_code3_index` (`code3`),
  ADD KEY `countries_cc_tld_index` (`cc_tld`),
  ADD KEY `countries_language_code_index` (`language_code`),
  ADD KEY `countries_status_index` (`status`);

--
-- Indexes for table `coupons`
--
ALTER TABLE `coupons`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `coupons_code_unique` (`code`),
  ADD KEY `coupons_parent_id_index` (`parent_id`),
  ADD KEY `coupons_discount_pricelist_id_foreign` (`discount_pricelist_id`);

--
-- Indexes for table `coupon_document`
--
ALTER TABLE `coupon_document`
  ADD PRIMARY KEY (`id`),
  ADD KEY `coupon_document_coupon_id_foreign` (`coupon_id`),
  ADD KEY `coupon_document_document_id_foreign` (`document_id`);

--
-- Indexes for table `coupon_item`
--
ALTER TABLE `coupon_item`
  ADD PRIMARY KEY (`id`),
  ADD KEY `coupon_item_coupon_id_foreign` (`coupon_id`),
  ADD KEY `coupon_item_item_id_foreign` (`item_id`);

--
-- Indexes for table `couriers`
--
ALTER TABLE `couriers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `couriers_parent_id_foreign` (`parent_id`),
  ADD KEY `couriers_pos_index` (`pos`),
  ADD KEY `couriers_remote_index` (`remote`),
  ADD KEY `couriers_position_index` (`position`);

--
-- Indexes for table `courier_services`
--
ALTER TABLE `courier_services`
  ADD PRIMARY KEY (`id`),
  ADD KEY `courier_services_courier_id_foreign` (`courier_id`);

--
-- Indexes for table `courier_service_fees`
--
ALTER TABLE `courier_service_fees`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `customers`
--
ALTER TABLE `customers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `customers_customer_no_unique` (`customer_no`),
  ADD KEY `customers_address_id_foreign` (`address_id`),
  ADD KEY `customers_pricelist_id_foreign` (`pricelist_id`),
  ADD KEY `customers_warning_text_foreign` (`warning_text`),
  ADD KEY `customers_remark_text_foreign` (`remark_text`),
  ADD KEY `customers_type_status_index` (`type`,`status`),
  ADD KEY `customers_email_index` (`email`(40)),
  ADD KEY `customers_mobile_index` (`mobile`(10)),
  ADD KEY `customers_phone_index` (`phone`(10)),
  ADD KEY `customers_source_id_foreign` (`source_id`),
  ADD KEY `customers_mobile_2_index` (`mobile_2`(10)),
  ADD KEY `customers_mobile_3_index` (`mobile_3`(10)),
  ADD KEY `customers_phone_2_index` (`phone_2`(10)),
  ADD KEY `customers_phone_3_index` (`phone_3`(10)),
  ADD KEY `customers_created_by_id_foreign` (`created_by_id`),
  ADD KEY `customers_updated_by_id_foreign` (`updated_by_id`),
  ADD KEY `customers_last_saved_by_id_foreign` (`last_saved_by_id`),
  ADD KEY `customers_last_invoice_year_index` (`last_invoice_year`),
  ADD KEY `customers_courier_id_foreign` (`courier_id`),
  ADD KEY `customers_gdpr_allowed_ip_id_foreign` (`gdpr_allowed_ip_id`),
  ADD KEY `customers_type_first_ordered_at_index` (`type`,`first_ordered_at`),
  ADD KEY `customers_external_customer_no_index` (`external_customer_no`),
  ADD KEY `customers_type_status_gdpr_allowed_index` (`type`,`status`,`gdpr_allowed`);

--
-- Indexes for table `customer_relations`
--
ALTER TABLE `customer_relations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `customer_relations_parent_id_child_id_type_unique` (`parent_id`,`child_id`,`type`),
  ADD KEY `customer_relations_parent_id_index` (`parent_id`),
  ADD KEY `customer_relations_child_id_index` (`child_id`);

--
-- Indexes for table `customer_sources`
--
ALTER TABLE `customer_sources`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `customer_sources_id_unique` (`id`);

--
-- Indexes for table `documents`
--
ALTER TABLE `documents`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `documents_document_no_unique` (`document_no`),
  ADD UNIQUE KEY `documents_type_subtype_cash_register_id_year_counter_unique` (`type`,`subtype`,`cash_register_id`,`year`,`counter`),
  ADD KEY `documents_buyer_id_foreign` (`buyer_id`),
  ADD KEY `documents_address_id_foreign` (`address_id`),
  ADD KEY `documents_remark_internal_text_foreign` (`remark_internal_text`),
  ADD KEY `documents_remark_print_text_foreign` (`remark_print_text`),
  ADD KEY `documents_pricelist_id_foreign` (`pricelist_id`),
  ADD KEY `documents_order_no_index` (`order_no`),
  ADD KEY `documents_customer_id_index` (`customer_id`),
  ADD KEY `documents_type_status_index` (`type`,`status`),
  ADD KEY `documents_type_sola_id_razred_index` (`type`),
  ADD KEY `documents_provided_to_index` (`provided_to`),
  ADD KEY `documents_issued_by_id_foreign` (`issued_by_id`),
  ADD KEY `documents_issued_by_text_foreign` (`issued_by_text`),
  ADD KEY `documents_origin_id_foreign` (`origin_id`),
  ADD KEY `documents_courier_id_foreign` (`courier_id`),
  ADD KEY `documents_shipping_id_foreign` (`shipping_id`),
  ADD KEY `documents_payment_method_id_foreign` (`payment_method_id`),
  ADD KEY `documents_log_text_foreign` (`log_text`),
  ADD KEY `documents_created_by_id_foreign` (`created_by_id`),
  ADD KEY `customers_updated_by_id_foreign` (`updated_by_id`),
  ADD KEY `customers_last_saved_by_id_foreign` (`last_saved_by_id`),
  ADD KEY `documents_ship_to_id_foreign` (`ship_to_id`),
  ADD KEY `documents_type_issued_at_subtype_index` (`type`,`issued_at`,`subtype`),
  ADD KEY `documents_cash_register_id_foreign` (`cash_register_id`),
  ADD KEY `documents_issued_city_id_foreign` (`issued_city_id`),
  ADD KEY `documents_session_id_index` (`session_id`),
  ADD KEY `documents_user_agent_text_foreign` (`user_agent_text`),
  ADD KEY `documents_payment_auth_id_index` (`payment_auth_id`),
  ADD KEY `documents_ip_id_index` (`ip_id`),
  ADD KEY `documents_type_subtype_ordered_at_index` (`type`,`subtype`,`ordered_at`),
  ADD KEY `documents_free_shipping_text_index` (`free_shipping_text`),
  ADD KEY `documents_session_id_type_status_created_at_index` (`session_id`,`type`,`status`,`created_at`),
  ADD KEY `documents_type_subtype_status_created_at_index` (`type`,`subtype`,`status`,`created_at`),
  ADD KEY `documents_type_subtype_issued_at_created_at_index` (`type`,`subtype`,`issued_at`,`created_at`),
  ADD KEY `documents_type_status_issued_at_index` (`type`,`status`,`issued_at`),
  ADD KEY `documents_type_status_origin_id_index` (`type`,`status`,`origin_id`),
  ADD KEY `documents_form_submission_id_foreign` (`form_submission_id`),
  ADD KEY `documents_customer_unique_identifier_id_index` (`customer_unique_identifier_id`),
  ADD KEY `documents_waiting_reason_index` (`waiting_reason`),
  ADD KEY `documents_abandoned_cart_mailing_sent_at_index` (`abandoned_cart_mailing_sent_at`),
  ADD KEY `documents_remark_protected_print_text_foreign` (`remark_protected_print_text`),
  ADD KEY `documents_remark_parcel_print_text_foreign` (`remark_parcel_print_text`),
  ADD KEY `documents_year_counter_index` (`year`,`counter`),
  ADD KEY `documents_parcel_code_index` (`parcel_code`),
  ADD KEY `documents_ordered_at_status_index` (`ordered_at`,`status`);

--
-- Indexes for table `document_position`
--
ALTER TABLE `document_position`
  ADD PRIMARY KEY (`id`),
  ADD KEY `document_position_document_id_foreign` (`document_id`),
  ADD KEY `document_position_position_id_foreign` (`position_id`);

--
-- Indexes for table `document_relations`
--
ALTER TABLE `document_relations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `document_relations_source_id_foreign` (`source_id`),
  ADD KEY `document_relations_target_id_foreign` (`target_id`);

--
-- Indexes for table `eans`
--
ALTER TABLE `eans`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `eans_year_item_id_ean_type_unique` (`year`,`item_id`,`ean_code`,`type`),
  ADD KEY `eans_ean_index` (`ean_code`),
  ADD KEY `eans_item_id_index` (`item_id`),
  ADD KEY `eans_year_index` (`year`);

--
-- Indexes for table `exceptions`
--
ALTER TABLE `exceptions`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indexes for table `forms`
--
ALTER TABLE `forms`
  ADD PRIMARY KEY (`id`),
  ADD KEY `forms_position_index` (`position`),
  ADD KEY `forms_created_by_id_foreign` (`created_by_id`),
  ADD KEY `forms_updated_by_id_foreign` (`updated_by_id`),
  ADD KEY `forms_last_saved_by_id_foreign` (`last_saved_by_id`),
  ADD KEY `forms_status_index` (`status`),
  ADD KEY `forms_page_id_foreign` (`page_id`);

--
-- Indexes for table `form_fields`
--
ALTER TABLE `form_fields`
  ADD PRIMARY KEY (`id`),
  ADD KEY `form_fields_form_id_position_index` (`form_id`,`position`),
  ADD KEY `form_fields_form_id_index` (`form_id`),
  ADD KEY `form_fields_position_index` (`position`),
  ADD KEY `form_fields_created_by_id_foreign` (`created_by_id`),
  ADD KEY `form_fields_updated_by_id_foreign` (`updated_by_id`),
  ADD KEY `form_fields_last_saved_by_id_foreign` (`last_saved_by_id`);

--
-- Indexes for table `form_submissions`
--
ALTER TABLE `form_submissions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `form_submissions_ip_id_foreign` (`ip_id`),
  ADD KEY `form_submissions_customer_id_foreign` (`customer_id`),
  ADD KEY `form_submissions_form_id_foreign` (`form_id`),
  ADD KEY `form_submissions_session_id_index` (`session_id`),
  ADD KEY `form_submissions_submitted_at_index` (`submitted_at`),
  ADD KEY `form_submissions_payment_intent_reference_index` (`payment_intent_id`),
  ADD KEY `form_submissions_email_index` (`email`),
  ADD KEY `form_submissions_user_agent_id_foreign` (`user_agent_id`),
  ADD KEY `form_submissions_uri_id_foreign` (`uri_id`),
  ADD KEY `form_submissions_document_id_foreign` (`document_id`);

--
-- Indexes for table `form_submission_fields`
--
ALTER TABLE `form_submission_fields`
  ADD PRIMARY KEY (`id`),
  ADD KEY `form_submission_fields_form_submission_id_foreign` (`form_submission_id`),
  ADD KEY `form_submission_fields_form_field_id_foreign` (`form_field_id`);

--
-- Indexes for table `houses`
--
ALTER TABLE `houses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `houses_house_id_index` (`house_id`),
  ADD KEY `houses_street_id_house_no_index` (`street_id`,`house_no`(10));

--
-- Indexes for table `imageables`
--
ALTER TABLE `imageables`
  ADD PRIMARY KEY (`id`),
  ADD KEY `imageables_imageable_type_imageable_id_position_index` (`imageable_type`,`imageable_id`,`position`),
  ADD KEY `imageables_image_id_index` (`image_id`),
  ADD KEY `imageables_created_by_id_foreign` (`created_by_id`),
  ADD KEY `imageables_updated_by_id_foreign` (`updated_by_id`);

--
-- Indexes for table `images`
--
ALTER TABLE `images`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `images_filename_unique` (`filename`);

--
-- Indexes for table `ips`
--
ALTER TABLE `ips`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ips_ip_index` (`ip_address`);

--
-- Indexes for table `items`
--
ALTER TABLE `items`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `items_item_no_unique` (`item_no`),
  ADD KEY `items_remark_text_id_foreign` (`remark_text_id`),
  ADD KEY `items_variant_parent_id_foreign` (`variant_parent_id`),
  ADD KEY `items_variant_type_1_id_foreign` (`variant_type_1_id`),
  ADD KEY `items_variant_type_2_id_foreign` (`variant_type_2_id`),
  ADD KEY `items_variant_type_3_id_foreign` (`variant_type_3_id`),
  ADD KEY `items_variant_type_4_id_foreign` (`variant_type_4_id`),
  ADD KEY `items_vat_id_foreign` (`vat_id`),
  ADD KEY `items_last_saved_by_id_foreign` (`last_saved_by_id`),
  ADD KEY `items_created_by_id_foreign` (`created_by_id`),
  ADD KEY `items_updated_by_id_foreign` (`updated_by_id`),
  ADD KEY `items_status_index` (`status`),
  ADD KEY `items_variant_type_1_value_index` (`variant_type_1_value`),
  ADD KEY `items_variant_type_2_value_index` (`variant_type_2_value`),
  ADD KEY `items_variant_type_3_value_index` (`variant_type_3_value`),
  ADD KEY `items_variant_type_4_value_index` (`variant_type_4_value`);

--
-- Indexes for table `item_groups`
--
ALTER TABLE `item_groups`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `item_groups_full_code_unique` (`full_code`(50)),
  ADD KEY `item_groups_parent_id_foreign` (`parent_id`),
  ADD KEY `item_groups_level_1(100)_index` (`level_1`(100)),
  ADD KEY `item_groups_level_2(100)_index` (`level_2`(100)),
  ADD KEY `item_groups_level_3(100)_index` (`level_3`(100)),
  ADD KEY `item_groups_level_4(100)_index` (`level_4`(100)),
  ADD KEY `item_groups_level_5(100)_index` (`level_5`(100)),
  ADD KEY `item_groups_level_6(100)_index` (`level_6`(100)),
  ADD KEY `item_groups_level_7(100)_index` (`level_7`(100)),
  ADD KEY `item_groups_level_8(100)_index` (`level_8`(100)),
  ADD KEY `item_groups_level_9(100)_index` (`level_9`(100)),
  ADD KEY `item_groups_level_1_id_index` (`level_1_id`),
  ADD KEY `item_groups_level_2_id_index` (`level_2_id`),
  ADD KEY `item_groups_level_3_id_index` (`level_3_id`),
  ADD KEY `item_groups_level_4_id_index` (`level_4_id`),
  ADD KEY `item_groups_level_5_id_index` (`level_5_id`),
  ADD KEY `item_groups_level_6_id_index` (`level_6_id`),
  ADD KEY `item_groups_level_7_id_index` (`level_7_id`),
  ADD KEY `item_groups_level_8_id_index` (`level_8_id`),
  ADD KEY `item_groups_level_9_id_index` (`level_9_id`),
  ADD KEY `item_groups_parent_id_has_web_items_index` (`parent_id`,`has_web_items`),
  ADD KEY `item_groups_vat_id_foreign` (`vat_id`);

--
-- Indexes for table `item_item_group`
--
ALTER TABLE `item_item_group`
  ADD PRIMARY KEY (`id`),
  ADD KEY `item_item_group_item_group_id_foreign` (`item_group_id`),
  ADD KEY `item_item_group_item_id_item_group_id_type_main_index` (`item_id`,`item_group_id`,`type`,`main`);

--
-- Indexes for table `jobs`
--
ALTER TABLE `jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `jobs_queue_index` (`queue`);

--
-- Indexes for table `messages`
--
ALTER TABLE `messages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `messages_queue_index` (`queue_name`),
  ADD KEY `messages_status_index` (`status`),
  ADD KEY `messages_created_by_id_foreign` (`created_by_id`),
  ADD KEY `messages_messageable_type_messageable_id_index` (`messageable_type`,`messageable_id`),
  ADD KEY `messages_page_id_foreign` (`page_id`),
  ADD KEY `messages_subject_text_id_foreign` (`subject_text_id`);

--
-- Indexes for table `message_recipient`
--
ALTER TABLE `message_recipient`
  ADD PRIMARY KEY (`id`),
  ADD KEY `message_recipient_message_id_foreign` (`message_id`),
  ADD KEY `message_recipient_recipient_id_foreign` (`recipient_id`);

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `pages`
--
ALTER TABLE `pages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pages_country_id_index` (`country_id`),
  ADD KEY `pages_form_id_when_block_foreign` (`form_id`),
  ADD KEY `pages_item_id_index` (`item_id`) USING BTREE,
  ADD KEY `pages_item_group_id_index` (`item_group_id`) USING BTREE,
  ADD KEY `pages_parent_id_foreign` (`parent_id`),
  ADD KEY `pages_sw_wizard_name_index` (`sw_wizard_name`),
  ADD KEY `pages_created_by_id_foreign` (`created_by_id`),
  ADD KEY `pages_updated_by_id_foreign` (`updated_by_id`),
  ADD KEY `pages_last_saved_by_id_foreign` (`last_saved_by_id`),
  ADD KEY `pages_form_field_id_foreign` (`form_field_id`);

--
-- Indexes for table `page_tag`
--
ALTER TABLE `page_tag`
  ADD PRIMARY KEY (`id`),
  ADD KEY `page_tag_page_id_foreign` (`page_id`),
  ADD KEY `page_tag_tag_id_foreign` (`tag_id`);

--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
  ADD KEY `password_resets_email_index` (`email`),
  ADD KEY `password_resets_token_index` (`token`);

--
-- Indexes for table `password_reset_tokens`
--
ALTER TABLE `password_reset_tokens`
  ADD PRIMARY KEY (`email`);

--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payments_paid_at_index` (`paid_at`),
  ADD KEY `payments_reference_index` (`reference`),
  ADD KEY `payments_order_no_index` (`order_no`),
  ADD KEY `payments_payment_package_id_foreign` (`payment_package_id`),
  ADD KEY `payments_imported_reference_index` (`imported_reference`),
  ADD KEY `payments_payment_method_id_foreign` (`payment_method_id`),
  ADD KEY `payments_document_id_foreign` (`document_id`),
  ADD KEY `payments_customer_id_foreign` (`customer_id`),
  ADD KEY `payments_customer_document_id_foreign` (`customer_document_id`),
  ADD KEY `payments_related_id_index` (`related_id`),
  ADD KEY `payments_updated_by_id_foreign` (`updated_by_id`),
  ADD KEY `payments_created_by_id_foreign` (`created_by_id`);

--
-- Indexes for table `payment_methods`
--
ALTER TABLE `payment_methods`
  ADD PRIMARY KEY (`id`),
  ADD KEY `providers_prio_index` (`position`),
  ADD KEY `payment_methods_web_index` (`web`),
  ADD KEY `payment_methods_pos_index` (`pos`);

--
-- Indexes for table `payment_packages`
--
ALTER TABLE `payment_packages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payment_packages_bank_id_foreign` (`bank_id`);

--
-- Indexes for table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`);

--
-- Indexes for table `positions`
--
ALTER TABLE `positions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `positions_pricelist_id_foreign` (`pricelist_id`),
  ADD KEY `positions_description_text_foreign` (`description_text`),
  ADD KEY `positions_remark_print_text_foreign` (`remark_print_text`),
  ADD KEY `positions_item_id_index` (`item_id`),
  ADD KEY `positions_payment_id_foreign` (`payment_id`),
  ADD KEY `positions_shipped_document_id_foreign` (`stock_document_id`),
  ADD KEY `positions_vat_id_foreign` (`vat_id`),
  ADD KEY `positions_item_id_stock_at_index` (`item_id`,`stock_at`);

--
-- Indexes for table `position_relations`
--
ALTER TABLE `position_relations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `position_relations_parent_id_foreign` (`parent_id`),
  ADD KEY `position_relations_child_id_foreign` (`child_id`);

--
-- Indexes for table `pricelists`
--
ALTER TABLE `pricelists`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `pricelists_id_unique` (`id`),
  ADD KEY `pricelists_parent_id_foreign` (`parent_id`),
  ADD KEY `pricelists_year_position_index` (`year`,`position`);

--
-- Indexes for table `pricelists_subtypes`
--
ALTER TABLE `pricelists_subtypes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pricelists_subtypes_pricelist_id_index` (`pricelist_id`) USING BTREE,
  ADD KEY `pricelists_subtypes_subtype_index` (`subtype`) USING BTREE;

--
-- Indexes for table `prices`
--
ALTER TABLE `prices`
  ADD PRIMARY KEY (`id`),
  ADD KEY `prices_item_id_index` (`item_id`),
  ADD KEY `prices_item_group_id_foreign` (`item_group_id`),
  ADD KEY `prices_item_id_valid_from_valid_to_index` (`item_id`,`valid_from`,`valid_to`),
  ADD KEY `prices_item_id_pricelist_id_index` (`item_id`,`pricelist_id`),
  ADD KEY `prices_pricelist_id_foreign` (`pricelist_id`),
  ADD KEY `prices_created_by_id_foreign` (`created_by_id`),
  ADD KEY `prices_updated_by_id_foreign` (`updated_by_id`);

--
-- Indexes for table `recipients`
--
ALTER TABLE `recipients`
  ADD PRIMARY KEY (`id`),
  ADD KEY `recipients_email_index` (`email`),
  ADD KEY `recipients_name_index` (`name`);

--
-- Indexes for table `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

--
-- Indexes for table `settings`
--
ALTER TABLE `settings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `settings_created_by_id_foreign` (`created_by_id`),
  ADD KEY `settings_updated_by_id_foreign` (`updated_by_id`),
  ADD KEY `settings_name_id_index` (`name`,`id`);

--
-- Indexes for table `shippings`
--
ALTER TABLE `shippings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `shippings_courier_id_foreign` (`courier_id`),
  ADD KEY `shippings_transmission_status_index` (`transmission_status`),
  ADD KEY `shippings_transmission_reply_id_index` (`transmission_reply_id`);

--
-- Indexes for table `streets`
--
ALTER TABLE `streets`
  ADD PRIMARY KEY (`id`),
  ADD KEY `streets_city_id_street_index` (`city_id`,`street`(100));

--
-- Indexes for table `tags`
--
ALTER TABLE `tags`
  ADD PRIMARY KEY (`id`),
  ADD KEY `tags_parent_id_foreign` (`parent_id`),
  ADD KEY `tags_sort_string_index` (`sort_string`);

--
-- Indexes for table `texts`
--
ALTER TABLE `texts`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `texts_hash_unique` (`hash`);

--
-- Indexes for table `unique_identifiers`
--
ALTER TABLE `unique_identifiers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_identifiers_uuid_unique` (`uuid`),
  ADD KEY `unique_identifiers_table_id_index` (`table_id`),
  ADD KEY `unique_identifiers_type_index` (`type`);

--
-- Indexes for table `uris`
--
ALTER TABLE `uris`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uris_uri_session_id_unique` (`uri_address`,`session_id`),
  ADD KEY `uris_page_id_id_index` (`page_id`,`id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `users_email_unique` (`email`),
  ADD KEY `users_remark_text_foreign` (`remark_text`),
  ADD KEY `users_status_index` (`status`),
  ADD KEY `users_notification_medium_index` (`notification_medium`),
  ADD KEY `users_stripe_id_index` (`stripe_id`);

--
-- Indexes for table `user_agents`
--
ALTER TABLE `user_agents`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_agents_user_agent_text_index` (`user_agent_text`(1024));

--
-- Indexes for table `variant_types`
--
ALTER TABLE `variant_types`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `vats`
--
ALTER TABLE `vats`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `addresses`
--
ALTER TABLE `addresses`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `banks`
--
ALTER TABLE `banks`
  MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `cash_registers`
--
ALTER TABLE `cash_registers`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `cities`
--
ALTER TABLE `cities`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `clients`
--
ALTER TABLE `clients`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `contents`
--
ALTER TABLE `contents`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `counters`
--
ALTER TABLE `counters`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `countries`
--
ALTER TABLE `countries`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `coupons`
--
ALTER TABLE `coupons`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `coupon_document`
--
ALTER TABLE `coupon_document`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `coupon_item`
--
ALTER TABLE `coupon_item`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `couriers`
--
ALTER TABLE `couriers`
  MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `courier_services`
--
ALTER TABLE `courier_services`
  MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `courier_service_fees`
--
ALTER TABLE `courier_service_fees`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `customers`
--
ALTER TABLE `customers`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `customer_relations`
--
ALTER TABLE `customer_relations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `customer_sources`
--
ALTER TABLE `customer_sources`
  MODIFY `id` smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `documents`
--
ALTER TABLE `documents`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `document_position`
--
ALTER TABLE `document_position`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `document_relations`
--
ALTER TABLE `document_relations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `eans`
--
ALTER TABLE `eans`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `exceptions`
--
ALTER TABLE `exceptions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `forms`
--
ALTER TABLE `forms`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `form_fields`
--
ALTER TABLE `form_fields`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `form_submissions`
--
ALTER TABLE `form_submissions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `form_submission_fields`
--
ALTER TABLE `form_submission_fields`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `houses`
--
ALTER TABLE `houses`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `imageables`
--
ALTER TABLE `imageables`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `images`
--
ALTER TABLE `images`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ips`
--
ALTER TABLE `ips`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `items`
--
ALTER TABLE `items`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `item_groups`
--
ALTER TABLE `item_groups`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `item_item_group`
--
ALTER TABLE `item_item_group`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `jobs`
--
ALTER TABLE `jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `messages`
--
ALTER TABLE `messages`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `message_recipient`
--
ALTER TABLE `message_recipient`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=75;

--
-- AUTO_INCREMENT for table `pages`
--
ALTER TABLE `pages`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `page_tag`
--
ALTER TABLE `page_tag`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `payments`
--
ALTER TABLE `payments`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `payment_methods`
--
ALTER TABLE `payment_methods`
  MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `payment_packages`
--
ALTER TABLE `payment_packages`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `positions`
--
ALTER TABLE `positions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `position_relations`
--
ALTER TABLE `position_relations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `pricelists`
--
ALTER TABLE `pricelists`
  MODIFY `id` smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `pricelists_subtypes`
--
ALTER TABLE `pricelists_subtypes`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `prices`
--
ALTER TABLE `prices`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `recipients`
--
ALTER TABLE `recipients`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `settings`
--
ALTER TABLE `settings`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `shippings`
--
ALTER TABLE `shippings`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `streets`
--
ALTER TABLE `streets`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tags`
--
ALTER TABLE `tags`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `texts`
--
ALTER TABLE `texts`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `unique_identifiers`
--
ALTER TABLE `unique_identifiers`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `uris`
--
ALTER TABLE `uris`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_agents`
--
ALTER TABLE `user_agents`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `variant_types`
--
ALTER TABLE `variant_types`
  MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `vats`
--
ALTER TABLE `vats`
  MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `addresses`
--
ALTER TABLE `addresses`
  ADD CONSTRAINT `addresses_city_id_foreign` FOREIGN KEY (`city_id`) REFERENCES `cities` (`id`),
  ADD CONSTRAINT `addresses_house_id_foreign` FOREIGN KEY (`house_id`) REFERENCES `houses` (`id`),
  ADD CONSTRAINT `addresses_street_id_foreign` FOREIGN KEY (`street_id`) REFERENCES `streets` (`id`);

--
-- Constraints for table `cash_registers`
--
ALTER TABLE `cash_registers`
  ADD CONSTRAINT `cash_registers_city_id_foreign` FOREIGN KEY (`city_id`) REFERENCES `cities` (`id`);

--
-- Constraints for table `clients`
--
ALTER TABLE `clients`
  ADD CONSTRAINT `clients_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `clients` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `coupons`
--
ALTER TABLE `coupons`
  ADD CONSTRAINT `coupons_discount_pricelist_id_foreign` FOREIGN KEY (`discount_pricelist_id`) REFERENCES `pricelists` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `coupons_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `coupons` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `coupon_document`
--
ALTER TABLE `coupon_document`
  ADD CONSTRAINT `coupon_document_coupon_id_foreign` FOREIGN KEY (`coupon_id`) REFERENCES `coupons` (`id`),
  ADD CONSTRAINT `coupon_document_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`);

--
-- Constraints for table `coupon_item`
--
ALTER TABLE `coupon_item`
  ADD CONSTRAINT `coupon_item_coupon_id_foreign` FOREIGN KEY (`coupon_id`) REFERENCES `coupons` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `couriers`
--
ALTER TABLE `couriers`
  ADD CONSTRAINT `couriers_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `couriers` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `courier_services`
--
ALTER TABLE `courier_services`
  ADD CONSTRAINT `courier_services_courier_id_foreign` FOREIGN KEY (`courier_id`) REFERENCES `couriers` (`id`);

--
-- Constraints for table `customers`
--
ALTER TABLE `customers`
  ADD CONSTRAINT `customers_address_id_foreign` FOREIGN KEY (`address_id`) REFERENCES `addresses` (`id`),
  ADD CONSTRAINT `customers_courier_id_foreign` FOREIGN KEY (`courier_id`) REFERENCES `couriers` (`id`),
  ADD CONSTRAINT `customers_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `customers_gdpr_allowed_ip_id_foreign` FOREIGN KEY (`gdpr_allowed_ip_id`) REFERENCES `ips` (`id`),
  ADD CONSTRAINT `customers_last_saved_by_id_foreign` FOREIGN KEY (`last_saved_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `customers_pricelist_id_foreign` FOREIGN KEY (`pricelist_id`) REFERENCES `pricelists` (`id`),
  ADD CONSTRAINT `customers_remark_text_foreign` FOREIGN KEY (`remark_text`) REFERENCES `texts` (`id`),
  ADD CONSTRAINT `customers_source_id_foreign` FOREIGN KEY (`source_id`) REFERENCES `customer_sources` (`id`),
  ADD CONSTRAINT `customers_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `customers_warning_text_foreign` FOREIGN KEY (`warning_text`) REFERENCES `texts` (`id`);

--
-- Constraints for table `customer_relations`
--
ALTER TABLE `customer_relations`
  ADD CONSTRAINT `customer_relations_child_id_foreign` FOREIGN KEY (`child_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `customer_relations_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `customers` (`id`);

--
-- Constraints for table `documents`
--
ALTER TABLE `documents`
  ADD CONSTRAINT `documents_address_id_foreign` FOREIGN KEY (`address_id`) REFERENCES `addresses` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `documents_buyer_id_foreign` FOREIGN KEY (`buyer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `documents_cash_register_id_foreign` FOREIGN KEY (`cash_register_id`) REFERENCES `cash_registers` (`id`),
  ADD CONSTRAINT `documents_courier_id_foreign` FOREIGN KEY (`courier_id`) REFERENCES `couriers` (`id`),
  ADD CONSTRAINT `documents_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `documents_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `documents_customer_unique_identifier_id_foreign` FOREIGN KEY (`customer_unique_identifier_id`) REFERENCES `unique_identifiers` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `documents_form_submission_id_foreign` FOREIGN KEY (`form_submission_id`) REFERENCES `form_submissions` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `documents_ip_id_foreign` FOREIGN KEY (`ip_id`) REFERENCES `ips` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `documents_issued_by_id_foreign` FOREIGN KEY (`issued_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `documents_issued_by_text_foreign` FOREIGN KEY (`issued_by_text`) REFERENCES `texts` (`id`),
  ADD CONSTRAINT `documents_issued_city_id_foreign` FOREIGN KEY (`issued_city_id`) REFERENCES `cities` (`id`),
  ADD CONSTRAINT `documents_last_saved_by_id_foreign` FOREIGN KEY (`last_saved_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `documents_log_text_foreign` FOREIGN KEY (`log_text`) REFERENCES `texts` (`id`),
  ADD CONSTRAINT `documents_origin_id_foreign` FOREIGN KEY (`origin_id`) REFERENCES `documents` (`id`),
  ADD CONSTRAINT `documents_payment_method_id_foreign` FOREIGN KEY (`payment_method_id`) REFERENCES `payment_methods` (`id`),
  ADD CONSTRAINT `documents_pricelist_id_foreign` FOREIGN KEY (`pricelist_id`) REFERENCES `pricelists` (`id`),
  ADD CONSTRAINT `documents_remark_internal_text_foreign` FOREIGN KEY (`remark_internal_text`) REFERENCES `texts` (`id`),
  ADD CONSTRAINT `documents_remark_parcel_print_text_foreign` FOREIGN KEY (`remark_parcel_print_text`) REFERENCES `texts` (`id`),
  ADD CONSTRAINT `documents_remark_print_text_foreign` FOREIGN KEY (`remark_print_text`) REFERENCES `texts` (`id`),
  ADD CONSTRAINT `documents_remark_protected_print_text_foreign` FOREIGN KEY (`remark_protected_print_text`) REFERENCES `texts` (`id`),
  ADD CONSTRAINT `documents_ship_to_id_foreign` FOREIGN KEY (`ship_to_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `documents_shipping_id_foreign` FOREIGN KEY (`shipping_id`) REFERENCES `shippings` (`id`),
  ADD CONSTRAINT `documents_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `documents_user_agent_text_foreign` FOREIGN KEY (`user_agent_text`) REFERENCES `texts` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `document_position`
--
ALTER TABLE `document_position`
  ADD CONSTRAINT `document_position_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`),
  ADD CONSTRAINT `document_position_position_id_foreign` FOREIGN KEY (`position_id`) REFERENCES `positions` (`id`);

--
-- Constraints for table `document_relations`
--
ALTER TABLE `document_relations`
  ADD CONSTRAINT `document_relations_source_id_foreign` FOREIGN KEY (`source_id`) REFERENCES `documents` (`id`),
  ADD CONSTRAINT `document_relations_target_id_foreign` FOREIGN KEY (`target_id`) REFERENCES `documents` (`id`);

--
-- Constraints for table `forms`
--
ALTER TABLE `forms`
  ADD CONSTRAINT `forms_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `forms_last_saved_by_id_foreign` FOREIGN KEY (`last_saved_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `forms_page_id_foreign` FOREIGN KEY (`page_id`) REFERENCES `pages` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `forms_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `form_fields`
--
ALTER TABLE `form_fields`
  ADD CONSTRAINT `form_fields_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `form_fields_form_id_foreign` FOREIGN KEY (`form_id`) REFERENCES `forms` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `form_fields_last_saved_by_id_foreign` FOREIGN KEY (`last_saved_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `form_fields_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `form_submissions`
--
ALTER TABLE `form_submissions`
  ADD CONSTRAINT `form_submissions_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `form_submissions_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `form_submissions_form_id_foreign` FOREIGN KEY (`form_id`) REFERENCES `forms` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `form_submissions_ip_id_foreign` FOREIGN KEY (`ip_id`) REFERENCES `ips` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `form_submissions_uri_id_foreign` FOREIGN KEY (`uri_id`) REFERENCES `uris` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `form_submissions_user_agent_id_foreign` FOREIGN KEY (`user_agent_id`) REFERENCES `user_agents` (`id`);

--
-- Constraints for table `form_submission_fields`
--
ALTER TABLE `form_submission_fields`
  ADD CONSTRAINT `form_submission_fields_form_field_id_foreign` FOREIGN KEY (`form_field_id`) REFERENCES `form_fields` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `form_submission_fields_form_submission_id_foreign` FOREIGN KEY (`form_submission_id`) REFERENCES `form_submissions` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `houses`
--
ALTER TABLE `houses`
  ADD CONSTRAINT `houses_street_id_foreign` FOREIGN KEY (`street_id`) REFERENCES `streets` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `imageables`
--
ALTER TABLE `imageables`
  ADD CONSTRAINT `imageables_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `imageables_image_id_foreign` FOREIGN KEY (`image_id`) REFERENCES `images` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `imageables_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `items`
--
ALTER TABLE `items`
  ADD CONSTRAINT `items_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `items_last_saved_by_id_foreign` FOREIGN KEY (`last_saved_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `items_remark_text_id_foreign` FOREIGN KEY (`remark_text_id`) REFERENCES `texts` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `items_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `items_variant_parent_id_foreign` FOREIGN KEY (`variant_parent_id`) REFERENCES `items` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `items_variant_type_1_id_foreign` FOREIGN KEY (`variant_type_1_id`) REFERENCES `variant_types` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `items_variant_type_2_id_foreign` FOREIGN KEY (`variant_type_2_id`) REFERENCES `variant_types` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `items_variant_type_3_id_foreign` FOREIGN KEY (`variant_type_3_id`) REFERENCES `variant_types` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `items_variant_type_4_id_foreign` FOREIGN KEY (`variant_type_4_id`) REFERENCES `variant_types` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `items_vat_id_foreign` FOREIGN KEY (`vat_id`) REFERENCES `vats` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `item_groups`
--
ALTER TABLE `item_groups`
  ADD CONSTRAINT `item_groups_level_1_id_foreign` FOREIGN KEY (`level_1_id`) REFERENCES `item_groups` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `item_groups_level_2_id_foreign` FOREIGN KEY (`level_2_id`) REFERENCES `item_groups` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `item_groups_level_3_id_foreign` FOREIGN KEY (`level_3_id`) REFERENCES `item_groups` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `item_groups_level_4_id_foreign` FOREIGN KEY (`level_4_id`) REFERENCES `item_groups` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `item_groups_level_5_id_foreign` FOREIGN KEY (`level_5_id`) REFERENCES `item_groups` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `item_groups_level_6_id_foreign` FOREIGN KEY (`level_6_id`) REFERENCES `item_groups` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `item_groups_level_7_id_foreign` FOREIGN KEY (`level_7_id`) REFERENCES `item_groups` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `item_groups_level_8_id_foreign` FOREIGN KEY (`level_8_id`) REFERENCES `item_groups` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `item_groups_level_9_id_foreign` FOREIGN KEY (`level_9_id`) REFERENCES `item_groups` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `item_groups_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `item_groups` (`id`),
  ADD CONSTRAINT `item_groups_vat_id_foreign` FOREIGN KEY (`vat_id`) REFERENCES `vats` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `item_item_group`
--
ALTER TABLE `item_item_group`
  ADD CONSTRAINT `item_item_group_item_group_id_foreign` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `messages`
--
ALTER TABLE `messages`
  ADD CONSTRAINT `messages_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `messages_page_id_foreign` FOREIGN KEY (`page_id`) REFERENCES `pages` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `messages_subject_text_id_foreign` FOREIGN KEY (`subject_text_id`) REFERENCES `texts` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `message_recipient`
--
ALTER TABLE `message_recipient`
  ADD CONSTRAINT `message_recipient_message_id_foreign` FOREIGN KEY (`message_id`) REFERENCES `messages` (`id`),
  ADD CONSTRAINT `message_recipient_recipient_id_foreign` FOREIGN KEY (`recipient_id`) REFERENCES `recipients` (`id`);

--
-- Constraints for table `pages`
--
ALTER TABLE `pages`
  ADD CONSTRAINT `pages_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `pages_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `pages_form_field_id_foreign` FOREIGN KEY (`form_field_id`) REFERENCES `form_fields` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `pages_form_id_foreign` FOREIGN KEY (`form_id`) REFERENCES `forms` (`id`),
  ADD CONSTRAINT `pages_item_group_id_foreign` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `pages_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `pages_last_saved_by_id_foreign` FOREIGN KEY (`last_saved_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `pages_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `pages` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `pages_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `page_tag`
--
ALTER TABLE `page_tag`
  ADD CONSTRAINT `page_tag_page_id_foreign` FOREIGN KEY (`page_id`) REFERENCES `pages` (`id`),
  ADD CONSTRAINT `page_tag_tag_id_foreign` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`);

--
-- Constraints for table `payments`
--
ALTER TABLE `payments`
  ADD CONSTRAINT `payments_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `payments_customer_document_id_foreign` FOREIGN KEY (`customer_document_id`) REFERENCES `documents` (`id`),
  ADD CONSTRAINT `payments_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `payments_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`),
  ADD CONSTRAINT `payments_payment_method_id_foreign` FOREIGN KEY (`payment_method_id`) REFERENCES `payment_methods` (`id`),
  ADD CONSTRAINT `payments_payment_package_id_foreign` FOREIGN KEY (`payment_package_id`) REFERENCES `payment_packages` (`id`),
  ADD CONSTRAINT `payments_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `payment_packages`
--
ALTER TABLE `payment_packages`
  ADD CONSTRAINT `payment_packages_bank_id_foreign` FOREIGN KEY (`bank_id`) REFERENCES `banks` (`id`);

--
-- Constraints for table `positions`
--
ALTER TABLE `positions`
  ADD CONSTRAINT `positions_description_text_foreign` FOREIGN KEY (`description_text`) REFERENCES `texts` (`id`),
  ADD CONSTRAINT `positions_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `positions_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`),
  ADD CONSTRAINT `positions_pricelist_id_foreign` FOREIGN KEY (`pricelist_id`) REFERENCES `pricelists` (`id`),
  ADD CONSTRAINT `positions_remark_print_text_foreign` FOREIGN KEY (`remark_print_text`) REFERENCES `texts` (`id`),
  ADD CONSTRAINT `positions_shipped_document_id_foreign` FOREIGN KEY (`stock_document_id`) REFERENCES `documents` (`id`),
  ADD CONSTRAINT `positions_vat_id_foreign` FOREIGN KEY (`vat_id`) REFERENCES `vats` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `position_relations`
--
ALTER TABLE `position_relations`
  ADD CONSTRAINT `position_relations_child_id_foreign` FOREIGN KEY (`child_id`) REFERENCES `positions` (`id`),
  ADD CONSTRAINT `position_relations_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `positions` (`id`);

--
-- Constraints for table `pricelists`
--
ALTER TABLE `pricelists`
  ADD CONSTRAINT `pricelists_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `pricelists` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `pricelists_subtypes`
--
ALTER TABLE `pricelists_subtypes`
  ADD CONSTRAINT `pricelists_subtypes_pricelist_id_foreign` FOREIGN KEY (`pricelist_id`) REFERENCES `pricelists` (`id`);

--
-- Constraints for table `prices`
--
ALTER TABLE `prices`
  ADD CONSTRAINT `prices_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `prices_item_group_id_foreign` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`id`),
  ADD CONSTRAINT `prices_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `prices_pricelist_id_foreign` FOREIGN KEY (`pricelist_id`) REFERENCES `pricelists` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `prices_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `sessions`
--
ALTER TABLE `sessions`
  ADD CONSTRAINT `sessions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `settings`
--
ALTER TABLE `settings`
  ADD CONSTRAINT `settings_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `settings_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `shippings`
--
ALTER TABLE `shippings`
  ADD CONSTRAINT `shippings_courier_id_foreign` FOREIGN KEY (`courier_id`) REFERENCES `couriers` (`id`);

--
-- Constraints for table `streets`
--
ALTER TABLE `streets`
  ADD CONSTRAINT `streets_city_id_foreign` FOREIGN KEY (`city_id`) REFERENCES `cities` (`id`);

--
-- Constraints for table `tags`
--
ALTER TABLE `tags`
  ADD CONSTRAINT `tags_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `tags` (`id`);

--
-- Constraints for table `uris`
--
ALTER TABLE `uris`
  ADD CONSTRAINT `uris_page_id_foreign` FOREIGN KEY (`page_id`) REFERENCES `pages` (`id`);

--
-- Constraints for table `users`
--
ALTER TABLE `users`
  ADD CONSTRAINT `users_remark_text_foreign` FOREIGN KEY (`remark_text`) REFERENCES `texts` (`id`);
SET FOREIGN_KEY_CHECKS=1;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
