-- Table to store parallel corpora data

DROP TABLE IF EXISTS /*_*/cx_corpora;
CREATE TABLE /*_*/cx_corpora (
    cxc_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
    -- Translation to join with cx_translations
    cxc_translation_id int NOT NULL,
    -- Section id, generated by Parsoid
    cxc_section_id varbinary(30) NOT NULL,
    -- Origin of the content. Can be source, Apertium, Yandex etc, and user
    cxc_origin varbinary(30) NOT NULL,
    -- Optional sequence id
    cxc_sequence_id int,
    -- Optional timestamp
    cxc_timestamp varchar(14) binary,
    -- Content
    cxc_content mediumblob
) /*$wgDBTableOptions*/;

CREATE UNIQUE INDEX /*_*/cx_corpora_unique ON /*_*/cx_corpora (
    cxc_translation_id,
    cxc_origin,
    cxc_section_id,
    cxc_timestamp
);
