-- --------------------------------------------------------
-- Host:                         127.0.0.1
-- Versione server:              12.3.2-MariaDB - MariaDB Server
-- S.O. server:                  Win64
-- HeidiSQL Versione:            12.17.0.7270
-- --------------------------------------------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

-- Dump della struttura di tabella gump.article
CREATE TABLE IF NOT EXISTS `article` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `subtitle` varchar(100) DEFAULT NULL,
  `short_description` varchar(200) DEFAULT NULL,
  `long_description` varchar(200) DEFAULT NULL,
  `attribute` text DEFAULT NULL,
  `sku` varchar(100) DEFAULT NULL,
  `available_on_pos` tinyint(1) DEFAULT NULL,
  `last_value_cost` decimal(7,2) DEFAULT NULL,
  `last_value_sale` decimal(7,2) DEFAULT NULL,
  `last_value_cost_taxable` decimal(7,2) DEFAULT NULL,
  `last_value_sale_taxable` decimal(7,2) DEFAULT NULL,
  `discount` decimal(7,2) DEFAULT NULL,
  `id_unit_measure` int(11) DEFAULT NULL,
  `id_rate` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-unit-measure-article` (`id_unit_measure`),
  KEY `fk-id-rate-article` (`id_rate`),
  KEY `idx-code` (`code`),
  CONSTRAINT `fk-id-rate-article` FOREIGN KEY (`id_rate`) REFERENCES `rate` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `fk-id-unit-measure-article` FOREIGN KEY (`id_unit_measure`) REFERENCES `unit_measure` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.article_barcode
CREATE TABLE IF NOT EXISTS `article_barcode` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_article` int(11) DEFAULT NULL,
  `barcode` varchar(20) DEFAULT NULL,
  `ratio` decimal(8,3) unsigned DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-article-article-barcode` (`id_article`),
  KEY `idx-barcode` (`barcode`),
  CONSTRAINT `fk-id-article-article-barcode` FOREIGN KEY (`id_article`) REFERENCES `article` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.article_category
CREATE TABLE IF NOT EXISTS `article_category` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_article` int(11) DEFAULT NULL,
  `id_category` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-article-article-category` (`id_article`),
  KEY `fk-id-category-article-category` (`id_category`),
  CONSTRAINT `fk-id-article-article-category` FOREIGN KEY (`id_article`) REFERENCES `article` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-category-article-category` FOREIGN KEY (`id_category`) REFERENCES `category` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.article_image
CREATE TABLE IF NOT EXISTS `article_image` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `link` text DEFAULT NULL,
  `cover_pos` tinyint(1) DEFAULT NULL,
  `id_media` int(11) DEFAULT NULL,
  `id_article` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-article-article-images` (`id_article`),
  KEY `fk-id-media-article-images` (`id_media`),
  CONSTRAINT `fk-id-article-article-images` FOREIGN KEY (`id_article`) REFERENCES `article` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-media-article-images` FOREIGN KEY (`id_media`) REFERENCES `media` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.article_price
CREATE TABLE IF NOT EXISTS `article_price` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_article` int(11) DEFAULT NULL,
  `id_price` int(11) DEFAULT NULL,
  `price` decimal(7,2) DEFAULT NULL,
  `taxable` decimal(16,8) DEFAULT NULL,
  `tax` decimal(16,8) DEFAULT NULL,
  `id_rate` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-article-article-price` (`id_article`),
  KEY `fk-id-price-article-price` (`id_price`),
  KEY `fk-id-rate-article-price` (`id_rate`),
  CONSTRAINT `fk-id-article-article-price` FOREIGN KEY (`id_article`) REFERENCES `article` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-price-article-price` FOREIGN KEY (`id_price`) REFERENCES `price` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-rate-article-price` FOREIGN KEY (`id_rate`) REFERENCES `rate` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.article_store
