-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: May 23, 2024 at 05:35 PM
-- Server version: 10.6.18-MariaDB
-- PHP Version: 8.2.4

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_monima-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` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL COMMENT 'Ime osebe. Če stranka ni oseba, pusti prazno.',
  `last_name` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL COMMENT 'Priimek osebe. Če stranka ni oseba, pusti prazno.',
  `company` text CHARACTER SET utf8mb3 COLLATE utf8mb3_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` text CHARACTER SET utf8mb3 COLLATE utf8mb3_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 utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL COMMENT 'Hišna številka.',
  `address_line_2` text CHARACTER SET utf8mb3 COLLATE utf8mb3_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 utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL COMMENT 'Poštna številka.',
  `city` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL COMMENT 'Naziv kraja.',
  `state` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL COMMENT 'Regija, zvezna država, provinca, …',
  `country` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL COMMENT 'Država.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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` text NOT NULL COMMENT 'BIC banke.',
  `naziv` text DEFAULT NULL COMMENT 'Naziv banke.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `campaigns`
--

CREATE TABLE `campaigns` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` text NOT NULL COMMENT 'Ime kampanje.',
  `description` text DEFAULT NULL COMMENT 'Opis kampanje.',
  `actions` text DEFAULT NULL COMMENT 'Predvidene akcije kampanje, skupaj z datumi, npr. Mailing Ta In Ta dne 29.2.2018.',
  `valid_from` timestamp NULL DEFAULT NULL COMMENT 'Začetek veljavnosti kampanje.',
  `valid_to` timestamp NULL DEFAULT NULL COMMENT 'Konec veljavnosti kampanje',
  `uuid_valid_to` timestamp NULL DEFAULT NULL COMMENT 'Do kdaj lahko naročnik izvede akcijo v poslanem sporočilu.',
  `quick_order_links` tinyint(4) DEFAULT NULL COMMENT 'Ali naj se ob izvozu kampanje kreirajo tudi povezave na pristajalno stran za hitro naročanje?',
  `uuid_confirm_url` text DEFAULT NULL COMMENT 'URL naslov POTRDITVENE povezave v elektronskem sporočilu (stranka nam da soglasje). Običajno se ji na strani zahvalimo za zaupanje. Odločitev stranke se samodejno zapiše v bazo. Vpišite celoten URL naslov, skupaj z https://, npr. https://www.domena.si/potrditev.',
  `uuid_reject_url` text DEFAULT NULL COMMENT 'URL naslov ZAVRNITVENE povezave v elektronskem sporočilu (stranka nam ne da soglasja). Običajno se ji na strani zahvalimo za zaupanje, lahko pa ji ponudimo še druge opcije. Odločitev stranke se samodejno zapiše v bazo. Vpišite celoten URL naslov, skupaj z https://, npr. https://www.domena.si/zavrnitev.',
  `profile_id` smallint(5) UNSIGNED DEFAULT NULL COMMENT 'Profil kupcev, na katero cilja kampanja. Če kampanja cilja na vse kupce, pustite prazno.',
  `pricelist_id` smallint(5) UNSIGNED DEFAULT NULL COMMENT 'Cenik, ki je narejen posebej za to kampanjo (če obstaja).',
  `campaign_status` text DEFAULT NULL COMMENT 'Status kampanje. Lahko je Osnutek, V pošiljanju al Poslano',
  `ctr_percent` decimal(7,4) DEFAULT NULL COMMENT 'Delež klikov (click-through rate): kolikšen odstotek strank je kliknil v mailu oz drugačni vrsti elektronske reklame.',
  `conversion_percent` decimal(7,4) DEFAULT NULL COMMENT 'Delež strank, ki je oddal naročilo v kampanji.',
  `orders_count` int(11) DEFAULT NULL COMMENT 'Število naročil, ki smo jih dobili znotraj kampanje.',
  `orders_amount` decimal(10,4) DEFAULT NULL COMMENT 'Skupna vrednost naročil, ki smo jih dobili znotraj kampanje.',
  `average_order_amount` decimal(10,4) DEFAULT NULL COMMENT 'Povprečna vrednost naročila znotraj kampanje.',
  `delivered_amount` decimal(10,4) DEFAULT NULL COMMENT 'Vrednost dobavljenih naročil znotraj kampanje.',
  `rvc_percent` decimal(7,4) DEFAULT NULL COMMENT 'Odstotek RVC, računan za vsa naročila v kampanji.',
  `rvc_amount` decimal(10,4) DEFAULT NULL COMMENT 'Skupni znesek RVC za vsa naročila v kampanji.',
  `last_exported_at` timestamp NULL DEFAULT NULL COMMENT 'Kdaj je bila kampanja prenešena v MailerLite.',
  `last_exported_by_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'Uporabnik, ki je prenesel kampanjo v MailerLite.',
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` bigint(20) UNSIGNED NOT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED NOT NULL,
  `last_saved_at` timestamp NULL DEFAULT NULL,
  `last_saved_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

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

