-- 01: CREATE ocr_customer_match_rule (sin foreign keys)
SET NAMES utf8mb4;

CREATE TABLE IF NOT EXISTS `ocr_customer_match_rule` (
  `id` BIGINT AUTO_INCREMENT NOT NULL,
  `maincompany_id` INT NOT NULL,
  `name` VARCHAR(100) NOT NULL,
  `pattern` VARCHAR(255) NOT NULL,
  `source_field` VARCHAR(50) NOT NULL,
  `priority` INT NOT NULL,
  `enabled` TINYINT(1) NOT NULL DEFAULT 1,
  `created_at` DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)',
  `updated_at` DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)',
  INDEX `IDX_3D05263918C8CC62` (`maincompany_id`),
  INDEX `idx_ocr_customer_match_rule_company_enabled_priority` (`maincompany_id`, `enabled`, `priority`),
  PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