CREATE TABLE IF NOT EXISTS `article_store` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_article` int(11) DEFAULT NULL,
  `id_store` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-article-article-store` (`id_article`),
  KEY `fk-id-store-article-store` (`id_store`),
  CONSTRAINT `fk-id-article-article-store` FOREIGN KEY (`id_article`) REFERENCES `article` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-store-article-store` FOREIGN KEY (`id_store`) REFERENCES `store` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.attribute
CREATE TABLE IF NOT EXISTS `attribute` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `id_tipology` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-tipology-attribute` (`id_tipology`),
  CONSTRAINT `fk-id-tipology-attribute` FOREIGN KEY (`id_tipology`) REFERENCES `tipology` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.category
CREATE TABLE IF NOT EXISTS `category` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `subtitle` varchar(100) DEFAULT NULL,
  `color` varchar(20) DEFAULT NULL,
  `available_on_pos` tinyint(1) DEFAULT NULL,
  `id_category` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-category-category` (`id_category`),
  CONSTRAINT `fk-id-category-category` FOREIGN KEY (`id_category`) REFERENCES `category` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di procedura gump.clear_database
DELIMITER //
CREATE PROCEDURE `clear_database`()
BEGIN
    DECLARE done INT DEFAULT FALSE;
    DECLARE tableName VARCHAR(255);

    DECLARE cur CURSOR FOR
        SELECT table_name
        FROM information_schema.tables
        WHERE table_schema = DATABASE()
          AND table_type = 'BASE TABLE';

    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;

    SET FOREIGN_KEY_CHECKS = 0;

    OPEN cur;

    read_loop: LOOP
        FETCH cur INTO tableName;
        IF done THEN
            LEAVE read_loop;
        END IF;

        SET @sql = CONCAT('TRUNCATE TABLE `', tableName, '`');
        PREPARE stmt FROM @sql;
        EXECUTE stmt;
        DEALLOCATE PREPARE stmt;
    END LOOP;

    CLOSE cur;

    SET FOREIGN_KEY_CHECKS = 1;
END//
DELIMITER ;

-- Dump della struttura di tabella gump.credit_note_counter
CREATE TABLE IF NOT EXISTS `credit_note_counter` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `prefix` varchar(10) DEFAULT NULL,
  `suffix` varchar(10) DEFAULT NULL,
  `current_number` int(11) DEFAULT NULL,
  `active` tinyint(1) DEFAULT NULL,
  `id_store` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`) USING BTREE,
  KEY `fk-id-store-credit-note-counter` (`id_store`),
  CONSTRAINT `fk-id-store-credit-note-counter` FOREIGN KEY (`id_store`) REFERENCES `store` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.customer
CREATE TABLE IF NOT EXISTS `customer` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `business_name` varchar(100) DEFAULT NULL,
  `firstname` varchar(60) DEFAULT NULL,
  `lastname` varchar(60) DEFAULT NULL,
  `vat_number` varchar(20) DEFAULT NULL,
  `fiscal_code` varchar(20) DEFAULT NULL,
  `city` varchar(60) DEFAULT NULL,
  `address` varchar(120) DEFAULT NULL,
  `province` char(2) DEFAULT NULL,
  `zip_code` varchar(20) DEFAULT NULL,
  `sdi_code` varchar(10) DEFAULT NULL,
  `pec` varchar(256) DEFAULT NULL,
  `phone_number` varchar(20) DEFAULT NULL,
  `email` varchar(256) DEFAULT NULL,
  `id_price_default` int(11) DEFAULT NULL,
  `id_payment_default` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-price-default-customer` (`id_price_default`),
  KEY `fk-id-payment-default-customer` (`id_payment_default`),
  CONSTRAINT `fk-id-payment-default-customer` FOREIGN KEY (`id_payment_default`) REFERENCES `payment` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-price-default-customer` FOREIGN KEY (`id_price_default`) REFERENCES `price` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.device
