-- Assembly component rules for Sales Order rules
CREATE TABLE llx_prod_so_rules (
    rowid           integer AUTO_INCREMENT PRIMARY KEY,
    entity          integer DEFAULT 1 NOT NULL,
    fk_ruleset      integer NOT NULL,
    comp_ref        varchar(128) NOT NULL,
    qty             double DEFAULT 1 NOT NULL,
    pos             integer DEFAULT 0 NOT NULL,
    note            varchar(255),
    fk_user_creat   integer,
    datec           datetime,
    tms             timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    active          tinyint DEFAULT 1 NOT NULL
) ENGINE=innodb;

ALTER TABLE llx_prod_so_rules ADD INDEX idx_prod_so_rules_fk (fk_ruleset);
