-- -------------------------------------------------------------
-- TablePlus 6.7.0(634)
--
-- https://tableplus.com/
--
-- Database: sx_db_1751480457
-- Generation Time: 2025-09-12 12:23:27.3540
-- -------------------------------------------------------------


/*!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 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!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 */;


CREATE TABLE `items` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `refid` bigint(20) unsigned DEFAULT NULL,
  `external_id` varchar(255) DEFAULT NULL,
  `formid` bigint(20) DEFAULT NULL,
  `synced` tinyint(1) NOT NULL DEFAULT 0,
  `title` varchar(255) DEFAULT NULL,
  `fields` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`fields`)),
  `tag` varchar(255) DEFAULT NULL,
  `availabletopartners` tinyint(1) NOT NULL DEFAULT 0,
  `averagecost` decimal(10,2) NOT NULL DEFAULT 0.00,
  `class` bigint(20) unsigned DEFAULT NULL,
  `billingschedule` bigint(20) unsigned DEFAULT NULL,
  `billqtyvarianceacct` bigint(20) unsigned DEFAULT NULL,
  `copydescription` tinyint(1) NOT NULL DEFAULT 0,
  `cost` varchar(255) DEFAULT NULL,
  `costestimatetype` varchar(255) DEFAULT NULL,
  `costestimate` varchar(255) DEFAULT NULL,
  `countryofmanufacture` varchar(255) DEFAULT NULL,
  `maximumquantity` bigint(20) unsigned DEFAULT NULL,
  `minimumquantity` bigint(20) unsigned DEFAULT NULL,
  `createjob` tinyint(1) NOT NULL DEFAULT 0,
  `deferrevrec` tinyint(1) NOT NULL DEFAULT 0,
  `directrevenueposting` tinyint(1) NOT NULL DEFAULT 0,
  `displayname` varchar(255) DEFAULT NULL,
  `dontshowprice` tinyint(1) NOT NULL DEFAULT 0,
  `enforceminqtyinternally` tinyint(1) NOT NULL DEFAULT 1,
  `excludefromsitemap` tinyint(1) NOT NULL DEFAULT 0,
  `fullname` varchar(255) DEFAULT NULL,
  `generateaccruals` tinyint(1) NOT NULL DEFAULT 0,
  `includechildren` tinyint(1) NOT NULL DEFAULT 0,
  `incomeaccount` bigint(20) unsigned DEFAULT NULL,
  `deferredrevenueaccount` bigint(20) unsigned DEFAULT NULL,
  `isdonationitem` tinyint(1) NOT NULL DEFAULT 0,
  `isdropshipitem` tinyint(1) NOT NULL DEFAULT 0,
  `isfulfillable` tinyint(1) NOT NULL DEFAULT 0,
  `isinactive` tinyint(1) NOT NULL DEFAULT 0,
  `isonline` tinyint(1) NOT NULL DEFAULT 0,
  `isspecialorderitem` tinyint(1) NOT NULL DEFAULT 0,
  `itemtype` varchar(255) DEFAULT NULL,
  `lastmodifieddate` datetime DEFAULT NULL,
  `price` decimal(10,2) DEFAULT 0.00,
  `rate` double DEFAULT NULL,
  `upcCode` varchar(999) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `storedescription` text DEFAULT NULL,
  `lastpurchaseprice` decimal(10,2) DEFAULT 0.00,
  `location` bigint(20) unsigned DEFAULT NULL,
  `outofstockbehavior` varchar(255) DEFAULT 'DEFAULT',
  `parent` bigint(20) unsigned DEFAULT NULL,
  `pricinggroup` bigint(20) unsigned DEFAULT NULL,
  `revenuerecognitionrule` bigint(20) unsigned DEFAULT NULL,
  `revrecforecastrule` bigint(20) unsigned DEFAULT NULL,
  `shipindividually` tinyint(1) NOT NULL DEFAULT 0,
  `showdefaultdonationamount` tinyint(1) NOT NULL DEFAULT 0,
  `subtype` varchar(255) DEFAULT NULL,
  `usemarginalrates` tinyint(1) NOT NULL DEFAULT 0,
  `created_by` bigint(20) DEFAULT -1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `subsidiary` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '(DC2Type:json)' CHECK (json_valid(`subsidiary`)),
  PRIMARY KEY (`id`),
  UNIQUE KEY `items_refid_synced_unique` (`refid`,`synced`),
  UNIQUE KEY `items_external_id_unique` (`external_id`),
  KEY `items_refid_index` (`refid`),
  KEY `items_formid_foreign` (`formid`),
  CONSTRAINT `items_formid_foreign` FOREIGN KEY (`formid`) REFERENCES `entry_forms` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=374 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;