CREATE TABLE IF NOT EXISTS `device` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `fiscal_printer_ip` varchar(30) DEFAULT NULL,
  `fiscal_printer_model` varchar(40) DEFAULT NULL,
  `fiscal_printer_serial` varchar(40) DEFAULT NULL,
  `no_fiscal_printer_ip` varchar(40) DEFAULT NULL,
  `id_store` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-store-device` (`id_store`),
  CONSTRAINT `fk-id-store-device` FOREIGN KEY (`id_store`) REFERENCES `store` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.document
CREATE TABLE IF NOT EXISTS `document` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `document_area` enum('charge','discharge','sale','cancel','refund','invoice','credit_note','training','transfer_in','transfer_out','neutral','ddt_sale','ddt_purchase','inventory') DEFAULT NULL,
  `document_date` date DEFAULT NULL,
  `document_time` time DEFAULT NULL,
  `document_progressive` int(11) DEFAULT NULL,
  `document_number` varchar(20) DEFAULT NULL,
  `receipt_number` varchar(4) DEFAULT NULL,
  `receipt_close` varchar(4) DEFAULT NULL,
  `amount` decimal(7,2) DEFAULT NULL,
  `amount_taxable` decimal(16,8) DEFAULT NULL,
  `amount_tax` decimal(16,8) DEFAULT NULL,
  `amount_discount` decimal(7,2) DEFAULT NULL,
  `amount_taxable_discount` decimal(16,8) DEFAULT NULL,
  `amount_tax_discount` decimal(16,8) DEFAULT NULL,
  `note` varchar(100) DEFAULT NULL,
  `invoice_xml` text DEFAULT NULL,
  `cancelled` tinyint(1) DEFAULT 0,
  `id_price` int(11) DEFAULT NULL,
  `id_ref_document` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-ref-document-document` (`id_ref_document`),
  KEY `fk-id-price-document` (`id_price`),
  KEY `index-filter` (`document_area`,`document_date`) USING BTREE,
  KEY `index-filter-receipt-number` (`receipt_number`,`receipt_close`),
  KEY `index-filter-document-number` (`document_number`),
  CONSTRAINT `fk-id-price-document` FOREIGN KEY (`id_price`) REFERENCES `price` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-ref-document-document` FOREIGN KEY (`id_ref_document`) REFERENCES `document` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.document_customer
CREATE TABLE IF NOT EXISTS `document_customer` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `business_name` varchar(100) DEFAULT NULL,
  `firstname` varchar(60) DEFAULT NULL,
  `lastname` varchar(60) DEFAULT NULL,
  `vat_number` varchar(20) DEFAULT NULL,
  `fiscal_code` varchar(20) DEFAULT NULL,
  `city` varchar(60) DEFAULT NULL,
  `address` varchar(120) DEFAULT NULL,
  `province` char(2) DEFAULT NULL,
  `zip_code` varchar(20) DEFAULT NULL,
  `sdi_code` varchar(10) DEFAULT NULL,
  `pec` varchar(256) DEFAULT NULL,
  `phone_number` varchar(20) DEFAULT NULL,
  `email` varchar(256) DEFAULT NULL,
  `id_customer` int(11) DEFAULT NULL,
  `id_document` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-document-document-customer` (`id_document`),
  KEY `FK_document_customer_customer` (`id_customer`),
  CONSTRAINT `FK_document_customer_customer` FOREIGN KEY (`id_customer`) REFERENCES `customer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-document-document-customer` FOREIGN KEY (`id_document`) REFERENCES `document` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.document_device
CREATE TABLE IF NOT EXISTS `document_device` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `id_device` int(11) DEFAULT NULL,
  `id_document` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-device-document-device` (`id_device`),
  KEY `fk-id-document-document-device` (`id_document`),
  CONSTRAINT `fk-id-device-document-device` FOREIGN KEY (`id_device`) REFERENCES `device` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-document-document-device` FOREIGN KEY (`id_document`) REFERENCES `document` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.document_discount
CREATE TABLE IF NOT EXISTS `document_discount` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `discount` decimal(7,2) DEFAULT NULL,
  `id_document` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-document-document-discount` (`id_document`),
  CONSTRAINT `fk-id-document-document-discount` FOREIGN KEY (`id_document`) REFERENCES `document` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.document_log_debug
CREATE TABLE IF NOT EXISTS `document_log_debug` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `payload` text DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.document_operator
CREATE TABLE IF NOT EXISTS `document_operator` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `id_operator` int(11) DEFAULT NULL,
  `id_document` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-operator-document-operator` (`id_operator`),
  KEY `fk-id-document-document-operator` (`id_document`),
  CONSTRAINT `fk-id-document-document-operator` FOREIGN KEY (`id_document`) REFERENCES `document` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-operator-document-operator` FOREIGN KEY (`id_operator`) REFERENCES `operator` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.document_payment
CREATE TABLE IF NOT EXISTS `document_payment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `amount` decimal(7,2) DEFAULT NULL,
  `payment_type` varchar(10) DEFAULT NULL,
  `id_payment` int(11) DEFAULT NULL,
  `id_document` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-payment-document-payment` (`id_payment`),
  KEY `fk-id-document-document-payment` (`id_document`),
  CONSTRAINT `fk-id-document-document-payment` FOREIGN KEY (`id_document`) REFERENCES `document` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-payment-document-payment` FOREIGN KEY (`id_payment`) REFERENCES `payment` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.document_progressive