CREATE TABLE `cash_registers` (
  `id` int(10) UNSIGNED NOT NULL,
  `identifier` text 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` text DEFAULT NULL COMMENT 'Javni IP - določimo blagajne v fizični poslovni enoti. Če IP ni vpisan, je blagajna mobilna',
  `local_ip` text 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=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

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

CREATE TABLE `cities` (
  `id` int(10) UNSIGNED NOT NULL,
  `city` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL COMMENT 'Naziv kraja.',
  `zip` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL COMMENT 'Poštna številka.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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) DEFAULT NULL COMMENT 'Status stranke. Opisi so v tables.php',
  `name` text DEFAULT NULL COMMENT 'Naziv stranke. Vpišite kratek naziv podjetja ali organizacije.',
  `email` text DEFAULT NULL COMMENT 'Splošni e-mail naslov. Če ni drugje določeno, se podjetje predstavlja s tem e-mail naslovom.',
  `remark` text DEFAULT NULL,
  `identifier` text NOT NULL COMMENT 'Unikatna oznaka stranke. Dobiš jo iz Site::clientIdentifier() metode',
  `country_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Osnovni jezik, ki ga uporablja stranka. Določene strani na spletnem mestu so lahko tudi v drugem jeziku.',
  `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` text DEFAULT NULL COMMENT 'Številka stranke za google tag manager, npr. GTM-5XLM4JS.',
  `google_analytics_tracking_id` text DEFAULT NULL COMMENT 'Tracking ID koda za Google Analytics. Če imate Google Tag Manager in če ste v njem nastavili Google Analytics, potem pustite to polje prazno!',
  `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=utf8mb3 COLLATE=utf8mb3_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` text NOT NULL COMMENT 'Naziv države v angleščini, npr. za Nemčijo je to Germany.',
  `local_name` text NOT NULL COMMENT 'Naziv države v jeziku države, npr. za Nemčijo je to Deutschland.',
  `flag_image` text 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` text DEFAULT NULL COMMENT 'Naziv jezika v angleščini, npr. German.',
  `local_language_name` text DEFAULT NULL COMMENT 'Naziv jezika v v jeziku države, npr. Deutsch.',
  `currency_symbol` text DEFAULT NULL COMMENT 'Simbol valute, kot se izpiše na spletni strani in v Monimi, npr. €.',
  `currency_code` text 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=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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` text NOT NULL COMMENT 'Naziv dostavne službe.',
  `web_label` text 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=utf8mb3 COLLATE=utf8mb3_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` text 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=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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` text DEFAULT NULL COMMENT 'E-mail naslov stranke. S tem se tudi prijavlja v sistem.',
  `email_2` text DEFAULT NULL COMMENT 'Drugi email naslov stranke.',
  `email_3` text DEFAULT NULL COMMENT 'Tretji email naslov stranke.',
  `www` text 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` text DEFAULT NULL COMMENT 'Mobilna telefonska številka. Dovoljena je samo ena številka.',
  `mobile_2` text DEFAULT NULL COMMENT 'Druga mobilna telefonska številka. V polju je dovoljena samo ena telefonska številka.',
  `mobile_3` text DEFAULT NULL COMMENT 'Tretja mobilna telefonska številka. V polju je dovoljena samo ena telefonska številka.',
  `phone` text DEFAULT NULL COMMENT 'Stacionarna telefonska številka. Dovoljena je samo ena številka.',
  `phone_2` text DEFAULT NULL COMMENT 'Druga stacionarna telefonska številka. V polju je dovoljena samo ena telefonska številka.',
  `phone_3` text DEFAULT NULL COMMENT 'Tretja stacionarna telefonska številka. V polju je dovoljena samo ena telefonska številka.',
  `fax` text DEFAULT NULL COMMENT 'Faks številka.',
  `davcna_st` text DEFAULT NULL COMMENT 'Davčna številka oz. ID za DDV.',
  `maticna_st` text DEFAULT NULL COMMENT 'Matična številka.',
  `zalozba` varchar(20) DEFAULT NULL COMMENT 'Oznaka založbe. Se ujema z items.zalozba.',
  `iban` text 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` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `last_saved_at` timestamp NULL DEFAULT NULL,
  `last_saved_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `customer_events`
--

CREATE TABLE `customer_events` (
  `id` int(10) UNSIGNED NOT NULL,
  `customer_id` int(10) UNSIGNED DEFAULT NULL,
  `type` tinyint(4) DEFAULT NULL COMMENT 'Tip dogodka. Vrednosti so v tables.php.',
  `event_date` timestamp NULL DEFAULT NULL COMMENT 'Datum dogodka.',
  `amount` decimal(10,4) DEFAULT NULL COMMENT 'Vrednost dogodka po maloprodajnih cenah.',
  `cost_amount` decimal(10,4) DEFAULT NULL COMMENT 'Vrednost dogodka po nabavnih cenah.',
  `remark` mediumtext DEFAULT NULL COMMENT 'Zaznamek oz. dodatne informacije k dogodku.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `customer_profile`
--

CREATE TABLE `customer_profile` (
  `id` int(10) UNSIGNED NOT NULL,
  `profile_id` smallint(5) UNSIGNED NOT NULL,
  `customer_id` int(10) UNSIGNED NOT NULL COMMENT 'Customers table - id.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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.',
  `order_group` int(10) UNSIGNED DEFAULT NULL COMMENT 'Številka naročila, na katerega je vezan ta dokument. Dokumenti z isto številko nosilnega naročila se obravnavajo skupaj. Pri nosilnem dokumentu pustite prazno. Prav tako pustite prazno, če dokument ni vezan.',
  `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` text 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` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'Uporabnik, ki je izdal dokument.',
  `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` text DEFAULT NULL COMMENT 'QR koda davčnega potrjevanja računov.',
  `zoi` text DEFAULT NULL COMMENT 'ZOI številka davčnega potrjevanja računov.',
  `eor` text 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` text 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` text 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_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` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'Uporabnik, ki je ustvaril zapis.',
  `updated_at` timestamp NULL DEFAULT NULL COMMENT 'Čas, ko je bil zapis nazadnje spremenjen (s katero koli proceduro).',
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'Uporabnik, ki je povzročil zadnjo spremembo zapisa (s katero koli proceduro).',
  `last_saved_at` timestamp NULL DEFAULT NULL COMMENT 'Čas, ko je uporabnik nazadnje shranil dokument (s klikom na gumb).',
  `last_saved_by_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'Uporabnik, ki je zadnji shranil zapis (s klikom na gumb).'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `document_costs`
--

CREATE TABLE `document_costs` (
  `id` int(10) UNSIGNED NOT NULL,
  `document_id` int(10) UNSIGNED NOT NULL COMMENT 'ID dokumenta (prevzemnice).',
  `type` tinyint(4) NOT NULL COMMENT 'Tip stroška.',
  `amount` decimal(10,4) NOT NULL DEFAULT 0.0000 COMMENT 'Znesek stroška brez DDV.',
  `documents` text DEFAULT NULL COMMENT 'Številke dokumentov, ki so osnova za kalkulacijo stroškov.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `document_counters`
--

CREATE TABLE `document_counters` (
  `id` int(10) UNSIGNED NOT NULL,
  `type` tinyint(4) NOT NULL COMMENT 'Tip dokumenta. Isto kot documents.type. Če je -1, se uporablja za polje documents.order_no.',
  `subtype` tinyint(4) DEFAULT NULL COMMENT 'Podtip dokumenta.  Isto kot documents.subtype.',
  `cash_register_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id blagajne, če številčenje poteka za vsako blagajno posebej.',
  `year` smallint(6) DEFAULT NULL COMMENT 'Leto izdaje dokumenta.  Isto kot documents.year.',
  `counter` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Zadnji counter iz documents.counter za type, subtype in year.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `document_courier_service`
--

CREATE TABLE `document_courier_service` (
  `id` int(10) UNSIGNED NOT NULL,
  `document_id` int(10) UNSIGNED NOT NULL COMMENT 'Id dokumenta, na katerega se nanaša strošek.',
  `courier_service_id` tinyint(3) UNSIGNED NOT NULL COMMENT 'Id storitve iz document_courier_services.',
  `service_no` int(10) UNSIGNED DEFAULT NULL COMMENT 'Številka storitve pri dostavni službi (Pošti Slovenije ali kom drugem).',
  `price` decimal(10,4) DEFAULT NULL COMMENT 'Cena poštne storitve z DDV. Prepisana iz courier_services ali izračunana s posebno funkcijo.',
  `vat_id` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Stopnja DDV za poštno storitev.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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` text 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=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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.',
  `type` tinyint(4) DEFAULT NULL COMMENT 'Tip obrazca, če obrazec služi kakšnemu posebnemu namenu.',
  `name` text DEFAULT NULL COMMENT 'Ime obrazca (da ga lahko prepoznamo v seznamu obrazcev).',
  `internal_email` text DEFAULT NULL COMMENT 'Email naslov v podjetju, na katerega se naj pošlje potrditveno sporočilo ob oddaji obrazca. Potrditveno sporočilo se pošlje tudi na naslov, ki ga vpiše uporabnik, če je tako določeno v poljih obrazca.',
  `user_email` tinyint(4) DEFAULT NULL COMMENT 'Ali naj se potrditveno sporočilo pošlje tudi na e-mail naslov, ki je vpisan v prvem e-mail polju obrazca (če obstaja)?',
  `redirect_to_after_submit` text 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` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `last_saved_at` timestamp NULL DEFAULT NULL,
  `last_saved_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

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

CREATE TABLE `form_fields` (
  `id` int(10) UNSIGNED NOT NULL,
  `position` int(11) DEFAULT NULL COMMENT 'Vrstni red polj na obrazcu. Vstni red se šteje znotraj koraka oz. stolpca. Ko ustvariš stran, dobi to polje isto vrednost kot polje id, nato pa se lahko s sortiranjem spremeni.',
  `form_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Obrazec, na katerem se nahaja polje.',
  `type` tinyint(4) DEFAULT NULL,
  `decimals` tinyint(4) DEFAULT NULL COMMENT 'Število decimalnih mest, na kolikor se naj izpišejo vrednost v polju (če je polje tipa 1 - number).',
  `status` tinyint(4) DEFAULT 1 COMMENT 'Status polja. Vrednosti se nahajajo v tables.php.',
  `show_only_if` text 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` text 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?',
  `label` text DEFAULT NULL COMMENT 'Naziv polja. Pri poljih tipa JSON je to naziv gumba, ki doda novo vrstico, npr. Dodaj odsek.',
  `label_position` tinyint(4) DEFAULT NULL COMMENT 'Položaj naziva polja glede na podatkovno polje.',
  `placeholder` text DEFAULT NULL COMMENT 'Besedilo, ki čaka v polju, ko ni vpisan noben podatek.',
  `suffix` text DEFAULT NULL COMMENT 'Besedilo, ki se pojavi za vnosnim poljem (npr. kg, cm, ...).',
  `help` text DEFAULT NULL COMMENT 'Pomoč za izpolnjevanje polja (kratko navodilo za uporabnika, ki mu razloži, kaj naj vpiše v polje).',
  `width` smallint(6) DEFAULT NULL COMMENT 'Širina polja v px (skupna širina naziva in polja samega). Če ni toliko prostora (npr. na mobilnih napravah), se polje ustrezno zoži.',
  `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.',
  `field_height` smallint(6) DEFAULT NULL COMMENT 'Višina polja v px. Pustite prazno, če želite uporabiti privzeto višino 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. Vir je lahko:\r\n  - ključ prevodov, npr. ''translations.tables.documents.waiting_reason''\r\n	- ključ nastavitev, npr. ''settings.web_page_element_types''\r\n	- id nekega drugega polja tega istega obrazca; polje mora biti tipa JSON, v njem pa podatki, ki so hkrati vir podatkov za to polje\r\n	- array objektov, ki imajo vsaj polji id in value, lahko pa tudi label in druge (npr. [{id: 0, value: ''red''}, {id: 2, value: ''blue'', label: ''Modra''}])',
  `auto_correct` tinyint(4) DEFAULT NULL COMMENT 'Na kakšen način se naj samodejno popravi besedilo v polju? Vrednosti so v tables.php.',
  `save_to_column` text 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` text 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` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `last_saved_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `last_saved_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Brskalnik, s katerim je bila oddana forma.',
  `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.',
  `payment_intent_reference` varchar(100) DEFAULT NULL COMMENT 'Payment Intent 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.',
  `submission_uri_id` int(11) DEFAULT NULL COMMENT 'URL strani, iz katere je bila odposlana forma. Potrebujemo predvsem v primeru 3D Secure avtorizacije plačila (npr. Stripe), da lahko stranko vrnemo na ta isti URL in tam prikažemo, da je vse OK.',
  `customer_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID stranke, ki je oddala obrazec (če ga vemo).',
  `email` text 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 oddaje obrazca.',
  `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=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `form_submission_sessions`
--

CREATE TABLE `form_submission_sessions` (
  `id` int(10) UNSIGNED NOT NULL,
  `form_id` int(10) UNSIGNED DEFAULT NULL,
  `form_submission_id` int(10) UNSIGNED DEFAULT NULL,
  `session_id` varchar(40) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `history`
--

CREATE TABLE `history` (
  `id` int(10) UNSIGNED NOT NULL,
  `table_name` varchar(100) DEFAULT NULL COMMENT 'Ime tabele na katero se nanaša history zapis.',
  `table_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id zapisa v tabeli z imenom = table_name.',
  `type` varchar(100) DEFAULT NULL COMMENT 'Skupina. Definirana v modelu, za katerega želimo voditi zgodovino',
  `extra_attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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` text 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=utf8mb3 COLLATE=utf8mb3_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` text 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` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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` text 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=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

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

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

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

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

CREATE TABLE `items` (
  `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.',
  `oznaka` varchar(30) NOT NULL COMMENT 'Šifra izdelka',
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Status izdelka.',
  `update_stock_journal_from` timestamp NULL DEFAULT NULL COMMENT 'Od katerega datuma naprej naj se posodobi skladiščni dnevnik izdelka?',
  `update_stock_journal_job_status` tinyint(4) DEFAULT NULL COMMENT 'Status joba za posodobitev skladiščnega dnevnika.',
  `update_statistics_from_year` smallint(6) DEFAULT NULL COMMENT 'Ali naj se posodobi statistika izdelka? Če je vpisano leto od 2000 naprej, se bo statistika posodobila za vsako leto od leta naprej. Če je vpisano leto 2038, se statistika pravkar posodablja. Null pomeni, da je statistika posodobljena.',
  `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 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 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 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 blagovne skupine.',
  `naziv` text DEFAULT NULL COMMENT 'Naziv izdelka. Pri knjigah je to naslov (brez avtorja).',
  `name_manual` tinyint(4) DEFAULT NULL COMMENT 'Ali naj se naziv izdelka zapisuje samo ročno (pomeni, da se ne sestavlja iz sestavnih delov naziva)? Če ni izbrano, se naziv izdelka samodejno sestavi iz posameznih delov naziva.',
  `name_item` text DEFAULT NULL COMMENT 'Opis izdelka. Uporabimo pri sestavljanju naziva izdelka.',
  `name_model` text DEFAULT NULL COMMENT 'Model izdelka. Uporabimo pri sestavljanju naziva izdelka.',
  `name_quantity` text DEFAULT NULL COMMENT 'Količina izdelka. Uporabimo pri sestavljanju naziva izdelka.',
  `name_specification` text DEFAULT NULL COMMENT 'Specifikacije izdelka. Uporabimo pri sestavljanju naziva izdelka.',
  `gender` tinyint(4) DEFAULT NULL COMMENT 'Ali je izdelek primeren samo ali predvsem za naveden spol?',
  `naziv_nevtralen` text DEFAULT NULL COMMENT 'Nevtralen naziv izdelka (brez blagovnih znamk in proizvajalcev).',
  `opis` text DEFAULT NULL COMMENT 'Opis izdelka. Se pojavi na spletu, pa morda še kje drugje.',
  `description_extra_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Dodatni opis izdelka. Lahko je tudi zelo dolg.',
  `brand` text DEFAULT NULL COMMENT 'Naziv blagovne znamke.',
  `avtor` text DEFAULT NULL COMMENT 'Avtor (predvsem pri učbenikih in delovnih zvezkih).',
  `description_long_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Dolgi opis izdelka (za spletno stran).',
  `description_short_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Kratki opis izdelka (za spletno stran).',
  `more_info_uri` text DEFAULT NULL COMMENT 'URL naslov strani, kjer se nahaja več informacij o izdelku.',
  `video_uri` text DEFAULT NULL COMMENT 'URL naslov strani, kjer se nahaja video predstavitev izdelka. Lahko je tudi URL naslov na YouTube strani.',
  `warning_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Opozorilo. Se pojavi kot pop-up vedno, ko kdo dostopa do izdelka.',
  `remark_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Interni zaznamek na izdelku. Prikaže se na vidnem mestu v nastavitvah izdelka.',
  `zalozba` text DEFAULT NULL COMMENT 'Oznaka založbe',
  `zalozba_oznaka` text DEFAULT NULL COMMENT 'Šifra izdelka pri založbi (dobavitelju).',
  `podskupina` varchar(10) DEFAULT NULL COMMENT 'Podskupina, v katero spada potrebščina, npr. 3.1.',
  `prio` tinyint(4) NOT NULL DEFAULT 50 COMMENT 'Prioriteta izdelka. Izdelki z nižjo številko so na vrsti prej.',
  `personalized_eans` tinyint(4) DEFAULT NULL COMMENT 'Ali mora imeti izdelek v primeru personalizacije drugačne EAN črtne kode?',
  `personalizer` text DEFAULT NULL COMMENT 'Naziv izvajalca personalizacije (se izvozi s podatki za personalizacijo).',
  `naziv_za_dokument` text DEFAULT NULL COMMENT 'Če želite, da se na dokumentih (npr. predračunih, računih) izpiše drugačen naziv izdelka, ga vpišite sem.',
  `splet_narocanje` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Ali je izdelek mogoče naročiti na spletu?',
  `splet_rubrike` text DEFAULT NULL COMMENT 'V katerih rubrikah naj se pojavi izdelek? Rubrike so številke strani (folder), |-delimited.',
  `splet_iskanje` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Ali naj spletni iskalnik prikaže izdelek?',
  `splet_vidna` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Ali je stran izdelka vidna na spletu. Če ni, sistem uporabnika preusmeri v nadrejeno stran.',
  `splet_prio` tinyint(4) DEFAULT NULL COMMENT 'Prioriteta prikaza izdelka na spletu (če je drugačna od splošne).',
  `splet_namig` text DEFAULT NULL COMMENT 'Namig, ki se izpiše ob izdelku. Na primer: pri copatih "Otroku raste noga, naročite raje za številko večje copate."',
  `estimated_delivery_date` date DEFAULT NULL COMMENT 'Datum predvidene dobave izdelka. Se izračuna samodejno na osnovi naročilnic dobaviteljem.',
  `estimated_delivery_remark` text DEFAULT NULL COMMENT 'Opomba glede predvidene dobave izdelka (se prepiše samodejno iz naročilnic dobaviteljem).',
  `cost_price` decimal(16,9) NOT NULL DEFAULT 0.000000000 COMMENT 'Nabavna cena izdelka v skladišču. Vsebuje tudi vse odvisne stroške.',
  `cost_price_inbound` decimal(10,4) DEFAULT NULL COMMENT 'Cena, ki se naj predlaga ob vnosu pozicije v prevzemnico. V sezoni se predlaga cena iz polja Prevzemna cena v sezoni, če je vpisana.',
  `cost_price_inbound_season` decimal(10,4) DEFAULT NULL COMMENT 'Cena, ki se naj V SEZONI predlaga ob vnosu pozicije v prevzemnico. Izven sezone se predlaga cena iz polja Prevzemna cena.',
  `cost_price_inbound_average` decimal(16,9) DEFAULT NULL COMMENT 'Povprečna nabavna cena iz vseh prevzemov koledarskega leta, skupaj z odvisnimi stroški nabave.',
  `stock_negative_on` datetime DEFAULT NULL COMMENT 'Datum in čas, ko je bila zaloga v skladišču nazadnje negativna (kar se ne bi smelo zgoditi).',
  `stock_year_start` int(11) DEFAULT NULL COMMENT 'Zaloga izdelka na začetku leta.',
  `planned` int(11) DEFAULT NULL COMMENT 'Skupna planirana količina prodaje za tekoče leto.',
  `planned_b2b` int(11) DEFAULT NULL COMMENT 'Količina, ki je planirana za veleprodajo (razen Müller).',
  `planned_b2c` int(11) DEFAULT NULL COMMENT 'Količina, ki je planirana za maloprodajo.',
  `planned_sponsorship` int(11) DEFAULT NULL COMMENT 'Količina, ki je planirana za sponzorstvo.',
  `planned_not_for_sale` int(11) DEFAULT NULL COMMENT 'Planirana količina, ki ni na voljo za prodajo.',
  `ordered` int(11) DEFAULT NULL COMMENT 'Količina, ki je bila naročena v tem letu. Upoštevajo se vsi predračuni, računi in dobavnice.',
  `ordered_solo` int(11) DEFAULT NULL COMMENT 'Količina, ki je bila naročena SAMOSTOJNO (ne kot del kompleta) v tem letu. Upoštevajo se vsi predračuni, računi in dobavnice.',
  `ordered_solo_b2b` int(11) DEFAULT NULL COMMENT 'Količina, ki je bila v veleprodaji naročena SAMOSTOJNO (ne kot del kompleta) v tem letu (razen Müller). Upoštevajo se vsi predračuni, računi in dobavnice.',
  `ordered_solo_b2b_season` int(11) DEFAULT NULL COMMENT 'Količina, ki je bila v veleprodaji naročena SAMOSTOJNO (ne kot del kompleta) v sezoni tega leta (razen Müller). Upoštevajo se vsi predračuni, računi in dobavnice.',
  `ordered_solo_b2c` int(11) DEFAULT NULL COMMENT 'Količina, ki je bila v maloprodaji naročena SAMOSTOJNO (ne kot del kompleta) v tem letu. Upoštevajo se vsi predračuni, računi in dobavnice.',
  `ordered_solo_b2c_season` int(11) DEFAULT NULL COMMENT 'Količina, ki je bila v maloprodaji naročena SAMOSTOJNO (ne kot del kompleta) v sezoni tega leta. Upoštevajo se vsi predračuni, računi in dobavnice.',
  `ordered_solo_b2c_class_unknown` int(11) DEFAULT NULL COMMENT 'Količina, ki je bila v maloprodaji naročena SAMOSTOJNO (ne kot del kompleta) v tem letu v neznanem razredu. Upoštevajo se vsi predračuni, računi in dobavnice.',
  `ordered_solo_sponsorship` int(11) DEFAULT NULL COMMENT 'Količina, ki je bila v sponzorstvu naročena SAMOSTOJNO (ne kot del kompleta) v tem letu. Upoštevajo se vsi predračuni, računi in dobavnice.',
  `ordered_in_sets` int(11) DEFAULT NULL COMMENT 'Količina, ki je bila naročena KOT DEL KOMPLETA v tem letu. Upoštevajo se vsi predračuni, računi in dobavnice.',
  `ordered_in_sets_b2b` int(11) DEFAULT NULL COMMENT 'Količina, ki je bila v veleprodaji naročena KOT DEL KOMPLETA v tem letu (razen Müller). Upoštevajo se vsi predračuni, računi in dobavnice.',
  `ordered_in_sets_b2c` int(11) DEFAULT NULL COMMENT 'Količina, ki je bila v maloprodaji naročena KOT DEL KOMPLETA v tem letu. Upoštevajo se vsi predračuni, računi in dobavnice.',
  `ordered_in_sets_sponsorship` int(11) DEFAULT NULL COMMENT 'Količina, ki je bila v sponzorstvu naročena KOT DEL KOMPLETA v tem letu. Upoštevajo se vsi predračuni, računi in dobavnice.',
  `delivered` int(11) DEFAULT NULL COMMENT 'Količina, dobavljena v tem letu. Upoštevajo se vsi računi in dobavnice.',
  `delivered_solo` int(11) DEFAULT NULL COMMENT 'Količina, dobavljena SAMOSTOJNO (ne kot del kompleta) v tem letu. Upoštevajo se vsi računi in dobavnice.',
  `delivered_solo_b2b` int(11) DEFAULT NULL COMMENT 'Količina, dobavljena v veleprodaji SAMOSTOJNO (ne kot del kompleta) v tem letu (razen Müller). Upoštevajo se vsi računi in dobavnice.',
  `delivered_solo_b2c` int(11) DEFAULT NULL COMMENT 'Količina, dobavljena v maloprodaji SAMOSTOJNO (ne kot del kompleta) v tem letu. Upoštevajo se vsi računi in dobavnice.',
  `delivered_solo_sponsorship` int(11) DEFAULT NULL COMMENT 'Količina, dobavljena v sponzorstvu SAMOSTOJNO (ne kot del kompleta) v tem letu. Upoštevajo se vsi računi in dobavnice.',
  `delivered_in_sets` int(11) DEFAULT NULL COMMENT 'Količina, dobavljena KOT DEL KOMPLETA v tem letu. Upoštevajo se vsi računi in dobavnice.',
  `delivered_in_sets_b2b` int(11) DEFAULT NULL COMMENT 'Količina, dobavljena v veleprodaji KOT DEL KOMPLETA v tem letu (razen Müller). Upoštevajo se vsi računi in dobavnice.',
  `delivered_in_sets_b2c` int(11) DEFAULT NULL COMMENT 'Količina, dobavljena v maloprodaji KOT DEL KOMPLETA v tem letu. Upoštevajo se vsi računi in dobavnice.',
  `delivered_in_sets_sponsorship` int(11) DEFAULT NULL COMMENT 'Količina, dobavljena v sponzorstvu KOT DEL KOMPLETA v tem letu. Upoštevajo se vsi računi in dobavnice.',
  `invoiced` int(11) DEFAULT NULL COMMENT 'Količina, ki smo jo zaračunali v tem letu. Upoštevajo se vsi računi.',
  `invoiced_solo` int(11) DEFAULT NULL COMMENT 'Količina, ki smo jo zaračunali SAMOSTOJNO (ne kot del kompleta) v tem letu. Upoštevajo se vsi računi.',
  `invoiced_solo_b2b` int(11) DEFAULT NULL COMMENT 'Količina, ki smo jo zaračunali v veleprodaji SAMOSTOJNO (ne kot del kompleta) v tem letu (razen Müller). Upoštevajo se vsi računi.',
  `invoiced_solo_b2c` int(11) DEFAULT NULL COMMENT 'Količina, ki smo jo zaračunali v maloprodaji SAMOSTOJNO (ne kot del kompleta) v tem letu. Upoštevajo se vsi računi.',
  `invoiced_solo_sponsorship` int(11) DEFAULT NULL COMMENT 'Količina, ki smo jo zaračunali v sponzorstvu SAMOSTOJNO (ne kot del kompleta) v tem letu. Upoštevajo se vsi računi.',
  `invoiced_in_sets` int(11) DEFAULT NULL COMMENT 'Količina, ki smo jo zaračunali KOT DEL KOMPLETA v tem letu. Upoštevajo se vsi računi.',
  `invoiced_in_sets_b2b` int(11) DEFAULT NULL COMMENT 'Količina, ki smo jo zaračunali v veleprodaji KOT DEL KOMPLETA v tem letu (razen Müller). Upoštevajo se vsi računi.',
  `invoiced_in_sets_b2c` int(11) DEFAULT NULL COMMENT 'Količina, ki smo jo zaračunali v maloprodaji KOT DEL KOMPLETA v tem letu. Upoštevajo se vsi računi.',
  `invoiced_in_sets_sponsorship` int(11) DEFAULT NULL COMMENT 'Količina, ki smo jo zaračunali v sponzorstvu KOT DEL KOMPLETA v tem letu. Upoštevajo se vsi računi.',
  `inbound` int(11) DEFAULT NULL COMMENT 'Prevzeta količina v tem letu.',
  `stock_records` int(11) DEFAULT NULL COMMENT 'Količina na skladiščnih zapisnikih v tem letu (razen otvoritveni in zaključni zapisniki).',
  `risky_quantity` int(11) DEFAULT NULL COMMENT 'Število vprašljivih pozicij. To so pozicije naročil, kjer stranka ni plačala niti prvega obroka.',
  `damaged` int(11) DEFAULT NULL COMMENT 'Poškodovana količina. Ni na voljo za prodajo, se pa šteje v zalogo.',
  `consignment` int(11) DEFAULT NULL COMMENT 'Količina na konsignaciji (naše blago pri naših partnerjih).',
  `stock` int(11) DEFAULT NULL COMMENT 'Fizična zaloga izdelka.',
  `free` int(11) DEFAULT NULL COMMENT 'Skupna prosta količina (seštevek posamičnih).',
  `free_b2b` int(11) DEFAULT NULL COMMENT 'Prosta količina, ki jo lahko črpa samo maloprodaja.',
  `free_sponsorship` int(11) DEFAULT NULL COMMENT 'Prosta količina, ki jo lahko črpa samo sponzorstvo.',
  `free_b2c` int(11) DEFAULT NULL COMMENT 'Prosta količina, ki jo lahko črpa samo veleprodaja.',
  `supplier_discount` decimal(7,4) DEFAULT NULL COMMENT 'Popust, ki ga običajno dobimo pri dobavitelju ob nabavi tega izdelka.',
  `sold_out` tinyint(4) DEFAULT NULL COMMENT 'Ali je izdelek razprodan?',
  `sold_out_text` int(10) UNSIGNED DEFAULT NULL COMMENT 'Besedilo, ki se pojavi na računu (in morda še kje), če je izdelek razprodan. Vpišite samo v primeru, da želite uporabiti drugačno besedilo od privzetega.',
  `next_delivery_at` timestamp NULL DEFAULT NULL COMMENT 'Datum predvidene naslednje dobave izdelka.',
  `next_delivery_quantity` decimal(10,4) DEFAULT NULL COMMENT 'Količina, ki jo pričakujemo ob naslednji dobavi.',
  `no_discount_from` datetime DEFAULT NULL COMMENT 'Od kdaj naprej izdelek ne sme imeti popusta (npr. zaradi Zakona o knjigi).',
  `no_discount_to` datetime DEFAULT NULL COMMENT 'Do kdaj izdelek ne sme imeti popusta (npr. zaradi Zakona o knjigi).',
  `vat_id` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Stopnja DDV.',
  `em` varchar(20) DEFAULT NULL COMMENT 'Enota mere.',
  `pakirano` smallint(6) DEFAULT NULL COMMENT 'Koliko kosov izdelka je v enem kartonu?',
  `width` smallint(5) UNSIGNED DEFAULT NULL COMMENT 'Širina izdelka v milimetrih.',
  `height` smallint(5) UNSIGNED DEFAULT NULL COMMENT 'Višina izdelka v milimetrih.',
  `depth` smallint(5) UNSIGNED DEFAULT NULL COMMENT 'Globina izdelka v milimetrih.',
  `transport_pack_quantity` smallint(5) UNSIGNED DEFAULT NULL COMMENT 'Število kosov izdelka, ki se nahaja v transportnem pakiranju.',
  `commercial_pack_quantity` smallint(5) UNSIGNED DEFAULT NULL COMMENT 'Število kosov izdelka, ki se nahaja v komercialnem pakiranju.',
  `brez_zaloge` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Ali gre za oznako, za katero se ne vodi zaloga? Če se ne vodi zaloga, določimo, ali gre za blago, storitev ali kaj tretjega (na primer opombo).',
  `mass` int(10) UNSIGNED DEFAULT NULL COMMENT 'Masa izdelka v gramih.',
  `customs_tariff` text DEFAULT NULL COMMENT 'Carinska tarifa izdelka.',
  `regal` text DEFAULT NULL COMMENT 'Regal v skladišču. Uporabite lahko številke ali črke ali kombinacijo.',
  `polica` text DEFAULT NULL COMMENT 'Številka police v skladišču. Uporabite lahko številke ali črke ali kombinacijo.',
  `polica_zap` text DEFAULT NULL COMMENT 'Zaporedna številka na polici (skladišče). Uporabite lahko številke ali črke ali kombinacijo.',
  `samodejno_policno_mesto` tinyint(4) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `last_saved_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `last_saved_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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` text DEFAULT NULL COMMENT 'Šifra skupine izdelkov.',
  `full_code` text DEFAULT NULL COMMENT 'Celotna koda skupine, ki vsebuje tudi nadrejene skupine, ločeno s pikami, npr. 1.2.4.',
  `description` text 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` text DEFAULT NULL COMMENT 'Slika, ki se naloži kot slika v ploščici (ikona), če je stran prikazana kot ploščica.',
  `background_image` text 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` text DEFAULT NULL COMMENT 'Ime banner slike.',
  `banner_file_name_mobile` text DEFAULT NULL COMMENT 'Ime banner slike na mobilnih napravah.',
  `banner_link` text 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=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `item_property`
--

CREATE TABLE `item_property` (
  `id` int(10) UNSIGNED NOT NULL,
  `position` int(10) UNSIGNED DEFAULT NULL COMMENT 'Položaj za sortiranje.',
  `item_id` int(10) UNSIGNED NOT NULL,
  `property_id` int(10) UNSIGNED NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `client_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Stran, za katero velja nastavitev, če ima stranka več sestrskih strani.',
  `label` text DEFAULT NULL,
  `mandatory` tinyint(4) DEFAULT NULL COMMENT 'Ali je podatek obvezen (npr. pri dodatnih podatkih pozicije)?',
  `min` int(11) DEFAULT NULL COMMENT 'Najmanjša vrednost števila (pri številskih poljih) oz. najmanjše število znakov (pri tekstovnih poljih), ki ga uporabniku dovolimo vpisati v polje.',
  `max` int(11) DEFAULT NULL COMMENT 'Največja vrednost števila (pri številskih poljih) oz. največje število znakov (pri tekstovnih poljih), ki ga uporabniku dovolimo vpisati v polje.',
  `quantity` decimal(10,4) DEFAULT NULL,
  `valid_from` timestamp NULL DEFAULT NULL COMMENT 'Od kdaj naprej velja nastavitev?',
  `valid_to` timestamp NULL DEFAULT NULL COMMENT 'Do kdaj velja nastavitev?',
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `job_batches`
--

CREATE TABLE `job_batches` (
  `id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `total_jobs` int(11) NOT NULL,
  `pending_jobs` int(11) NOT NULL,
  `failed_jobs` int(11) NOT NULL,
  `failed_job_ids` longtext NOT NULL,
  `options` mediumtext DEFAULT NULL,
  `cancelled_at` int(11) DEFAULT NULL,
  `created_at` int(11) NOT NULL,
  `finished_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

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

CREATE TABLE `messages` (
  `id` int(10) UNSIGNED NOT NULL,
  `status` tinyint(4) DEFAULT 0,
  `table_name` varchar(100) NOT NULL COMMENT 'Ima tabele, ki vsebuje zapis, ki je osnova za pošiljanje sporočila.',
  `table_id` int(10) UNSIGNED NOT NULL COMMENT 'Id zapisa iz tabele table_name, ki je osnova za pošiljanje sporočila.',
  `priority` tinyint(4) DEFAULT NULL COMMENT 'Prioriteta sporočila. Nižja prioriteta se pošlje prej',
  `type` tinyint(4) DEFAULT NULL COMMENT 'Tip sporočila. Vrednosti so v tables.php.',
  `queue` varchar(15) DEFAULT NULL COMMENT 'Queue v katerega se bo postavilo sporočilo, ko bo prišlo na vrsto za obdelavo.',
  `message_template_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id predloge (message_templates.id)',
  `code_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Podatki potrebni za izdelavo telesa sporočila (code => value). Zapišemo jih v json obliki, preden se sporočilo dejansko pošlje.' CHECK (json_valid(`code_data`)),
  `create_attachment` tinyint(4) DEFAULT NULL COMMENT 'Ali naj ob pošiljanju samodejno ustvarimo priponko in jo pripnemo?',
  `attachments` text DEFAULT NULL COMMENT 'Priponke, ki so/bodo pripete sporočilu. Vpišemo absolutno pot do datoteke ali do več datotek (JSON).',
  `subject` text DEFAULT NULL COMMENT 'Zadeva sporočila.',
  `recipient_type` tinyint(4) DEFAULT NULL COMMENT 'Tip prejemnika sporočila, npr. kupec, prodajalec, administrator. Vrednosti so v tables.php.',
  `medium` tinyint(4) DEFAULT NULL COMMENT 'Medij sporočila (email, SMS, ...). Vrednosti so v tables.php.',
  `from_name` text DEFAULT NULL COMMENT 'Ime pošiljatelja sporočila (polje Od).',
  `from_email` text DEFAULT NULL COMMENT 'Elektronski naslov pošiljatelja sporočila (polje Od).',
  `to_name` text DEFAULT NULL COMMENT 'Ime prejemnika sporočila (Za).',
  `to_email` text DEFAULT NULL COMMENT 'Elektronski naslov prejemnika sporočila (Za).',
  `cc_name` text DEFAULT NULL COMMENT 'Ime prejemnika kopija sporočila (Kp).',
  `cc_email` text DEFAULT NULL COMMENT 'Elektronski naslov prejemnika kopije sporočila (Kp).',
  `bcc_name` text DEFAULT NULL COMMENT 'Ime prejemnika skrite kopije sporočila (Skp).',
  `bcc_email` text DEFAULT NULL COMMENT 'Elektronski naslov prejemnika skrite kopije sporočila (Skp).',
  `send_at` timestamp NULL DEFAULT NULL COMMENT 'Datum kdaj naj se pošlje sporočilo.',
  `job_batch_id` varchar(255) DEFAULT NULL COMMENT 'Id sporočila v tabeli job_batches',
  `failed_at` timestamp NULL DEFAULT NULL COMMENT 'Datum napake pri pošiljanju (job se premakne v failed jobs).',
  `failed_count` tinyint(4) DEFAULT NULL COMMENT 'Kolikokrat se je sporočilo neuspešno poskusilo poslat.',
  `succeeded_at` datetime DEFAULT NULL COMMENT 'Datum in čas, ko je bilo sporočilo poslano oz. postavljeno v queue.',
  `queued_at` timestamp NULL DEFAULT NULL COMMENT 'Kdaj je bilo sporočilo postavljeno v queue.',
  `extra_attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `message_templates`
--

CREATE TABLE `message_templates` (
  `id` int(10) UNSIGNED NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `type` tinyint(4) DEFAULT NULL COMMENT 'Tip elektronskega sporočila, za katerega velja predloga. Vrednosti so v tables.php.',
  `name` text DEFAULT NULL COMMENT 'Ime predloge',
  `description` text DEFAULT NULL COMMENT 'Opis predloge (namen, posebnosti)',
  `recurring` tinyint(4) DEFAULT NULL COMMENT 'Se predloga kopira pri prehodu leta (z novo letnico v datumih veljavnosti) ?',
  `subject` text DEFAULT NULL COMMENT 'Predloga zadeve elektronskega sporočila.',
  `body` mediumtext DEFAULT NULL COMMENT 'Predloga elektronskega sporočila.',
  `valid_from` timestamp NULL DEFAULT NULL COMMENT 'Od kdaj velja predloga ?',
  `valid_to` timestamp NULL DEFAULT NULL COMMENT 'Do kdaj velja predloga ?',
  `document_type` tinyint(4) DEFAULT NULL COMMENT 'Tip dokumenta, za katerega velja sporočilna predloga (če obstaja)',
  `user_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'Uporabnik, na katerega je vezana sporočilna predloga.',
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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);

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

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

CREATE TABLE `pages` (
  `id` int(10) UNSIGNED NOT NULL,
  `parent_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Nadrejena stran.',
  `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.',
  `template` tinyint(4) DEFAULT NULL COMMENT 'Predloga, na osnovi katere je bil vstavljen element.',
  `sw_wizard_name` text DEFAULT NULL COMMENT 'Setup wizard: wizard_name, da lahko najdemo stran, ki pripada določenemu koraku čarovnika.',
  `element_type` tinyint(4) DEFAULT NULL COMMENT 'Kot kateri tip elementa je bil zapis vstavljen (stran, odsek, stolpec, ploščica)? Zapisi, ki so bili vstavljeni kot drugi tip elementa, se na strani ne prikažejo, razen če element predstavlja stran (npr. če je bil element vstavljen kot ploščica, se na podstrani ne prikaže, saj bi tam moral biti prikazan kot odsek).',
  `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Status strani (objavljena, skrita, izbrisana, ...). Vrednosti so v tables.php.',
  `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 'Ali ima element tudi svojo lastno podstran na spletnem mestu? Samo nekateri elementi imajo svojo lastno podstran z dodatno vsebino, lahko seveda tudi z dodatnimi podstranmi. ',
  `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` text 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.',
  `target` tinyint(3) UNSIGNED DEFAULT NULL COMMENT 'Kako naj se odpre povezava, ko uporabnik klikne na njo?',
  `auto_title` tinyint(4) DEFAULT NULL COMMENT 'Ali naj se naslov strani pridobi samodejno iz naslova elementa, ki predstavlja to stran?',
  `auto_summary` tinyint(4) DEFAULT NULL COMMENT 'Ali naj se povzetek strani pridobi samodejno?',
  `auto_page_image` tinyint(4) DEFAULT NULL COMMENT 'Ali naj se slika, ki predstavlja to stran, pridobi samodejno?',
  `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.',
  `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` text 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` text 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` text DEFAULT NULL COMMENT 'Barva pisave strani.',
  `text_color` text DEFAULT NULL COMMENT 'Barva pisave, ko je stran prikazana kot odsek na neki drugi strani.',
  `page_heading_color` text DEFAULT NULL COMMENT 'Barva naslovov na strani.',
  `heading_color` text DEFAULT NULL COMMENT 'Barva naslovov, ko je stran prikazana kot odsek na neki drugi strani.',
  `page_link_color` text DEFAULT NULL COMMENT 'Barva povezav na strani.',
  `link_color` text DEFAULT NULL COMMENT 'Barva povezav, ko je stran prikazana kot odsek na neki drugi strani.',
  `page_border_color` text DEFAULT NULL COMMENT 'Barva črt na strani.',
  `border_color` text 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?',
  `frame_width` smallint(6) DEFAULT NULL COMMENT 'Širine okvirjev. Če na zaslonu ni dovolj prostora (npr. na mobilnih napravah), se okvirji samodejno postavijo eden pod drugega.',
  `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` text DEFAULT NULL COMMENT 'Če stran velja samo za določeni session_id (npr. za testiranje urejanja), sem vpišite ta session_id.',
  `last_saved_at` timestamp NULL DEFAULT NULL,
  `last_saved_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `page_texts`
--

CREATE TABLE `page_texts` (
  `id` int(10) UNSIGNED NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Status zapisa besedila.',
  `type` tinyint(4) NOT NULL COMMENT 'Tip besedila. Vrednosti se nahajajo v tables.php.',
  `table_name` varchar(100) NOT NULL COMMENT 'Ime tabele, na katero se navezuje besedilo, npr. pages, items, item_groups, forms, ...',
  `table_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Id zapisa iz tabele table_name, na katero se navezuje besedilo. Pustite prazno, če gre za privzeto besedilo.',
  `html` longtext DEFAULT NULL COMMENT 'HTML zapis besedila, ki se vstavi na spletno stran.',
  `plain` longtext DEFAULT NULL COMMENT 'Plain text verzija besedila, ki se vstavi na spletno stran. Uporabljamo za iskanje po strani in se vedno vpiše samodejno.',
  `session_id` text 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` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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` text DEFAULT NULL COMMENT 'Naziv plačnika, kot smo ga uvozili od banke.',
  `imported_address` text 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` text 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` text 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` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

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

CREATE TABLE `payment_methods` (
  `id` tinyint(3) UNSIGNED NOT NULL,
  `description` text DEFAULT NULL COMMENT 'Opis ponudnika plačil.',
  `web_label` text DEFAULT NULL COMMENT 'Naziv načina plačil, ki se naj prikaže na spletni strani. Če pustite prazno, se prikaže redni naziv načina plačila.',
  `position` tinyint(1) DEFAULT NULL COMMENT 'Za sortiranje.',
  `pos` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Ali se lahko način plačila pojavi v prodajalni?',
  `remote` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Ali se lahko način plačila pojavi v prodaji na daljavo?',
  `account_no` text DEFAULT NULL COMMENT 'Številka TRR oz. našega računa pri ponudniku plačil.',
  `fee_percent` decimal(7,4) DEFAULT NULL COMMENT 'Odstotek provizije za plačila.',
  `fee_price` decimal(7,4) DEFAULT NULL COMMENT 'Znesek provizije na plačilo (v EUR).',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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` text NOT NULL COMMENT 'ID številka paketa, kot ga dobimo od banke.',
  `statement_id` text 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=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `permissions`
--

CREATE TABLE `permissions` (
  `id` int(10) UNSIGNED NOT NULL,
  `type` tinyint(4) DEFAULT NULL,
  `code` text DEFAULT NULL COMMENT 'Tipska oznaka dovoljenja. Ureja samo programer.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `permission_role`
--

CREATE TABLE `permission_role` (
  `id` int(10) UNSIGNED NOT NULL,
  `role_id` int(10) UNSIGNED DEFAULT NULL,
  `permission_id` int(10) UNSIGNED DEFAULT NULL,
  `permission_level` tinyint(4) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `permission_user`
--

CREATE TABLE `permission_user` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `permission_id` int(10) UNSIGNED NOT NULL,
  `permission_level` tinyint(4) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

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

CREATE TABLE `positions` (
  `id` int(10) UNSIGNED NOT NULL,
  `item_id` int(10) UNSIGNED NOT 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=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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` decimal(7,4) 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` decimal(7,4) 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,4) DEFAULT NULL COMMENT 'Minimalni skupni znesek vseh izdelkov v košarici po rednih cenah, da se popust sploh lahko upošteva.',
  `max_quantity` decimal(7,4) 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` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `profiles`
--

CREATE TABLE `profiles` (
  `id` smallint(5) UNSIGNED NOT NULL,
  `name` text NOT NULL COMMENT 'Ime profila.',
  `description` text DEFAULT NULL COMMENT 'Opis profila.',
  `locked` tinyint(4) DEFAULT NULL COMMENT 'Ali je profil zaklenjen? Samo zaklenjeni profili so lahko osnova za druge profile, izvoz podatkov ali kampanje.',
  `sql_expression` mediumtext DEFAULT NULL COMMENT 'SQL expression profila.',
  `manual_sql` tinyint(4) DEFAULT NULL COMMENT 'Ali profil sestavimo tako, da sami ročno vpišemo celotni SQL stavek. Praviloma dovoljeno samo administratorjem, da nam navadni uporabniki ne bi mogli z SQL stavki spreminjati baze.',
  `customer_count` int(10) UNSIGNED DEFAULT NULL COMMENT 'Število strank profila.',
  `coupon_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Ali naj za vsakega kupca iz profila sistem ustvari unikatni kupon, ki ga bo lahko kupec unovčil z vnosom kode kupona?',
  `last_calculated_by_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'Uporabnik, ki je nazadnje posodobil število strank v profilu.',
  `last_calculated_at` timestamp NULL DEFAULT NULL COMMENT 'Kdaj je bilo število strank v profilu nazadnje posodobljeno.',
  `last_exported_by_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'Uporabnik, ki je nazadnje izvozil stranke profila.',
  `last_exported_at` timestamp NULL DEFAULT NULL COMMENT 'Kdaj so bile stranke profila nazadnje izvožene.',
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` bigint(20) UNSIGNED NOT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `profile_conditions`
--

CREATE TABLE `profile_conditions` (
  `id` int(10) UNSIGNED NOT NULL,
  `profile_id` smallint(5) UNSIGNED NOT NULL,
  `profile_condition_group_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID skupine pogojev.',
  `type` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Tip pogoja.',
  `table` text NOT NULL DEFAULT '' COMMENT 'Tabela.',
  `field` text NOT NULL DEFAULT '' COMMENT 'Polje.',
  `operator` text NOT NULL DEFAULT '' COMMENT 'Operator.',
  `value` text DEFAULT NULL COMMENT 'Vrednost.',
  `value_to` text DEFAULT NULL COMMENT 'Vrednost do.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `profile_condition_groups`
--

CREATE TABLE `profile_condition_groups` (
  `id` int(10) UNSIGNED NOT NULL,
  `profile_id` smallint(5) UNSIGNED NOT NULL,
  `parent_profile_id` smallint(5) UNSIGNED DEFAULT NULL COMMENT 'Id nadrejenega profila.',
  `type` tinyint(3) UNSIGNED NOT NULL COMMENT 'Tip skupine profila',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `properties`
--

CREATE TABLE `properties` (
  `id` int(10) UNSIGNED NOT NULL,
  `type` tinyint(4) NOT NULL COMMENT 'Tip lastnosti. Lastnosti združimo v tipe, da jih lažje upravljamo.',
  `name` text NOT NULL COMMENT 'Ime lastnosti. Uporabite kratko ime, dodatne informacije vpišite v polje Opis.',
  `description` text DEFAULT NULL COMMENT 'Opis lastnosti. Vpišite informacije, ki so morda predolge za polje Naziv.',
  `uri` text DEFAULT NULL COMMENT 'URL, ki je povezan s to lastnostjo, npr. URL slike ali videa.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` int(10) UNSIGNED NOT NULL,
  `position` int(10) UNSIGNED DEFAULT NULL COMMENT 'Položaj zapisa v seznamu, da lažje urejamo.',
  `description` text DEFAULT NULL COMMENT 'Opis skupine dovoljenj',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `role_user`
--

CREATE TABLE `role_user` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `role_id` int(10) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `scheduled_jobs`
--

CREATE TABLE `scheduled_jobs` (
  `id` int(10) UNSIGNED NOT NULL,
  `job_batch_id` varchar(255) DEFAULT NULL,
  `type` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Tip zapisa. Opisi so v tables.php',
  `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Status zapisa. Opisi so v tables.php',
  `table_name` text DEFAULT NULL,
  `table_id` int(10) UNSIGNED DEFAULT NULL,
  `submitted_at` timestamp NULL DEFAULT NULL COMMENT 'Datum in ura začetka obdelave.',
  `finished_at` timestamp NULL DEFAULT NULL COMMENT 'Datum in ura konca obdelave.',
  `failed_at` timestamp NULL DEFAULT NULL COMMENT 'Datum in ura napake pri obdelavi.',
  `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Dodatni podatki, ki jih posredujemo v queue.' CHECK (json_valid(`data`)),
  `error_description` text DEFAULT NULL COMMENT 'Opis napake.',
  `error_stacktrace` text DEFAULT NULL COMMENT 'Dodatni podatki o napaki.',
  `created_at` timestamp NULL DEFAULT NULL,
  `created_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

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

CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL,
  `user_id` bigint(20) 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=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `sets`
--

CREATE TABLE `sets` (
  `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.',
  `parent_id` int(10) UNSIGNED DEFAULT NULL,
  `child_id` int(10) UNSIGNED DEFAULT NULL,
  `type` tinyint(4) DEFAULT NULL COMMENT 'Tip povezave',
  `subtype` tinyint(4) DEFAULT NULL,
  `position` int(11) DEFAULT NULL COMMENT 'Rabimo za vrstni red povezanih izdelkov, kjer je vrstni red pomemben.',
  `description` text DEFAULT NULL COMMENT 'Dodatni opis povezave. Dodatni opis uporabimo na spletni strani ali v Monimi specifično glede na tip in podtip povezave.',
  `quantity` tinyint(4) DEFAULT NULL COMMENT 'Količina izdelka v kompletu. Uporabno samo pri tipu 2.',
  `client_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Stran, za katero velja nastavitev, če obstaja več sestrskih strani.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

--
-- Table structure for table `stats`
--

CREATE TABLE `stats` (
  `id` int(10) UNSIGNED NOT NULL,
  `date_type` tinyint(4) DEFAULT NULL COMMENT 'Tip obdobja, na katerega se nanaša statistika.',
  `date` date DEFAULT NULL COMMENT 'Datum, na katerega se nanaša statistika. Lahko se nanaša tudi na teden, mesec, leto, sezono ali drugo obdobje, a se vedno zapiše datum prvega dneva tega obdobja.',
  `class` tinyint(4) DEFAULT NULL COMMENT 'Razred (šolski razred ali letnik), na katerega se nanaša statistika. Če je prazno, velja za vse razrede.',
  `type` tinyint(4) DEFAULT NULL COMMENT 'Na kaj se nanaša podatek, ki je shranjen v poljih tega zapisa.',
  `parameter` tinyint(4) DEFAULT NULL COMMENT 'Parameter, ki se nanaša na type, npr. iščemo število naročil po tipu, je v tem polju zapisan tip naročila.',
  `count` int(11) DEFAULT NULL COMMENT 'Podatek število, npr. skupno število naročil v obdobju.',
  `quantity` int(11) DEFAULT NULL COMMENT 'Podatek količina, npr. skupna količina naročenih izdelkov v obdobju.',
  `quantity_discounted` int(11) DEFAULT NULL COMMENT 'Podatek količina s popustom, npr. skupna količina naročenih izdelkov s popustom v obdobju.',
  `amount` decimal(10,4) DEFAULT NULL COMMENT 'Podatek prodajna vrednost z DDV, npr. skupna bruto prodajna vrednost naročenih izdelkov v obdobju.',
  `amount_net` decimal(10,4) DEFAULT NULL COMMENT 'Podatek prodajna vrednost brez DDV, npr. skupna neto prodajna vrednost naročenih izdelkov v obdobju.',
  `original_amount` decimal(10,4) DEFAULT NULL COMMENT 'Podatek originalna prodajna vrednost pred popusti z DDV, npr. skupna bruto prodajna vrednost naročenih izdelkov pred popusti v obdobju.',
  `original_amount_net` decimal(10,4) DEFAULT NULL COMMENT 'Podatek originalna prodajna vrednost pred popusti brez DDV, npr. skupna neto prodajna vrednost naročenih izdelkov pred popusti v obdobju.',
  `cost_amount` decimal(10,4) DEFAULT NULL COMMENT 'Podatek nabavna vrednost, npr. skupna nabavna vrednost prodanih izdelkov v obdobju.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

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

CREATE TABLE `streets` (
  `id` int(10) UNSIGNED NOT NULL,
  `street` text CHARACTER SET utf8mb3 COLLATE utf8mb3_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=utf8mb3 COLLATE=utf8mb3_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` text DEFAULT NULL COMMENT 'Interno besedilo, ki nam služi za sortiranje oznak v gridu (da so sortirani po nivojih).',
  `label` text 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` text DEFAULT NULL COMMENT 'Barva pisave oznake (taga).',
  `background_color` text DEFAULT NULL COMMENT 'Barva ozadja oznake (taga).',
  `inherited_text_color` text DEFAULT NULL COMMENT 'Barva pisave oznake (taga), prepisana iz nadrejene oznake, ker ta nima določene barve.',
  `inherited_background_color` text 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=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

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

CREATE TABLE `texts` (
  `id` int(10) UNSIGNED NOT NULL,
  `md5` varchar(32) NOT NULL,
  `text` mediumtext NOT NULL COMMENT 'Besedilo samo.',
  `template_group` tinyint(4) DEFAULT NULL COMMENT 'Na katerem mestu naj se besedilo prikaže kot predloga?',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

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

CREATE TABLE `unique_identifiers` (
  `id` int(10) UNSIGNED NOT NULL,
  `table_name` text 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=utf8mb3 COLLATE=utf8mb3_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` text 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=utf8mb3 COLLATE=utf8mb3_slovenian_ci;

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

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

CREATE TABLE `users` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `first_name` text DEFAULT NULL COMMENT 'Ime uporabnika.',
  `last_name` text 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` text 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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 NOT 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=utf8mb3 COLLATE=utf8mb3_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 `campaigns`
--
ALTER TABLE `campaigns`
  ADD PRIMARY KEY (`id`),
  ADD KEY `campaigns_pricelist_id_foreign` (`pricelist_id`),
  ADD KEY `campaigns_profile_id_foreign` (`profile_id`),
  ADD KEY `campaigns_created_by_id_foreign` (`created_by_id`),
  ADD KEY `campaigns_updated_by_id_foreign` (`updated_by_id`),
  ADD KEY `customers_last_saved_by_id_foreign` (`last_saved_by_id`);

--
-- 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`(1024));

--
-- Indexes for table `clients`
--
ALTER TABLE `clients`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `clients_identifier_unique` (`identifier`) USING HASH,
  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 `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_events`
--
ALTER TABLE `customer_events`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customer_events_customer_id_foreign` (`customer_id`),
  ADD KEY `customer_events_type_index` (`type`);

--
-- Indexes for table `customer_profile`
--
ALTER TABLE `customer_profile`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customer_profile_customer_id_foreign` (`customer_id`),
  ADD KEY `customer_profile_profile_id_foreign` (`profile_id`);

--
-- 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_order_group_index` (`order_group`),
  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`(1024)),
  ADD KEY `documents_ordered_at_status_index` (`ordered_at`,`status`);

--
-- Indexes for table `document_costs`
--
ALTER TABLE `document_costs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `document_costs_document_id_foreign` (`document_id`);

--
-- Indexes for table `document_counters`
--
ALTER TABLE `document_counters`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `document_counters_type_subtype_year_cash_register_id_unique` (`type`,`subtype`,`year`,`cash_register_id`),
  ADD KEY `document_counters_cash_register_id_foreign` (`cash_register_id`);

--
-- Indexes for table `document_courier_service`
--
ALTER TABLE `document_courier_service`
  ADD PRIMARY KEY (`id`),
  ADD KEY `document_courier_service_document_id_foreign` (`document_id`),
  ADD KEY `document_courier_service_courier_service_id_foreign` (`courier_service_id`),
  ADD KEY `document_courier_service_vat_id_foreign` (`vat_id`);

--
-- 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`) USING HASH,
  ADD KEY `eans_ean_index` (`ean_code`(1024)),
  ADD KEY `eans_item_id_index` (`item_id`),
  ADD KEY `eans_year_index` (`year`);

--
-- 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`);

--
-- 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_user_agent_text_foreign` (`user_agent_text`),
  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_reference`),
  ADD KEY `form_submissions_email_index` (`email`(1024));

--
-- 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 `form_submission_sessions`
--
ALTER TABLE `form_submission_sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `form_submission_sessions_form_id_foreign` (`form_id`),
  ADD KEY `form_submission_sessions_form_submission_id_foreign` (`form_submission_id`);

--
-- Indexes for table `history`
--
ALTER TABLE `history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `history_type_index` (`type`),
  ADD KEY `history_table_name_table_id_type_index` (`table_name`,`table_id`,`type`),
  ADD KEY `history_created_by_id_foreign` (`created_by_id`),
  ADD KEY `history_updated_by_id_foreign` (`updated_by_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`(1024));

--
-- Indexes for table `items`
--
ALTER TABLE `items`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `items_oznaka_year_unique` (`oznaka`,`year`),
  ADD KEY `items_warning_text_foreign` (`warning_text`),
  ADD KEY `items_remark_text_foreign` (`remark_text`),
  ADD KEY `items_sold_out_text_foreign` (`sold_out_text`),
  ADD KEY `items_vat_id_foreign` (`vat_id`),
  ADD KEY `items_description_short_text_foreign` (`description_short_text`),
  ADD KEY `items_description_long_text_foreign` (`description_long_text`),
  ADD KEY `items_brand_index` (`brand`(50)),
  ADD KEY `items_description_extra_text_foreign` (`description_extra_text`),
  ADD KEY `items_update_stock_journal_from_index` (`update_stock_journal_from`),
  ADD KEY `items_update_statistics_from_year_index` (`update_statistics_from_year`),
  ADD KEY `items_oznaka_index` (`oznaka`),
  ADD KEY `items_year_index` (`year`),
  ADD KEY `items_update_stock_journal_job_status_index` (`update_stock_journal_job_status`),
  ADD KEY `items_personalizer_index` (`personalizer`(1024)),
  ADD KEY `items_created_by_id_foreign` (`created_by_id`),
  ADD KEY `items_updated_by_id_foreign` (`updated_by_id`),
  ADD KEY `items_last_saved_by_id_foreign` (`last_saved_by_id`);

--
-- 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 `item_property`
--
ALTER TABLE `item_property`
  ADD PRIMARY KEY (`id`),
  ADD KEY `item_property_item_id_foreign` (`item_id`),
  ADD KEY `item_property_property_id_foreign` (`property_id`);

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

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

--
-- Indexes for table `messages`
--
ALTER TABLE `messages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `messages_table_name_table_id_type_index` (`table_name`,`table_id`,`type`),
  ADD KEY `messages_message_template_id_foreign` (`message_template_id`),
  ADD KEY `messages_queue_index` (`queue`),
  ADD KEY `messages_status_index` (`status`),
  ADD KEY `messages_job_batch_id_index` (`job_batch_id`),
  ADD KEY `messages_created_by_id_foreign` (`created_by_id`);

--
-- Indexes for table `message_templates`
--
ALTER TABLE `message_templates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `message_templates_created_by_id_foreign` (`created_by_id`),
  ADD KEY `message_templates_updated_by_id_foreign` (`updated_by_id`),
  ADD KEY `message_templates_status_index` (`status`),
  ADD KEY `message_templates_type_index` (`type`),
  ADD KEY `message_templates_user_id_foreign` (`user_id`),
  ADD KEY `message_templates_type_user_id_document_type_index` (`type`,`user_id`,`document_type`);

--
-- 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`(1024)),
  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`);

--
-- 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 `page_texts`
--
ALTER TABLE `page_texts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `page_texts_table_name_table_id_language_id_index` (`table_name`,`table_id`),
  ADD KEY `page_texts_table_name_table_id_type_status_index` (`table_name`,`table_id`,`type`,`status`),
  ADD KEY `page_texts_table_id_index` (`table_id`),
  ADD KEY `page_texts_created_by_id_foreign` (`created_by_id`),
  ADD KEY `page_texts_updated_by_id_foreign` (`updated_by_id`);
ALTER TABLE `page_texts` ADD FULLTEXT KEY `page_texts_plain_index` (`plain`);

--
-- 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`);

--
-- 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 `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `permissions_type_code_unique` (`type`,`code`) USING HASH;

--
-- Indexes for table `permission_role`
--
ALTER TABLE `permission_role`
  ADD PRIMARY KEY (`id`),
  ADD KEY `permission_role_role_id_index` (`role_id`),
  ADD KEY `permission_role_permission_id_index` (`permission_id`),
  ADD KEY `permission_role_created_by_id_foreign` (`created_by_id`),
  ADD KEY `permission_role_updated_by_id_foreign` (`updated_by_id`);

--
-- Indexes for table `permission_user`
--
ALTER TABLE `permission_user`
  ADD PRIMARY KEY (`id`),
  ADD KEY `permission_user_user_id_index` (`user_id`),
  ADD KEY `permission_user_permission_id_index` (`permission_id`),
  ADD KEY `permission_user_created_by_id_foreign` (`created_by_id`),
  ADD KEY `permission_user_updated_by_id_foreign` (`updated_by_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`);

--
-- Indexes for table `profiles`
--
ALTER TABLE `profiles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `profiles_coupon_id_foreign` (`coupon_id`),
  ADD KEY `profiles_locked_index` (`locked`);

--
-- Indexes for table `profile_conditions`
--
ALTER TABLE `profile_conditions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `profile_conditions_profile_id_index` (`profile_id`),
  ADD KEY `profile_conditions_profile_condition_group_id_foreign` (`profile_condition_group_id`);

--
-- Indexes for table `profile_condition_groups`
--
ALTER TABLE `profile_condition_groups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `profile_condition_groups_profile_id_foreign` (`profile_id`),
  ADD KEY `profile_condition_groups_parent_profile_id_foreign` (`parent_profile_id`);

--
-- Indexes for table `properties`
--
ALTER TABLE `properties`
  ADD PRIMARY KEY (`id`),
  ADD KEY `properties_type_index` (`type`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `roles_position_index` (`position`);

--
-- Indexes for table `role_user`
--
ALTER TABLE `role_user`
  ADD PRIMARY KEY (`id`),
  ADD KEY `role_user_user_id_index` (`user_id`),
  ADD KEY `role_user_role_id_index` (`role_id`);

--
-- Indexes for table `scheduled_jobs`
--
ALTER TABLE `scheduled_jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `scheduled_jobs_created_by_id_foreign` (`created_by_id`),
  ADD KEY `scheduled_jobs_job_batch_id_index` (`job_batch_id`),
  ADD KEY `scheduled_jobs_type_index` (`type`),
  ADD KEY `scheduled_jobs_status_index` (`status`);

--
-- 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 `sets`
--
ALTER TABLE `sets`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sets_parent_id_foreign` (`parent_id`),
  ADD KEY `sets_child_id_foreign` (`child_id`),
  ADD KEY `sets_type_index` (`type`),
  ADD KEY `sets_year_index` (`year`);

--
-- 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 `stats`
--
ALTER TABLE `stats`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stats_date_type_date_type_index` (`date_type`,`date`,`type`);

--
-- 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`(1024));

--
-- Indexes for table `texts`
--
ALTER TABLE `texts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `texts_md5_unique` (`md5`) USING BTREE;

--
-- 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`) USING HASH,
  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`);

--
-- 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 `campaigns`
--
ALTER TABLE `campaigns`
  MODIFY `id` int(10) 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 `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_events`
--
ALTER TABLE `customer_events`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `customer_profile`
--
ALTER TABLE `customer_profile`
  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_costs`
--
ALTER TABLE `document_costs`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `document_courier_service`
--
ALTER TABLE `document_courier_service`
  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 `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 `form_submission_sessions`
--
ALTER TABLE `form_submission_sessions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `history`
--
ALTER TABLE `history`
  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 `item_property`
--
ALTER TABLE `item_property`
  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_templates`
--
ALTER TABLE `message_templates`
  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=9;

--
-- 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 `page_texts`
--
ALTER TABLE `page_texts`
  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 `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `permission_user`
--
ALTER TABLE `permission_user`
  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 `profiles`
--
ALTER TABLE `profiles`
  MODIFY `id` smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT;

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

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

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

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

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

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

--
-- AUTO_INCREMENT for table `sets`
--
ALTER TABLE `sets`
  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 `stats`
--
ALTER TABLE `stats`
  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` bigint(20) 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 `campaigns`
--
ALTER TABLE `campaigns`
  ADD CONSTRAINT `campaigns_pricelist_id_foreign` FOREIGN KEY (`pricelist_id`) REFERENCES `pricelists` (`id`),
  ADD CONSTRAINT `campaigns_profile_id_foreign` FOREIGN KEY (`profile_id`) REFERENCES `profiles` (`id`) ON UPDATE CASCADE;

--
-- 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,
  ADD CONSTRAINT `coupon_item_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`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_events`
--
ALTER TABLE `customer_events`
  ADD CONSTRAINT `customer_events_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `customer_profile`
--
ALTER TABLE `customer_profile`
  ADD CONSTRAINT `customer_profile_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `customer_profile_profile_id_foreign` FOREIGN KEY (`profile_id`) REFERENCES `profiles` (`id`) ON UPDATE CASCADE;

--
-- 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`),
  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_costs`
--
ALTER TABLE `document_costs`
  ADD CONSTRAINT `document_costs_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`);

--
-- Constraints for table `document_counters`
--
ALTER TABLE `document_counters`
  ADD CONSTRAINT `document_counters_cash_register_id_foreign` FOREIGN KEY (`cash_register_id`) REFERENCES `cash_registers` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `document_courier_service`
--
ALTER TABLE `document_courier_service`
  ADD CONSTRAINT `document_courier_service_courier_service_id_foreign` FOREIGN KEY (`courier_service_id`) REFERENCES `courier_services` (`id`),
  ADD CONSTRAINT `document_courier_service_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`),
  ADD CONSTRAINT `document_courier_service_vat_id_foreign` FOREIGN KEY (`vat_id`) REFERENCES `vats` (`id`);

--
-- 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 `eans`
--
ALTER TABLE `eans`
  ADD CONSTRAINT `eans_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`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_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_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_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_user_agent_text_foreign` FOREIGN KEY (`user_agent_text`) REFERENCES `texts` (`id`) ON UPDATE CASCADE;

--
-- 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 `form_submission_sessions`
--
ALTER TABLE `form_submission_sessions`
  ADD CONSTRAINT `form_submission_sessions_form_id_foreign` FOREIGN KEY (`form_id`) REFERENCES `forms` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `form_submission_sessions_form_submission_id_foreign` FOREIGN KEY (`form_submission_id`) REFERENCES `form_submissions` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `history`
--
ALTER TABLE `history`
  ADD CONSTRAINT `history_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `history_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`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_description_extra_text_foreign` FOREIGN KEY (`description_extra_text`) REFERENCES `texts` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `items_description_long_text_foreign` FOREIGN KEY (`description_long_text`) REFERENCES `texts` (`id`),
  ADD CONSTRAINT `items_description_short_text_foreign` FOREIGN KEY (`description_short_text`) REFERENCES `texts` (`id`),
  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_foreign` FOREIGN KEY (`remark_text`) REFERENCES `texts` (`id`),
  ADD CONSTRAINT `items_sold_out_text_foreign` FOREIGN KEY (`sold_out_text`) REFERENCES `texts` (`id`),
  ADD CONSTRAINT `items_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `items_vat_id_foreign` FOREIGN KEY (`vat_id`) REFERENCES `vats` (`id`),
  ADD CONSTRAINT `items_warning_text_foreign` FOREIGN KEY (`warning_text`) REFERENCES `texts` (`id`);

--
-- 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,
  ADD CONSTRAINT `item_item_group_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `item_property`
--
ALTER TABLE `item_property`
  ADD CONSTRAINT `item_property_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `item_property_property_id_foreign` FOREIGN KEY (`property_id`) REFERENCES `properties` (`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_message_template_id_foreign` FOREIGN KEY (`message_template_id`) REFERENCES `message_templates` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `message_templates`
--
ALTER TABLE `message_templates`
  ADD CONSTRAINT `message_templates_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `message_templates_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `message_templates_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE;

--
-- 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_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 `page_texts`
--
ALTER TABLE `page_texts`
  ADD CONSTRAINT `page_texts_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `page_texts_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE;

--
-- 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 `permission_role`
--
ALTER TABLE `permission_role`
  ADD CONSTRAINT `permission_role_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `permission_role_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`),
  ADD CONSTRAINT `permission_role_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`),
  ADD CONSTRAINT `permission_role_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `permission_user`
--
ALTER TABLE `permission_user`
  ADD CONSTRAINT `permission_user_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `permission_user_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`),
  ADD CONSTRAINT `permission_user_updated_by_id_foreign` FOREIGN KEY (`updated_by_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `permission_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`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`),
  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_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`),
  ADD CONSTRAINT `prices_pricelist_id_foreign` FOREIGN KEY (`pricelist_id`) REFERENCES `pricelists` (`id`) ON UPDATE CASCADE;

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

--
-- Constraints for table `profile_conditions`
--
ALTER TABLE `profile_conditions`
  ADD CONSTRAINT `profile_conditions_profile_condition_group_id_foreign` FOREIGN KEY (`profile_condition_group_id`) REFERENCES `profile_condition_groups` (`id`),
  ADD CONSTRAINT `profile_conditions_profile_id_foreign` FOREIGN KEY (`profile_id`) REFERENCES `profiles` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `profile_condition_groups`
--
ALTER TABLE `profile_condition_groups`
  ADD CONSTRAINT `profile_condition_groups_parent_profile_id_foreign` FOREIGN KEY (`parent_profile_id`) REFERENCES `profiles` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `profile_condition_groups_profile_id_foreign` FOREIGN KEY (`profile_id`) REFERENCES `profiles` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `role_user`
--
ALTER TABLE `role_user`
  ADD CONSTRAINT `role_user_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`),
  ADD CONSTRAINT `role_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `scheduled_jobs`
--
ALTER TABLE `scheduled_jobs`
  ADD CONSTRAINT `scheduled_jobs_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `scheduled_jobs_job_batch_id_foreign` FOREIGN KEY (`job_batch_id`) REFERENCES `job_batches` (`id`);

--
-- Constraints for table `sets`
--
ALTER TABLE `sets`
  ADD CONSTRAINT `sets_child_id_foreign` FOREIGN KEY (`child_id`) REFERENCES `items` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `sets_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `items` (`id`) ON DELETE 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,
  ADD CONSTRAINT `settings_user_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`);

--
-- 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 */;