CREATE TABLE IF NOT EXISTS `document_progressive` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `document_area` enum('charge','discharge','sale','cancel','refund','invoice','credit_note','training','transfer_in','transfer_out','neutral','ddt_sale','ddt_purchase','inventory') DEFAULT NULL,
  `progressive` int(11) DEFAULT NULL,
  `id_store` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-store-document-progressive` (`id_store`),
  CONSTRAINT `fk-id-store-document-progressive` FOREIGN KEY (`id_store`) REFERENCES `store` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.document_row
CREATE TABLE IF NOT EXISTS `document_row` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `barcode` varchar(20) DEFAULT NULL,
  `quantity` decimal(10,3) DEFAULT NULL,
  `price` decimal(7,2) DEFAULT NULL,
  `taxable` decimal(16,8) DEFAULT NULL,
  `tax` decimal(16,8) DEFAULT NULL,
  `amount` decimal(7,2) DEFAULT NULL,
  `amount_taxable` decimal(16,8) DEFAULT NULL,
  `amount_tax` decimal(16,8) DEFAULT NULL,
  `price_discount` decimal(7,2) DEFAULT NULL,
  `taxable_discount` decimal(16,8) DEFAULT NULL,
  `tax_discount` decimal(16,8) DEFAULT NULL,
  `amount_discount` decimal(7,2) DEFAULT NULL,
  `amount_taxable_discount` decimal(16,8) DEFAULT NULL,
  `amount_tax_discount` decimal(16,8) DEFAULT NULL,
  `rate` decimal(4,2) DEFAULT NULL,
  `nature` varchar(10) DEFAULT NULL,
  `enforceability` varchar(10) DEFAULT NULL,
  `id_article` int(11) DEFAULT NULL,
  `id_document` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-document-document-row` (`id_document`),
  KEY `fk-id-article-document-row` (`id_article`),
  CONSTRAINT `fk-id-article-document-row` FOREIGN KEY (`id_article`) REFERENCES `article` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-document-document-row` FOREIGN KEY (`id_document`) REFERENCES `document` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.document_storage
CREATE TABLE IF NOT EXISTS `document_storage` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `id_storage` int(11) DEFAULT NULL,
  `id_document` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-storage-document-storage` (`id_storage`),
  KEY `fk-id-document-document-storage` (`id_document`),
  CONSTRAINT `fk-id-document-document-storage` FOREIGN KEY (`id_document`) REFERENCES `document` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-storage-document-storage` FOREIGN KEY (`id_storage`) REFERENCES `storage` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.document_store
CREATE TABLE IF NOT EXISTS `document_store` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `id_store` int(11) DEFAULT NULL,
  `id_document` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-store-document-store` (`id_store`),
  KEY `fk-id-document-document-store` (`id_document`),
  CONSTRAINT `fk-id-document-document-store` FOREIGN KEY (`id_document`) REFERENCES `document` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-store-document-store` FOREIGN KEY (`id_store`) REFERENCES `store` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.document_supplier
CREATE TABLE IF NOT EXISTS `document_supplier` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `business_name` varchar(100) DEFAULT NULL,
  `firstname` varchar(60) DEFAULT NULL,
  `lastname` varchar(60) DEFAULT NULL,
  `vat_number` varchar(20) DEFAULT NULL,
  `fiscal_code` varchar(20) DEFAULT NULL,
  `city` varchar(60) DEFAULT NULL,
  `address` varchar(120) DEFAULT NULL,
  `province` char(2) DEFAULT NULL,
  `zip_code` varchar(20) DEFAULT NULL,
  `sdi_code` varchar(10) DEFAULT NULL,
  `pec` varchar(256) DEFAULT NULL,
  `phone_number` varchar(20) DEFAULT NULL,
  `email` varchar(256) DEFAULT NULL,
  `id_supplier` int(11) DEFAULT NULL,
  `id_document` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-document-document-supplier` (`id_document`),
  KEY `fk-id-supplier-document-supplier` (`id_supplier`),
  CONSTRAINT `fk-id-document-document-supplier` FOREIGN KEY (`id_document`) REFERENCES `document` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-supplier-document-supplier` FOREIGN KEY (`id_supplier`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.document_user
CREATE TABLE IF NOT EXISTS `document_user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `id_user` int(11) DEFAULT NULL,
  `id_document` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-user-document-user` (`id_user`),
  KEY `fk-id-document-document-user` (`id_document`),
  CONSTRAINT `fk-id-document-document-user` FOREIGN KEY (`id_document`) REFERENCES `document` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-user-document-user` FOREIGN KEY (`id_user`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.events
CREATE TABLE IF NOT EXISTS `events` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `method` varchar(30) DEFAULT NULL,
  `pathname` varchar(200) DEFAULT NULL,
  `body` text DEFAULT NULL,
  `user` varchar(200) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.fidelity
CREATE TABLE IF NOT EXISTS `fidelity` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `ratio` smallint(6) DEFAULT NULL,
  `credit` decimal(7,2) DEFAULT NULL,
  `id_store` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.invoice_counter
CREATE TABLE IF NOT EXISTS `invoice_counter` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `prefix` varchar(10) DEFAULT NULL,
  `suffix` varchar(10) DEFAULT NULL,
  `current_number` int(11) DEFAULT NULL,
  `active` tinyint(1) DEFAULT NULL,
  `id_store` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-store-invoice-counter` (`id_store`),
  CONSTRAINT `fk-id-store-invoice-counter` FOREIGN KEY (`id_store`) REFERENCES `store` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.media
CREATE TABLE IF NOT EXISTS `media` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `uuid` char(36) DEFAULT NULL,
  `extension` varchar(10) DEFAULT NULL,
  `title` varchar(150) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux-uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.movement
CREATE TABLE IF NOT EXISTS `movement` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `movement_date` date DEFAULT NULL,
  `charge` decimal(10,3) DEFAULT NULL,
  `discharge` decimal(10,3) DEFAULT NULL,
  `id_article` int(11) DEFAULT NULL,
  `id_store` int(11) DEFAULT NULL,
  `id_storage` int(11) DEFAULT NULL,
  `id_document` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-article-movement` (`id_article`),
  KEY `fk-id-document-movement` (`id_document`),
  KEY `fk-id-store-movement` (`id_store`),
  KEY `fk-id-storage-movement` (`id_storage`),
  KEY `index-movement-date` (`movement_date`),
  CONSTRAINT `fk-id-article-movement` FOREIGN KEY (`id_article`) REFERENCES `article` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-document-movement` FOREIGN KEY (`id_document`) REFERENCES `document` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-storage-movement` FOREIGN KEY (`id_storage`) REFERENCES `storage` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-store-movement` FOREIGN KEY (`id_store`) REFERENCES `store` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.operator
CREATE TABLE IF NOT EXISTS `operator` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `pin` varchar(15) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux-pin` (`pin`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.payment
CREATE TABLE IF NOT EXISTS `payment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `payment_type` varchar(10) DEFAULT NULL,
  `tend` smallint(5) unsigned DEFAULT NULL,
  `subtend` smallint(5) unsigned DEFAULT NULL,
  `available_on_pos` tinyint(1) unsigned DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.price
CREATE TABLE IF NOT EXISTS `price` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.rate
CREATE TABLE IF NOT EXISTS `rate` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `value` decimal(4,2) DEFAULT NULL,
  `nature` varchar(10) DEFAULT NULL,
  `enforceability` varchar(10) DEFAULT NULL,
  `department_number` smallint(5) unsigned DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.storage
CREATE TABLE IF NOT EXISTS `storage` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `id_store` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-storage-store` (`id_store`),
  CONSTRAINT `fk-id-storage-store` FOREIGN KEY (`id_store`) REFERENCES `store` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.store
CREATE TABLE IF NOT EXISTS `store` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `business_name` varchar(100) DEFAULT NULL,
  `vat_number` varchar(20) DEFAULT NULL,
  `fiscal_code` varchar(20) DEFAULT NULL,
  `fiscal_regim` varchar(20) DEFAULT NULL,
  `city` varchar(60) DEFAULT NULL,
  `address` varchar(100) DEFAULT NULL,
  `province` char(2) DEFAULT NULL,
  `zip_code` varchar(20) DEFAULT NULL,
  `country_code` varchar(5) DEFAULT NULL,
  `phone_number` varchar(20) DEFAULT NULL,
  `email` varchar(256) DEFAULT NULL,
  `id_price` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-price-store` (`id_price`),
  CONSTRAINT `fk-id-price-store` FOREIGN KEY (`id_price`) REFERENCES `price` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.supplier
CREATE TABLE IF NOT EXISTS `supplier` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `business_name` varchar(100) DEFAULT NULL,
  `firstname` varchar(60) DEFAULT NULL,
  `lastname` varchar(60) DEFAULT NULL,
  `vat_number` varchar(20) DEFAULT NULL,
  `fiscal_code` varchar(20) DEFAULT NULL,
  `city` varchar(60) DEFAULT NULL,
  `address` varchar(120) DEFAULT NULL,
  `province` char(2) DEFAULT NULL,
  `zip_code` varchar(20) DEFAULT NULL,
  `sdi_code` varchar(10) DEFAULT NULL,
  `pec` varchar(256) DEFAULT NULL,
  `phone_number` varchar(20) DEFAULT NULL,
  `email` varchar(256) DEFAULT NULL,
  `id_price_default` int(11) DEFAULT NULL,
  `id_payment_default` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk-id-payment-default-supplier` (`id_payment_default`),
  KEY `FK_supplier_price` (`id_price_default`),
  CONSTRAINT `FK_supplier_price` FOREIGN KEY (`id_price_default`) REFERENCES `price` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk-id-payment-default-supplier` FOREIGN KEY (`id_payment_default`) REFERENCES `payment` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.tipology
CREATE TABLE IF NOT EXISTS `tipology` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.unit_measure
CREATE TABLE IF NOT EXISTS `unit_measure` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

-- Dump della struttura di tabella gump.user
CREATE TABLE IF NOT EXISTS `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(100) NOT NULL,
  `title` varchar(100) DEFAULT NULL,
  `username` varchar(20) DEFAULT NULL,
  `password` varchar(256) DEFAULT NULL,
  `p_article` tinyint(1) DEFAULT 1,
  `p_attribute` tinyint(1) DEFAULT 1,
  `p_category` tinyint(1) DEFAULT 1,
  `p_credit_note_counter` tinyint(1) DEFAULT 1,
  `p_customer` tinyint(1) DEFAULT 1,
  `p_device` tinyint(1) DEFAULT 1,
  `p_document` tinyint(1) DEFAULT 1,
  `p_event` tinyint(1) DEFAULT 1,
  `p_invoice_counter` tinyint(1) DEFAULT 1,
  `p_movement` tinyint(1) DEFAULT 1,
  `p_operator` tinyint(1) DEFAULT 1,
  `p_payment` tinyint(1) DEFAULT 1,
  `p_price` tinyint(1) DEFAULT 1,
  `p_rate` tinyint(1) DEFAULT 1,
  `p_storage` tinyint(1) DEFAULT 1,
  `p_store` tinyint(1) DEFAULT 1,
  `p_supplier` tinyint(1) DEFAULT 1,
  `p_tipology` tinyint(1) DEFAULT 1,
  `p_unit_measure` tinyint(1) DEFAULT 1,
  `p_user` tinyint(1) DEFAULT 1,
  `p_media` tinyint(1) DEFAULT 1,
  `p_ai` tinyint(1) DEFAULT 1,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux-username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

-- L’esportazione dei dati non era selezionata.

/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
