<commit_before>CREATE TABLE CHANNELS (
    ID            VARCHAR(36) NOT NULL,
    NAME          VARCHAR(255) UNIQUE,
    
    PRIMARY KEY (ID)
);

CREATE TABLE ARTIFACTS (
    ID            VARCHAR(36) NOT NULL,
    CHANNEL_ID    VARCHAR(36) NOT NULL,
    `TYPE`        VARCHAR(8) NOT NULL,
    
    PARENT        VARCHAR(36),
    
    NAME          VARCHAR(255) NOT NULL,
    
    DATA          LONGBLOB,
    SIZE          NUMERIC NOT NULL,
    
    CREATION_TS   DATETIME NOT NULL,
    
    PRIMARY KEY (ID),
    FOREIGN KEY (CHANNEL_ID) REFERENCES CHANNELS(ID),
    FOREIGN KEY (PARENT) REFERENCES ARTIFACTS(ID)

    ON DELETE CASCADE
);

CREATE TABLE VIRTUAL_ARTIFACTS (
    ID            VARCHAR(36) NOT NULL,
    NS            VARCHAR(255) NOT NULL,
    
    PRIMARY KEY (ID),
    FOREIGN KEY (ID) REFERENCES ARTIFACTS(ID)
    ON DELETE CASCADE
);

CREATE TABLE GENERATED_ARTIFACTS (
    ID            VARCHAR(36) NOT NULL,
    
    GENERATOR_ID    VARCHAR(255) NOT NULL,
    
    PRIMARY KEY (ID),
    FOREIGN KEY (ID) REFERENCES ARTIFACTS(ID)
    ON DELETE CASCADE
);

CREATE TABLE EXT_ART_PROPS (
    ART_ID        VARCHAR(36) NOT NULL,
    `NS`          VARCHAR(255) NOT NULL,
    `KEY`         VARCHAR(255) NOT NULL,
    `VALUE`       TEXT,
    
    PRIMARY KEY (ART_ID, `NS`, `KEY` ),
    FOREIGN KEY (ART_ID) REFERENCES ARTIFACTS(ID)
    ON DELETE CASCADE
);

CREATE TABLE PROV_ART_PROPS (
    ART_ID        VARCHAR(36) NOT NULL,
    `NS`          VARCHAR(255) NOT NULL,
    `KEY`         VARCHAR(255) NOT NULL,
    `VALUE`       TEXT,
    
    PRIMARY KEY ( ART_ID, `NS`, `KEY` ),
    FOREIGN KEY ( ART_ID ) REFERENCES ARTIFACTS(ID)
    ON DELETE CASCADE
);

CREATE TABLE CHANNEL_ASPECTS (
    CHANNEL_ID    VARCHAR(36) NOT NULL,
    ASPECT        VARCHAR(255) NOT NULL,
    
    PRIMARY KEY ( CHANNEL_ID, ASPECT ),
    FOREIGN KEY (CHANNEL_ID) REFERENCES CHANNELS(ID)
);<commit_msg>fix on delete cascade statements<commit_after>CREATE TABLE CHANNELS (
    ID            VARCHAR(36) NOT NULL,
    NAME          VARCHAR(255) UNIQUE,
    
    PRIMARY KEY (ID)
);

CREATE TABLE ARTIFACTS (
    ID            VARCHAR(36) NOT NULL,
    CHANNEL_ID    VARCHAR(36) NOT NULL,
    `TYPE`        VARCHAR(8) NOT NULL,
    
    PARENT        VARCHAR(36),
    
    NAME          VARCHAR(255) NOT NULL,
    
    DATA          LONGBLOB,
    SIZE          NUMERIC NOT NULL,
    
    CREATION_TS   DATETIME NOT NULL,
    
    PRIMARY KEY (ID),
    FOREIGN KEY (CHANNEL_ID) REFERENCES CHANNELS(ID) ON DELETE CASCADE,
    FOREIGN KEY (PARENT) REFERENCES ARTIFACTS(ID) ON DELETE CASCADE
);

CREATE TABLE VIRTUAL_ARTIFACTS (
    ID            VARCHAR(36) NOT NULL,
    NS            VARCHAR(255) NOT NULL,
    
    PRIMARY KEY (ID),
    
    FOREIGN KEY (ID) REFERENCES ARTIFACTS(ID) ON DELETE CASCADE
);

CREATE TABLE GENERATED_ARTIFACTS (
    ID            VARCHAR(36) NOT NULL,
    
    GENERATOR_ID    VARCHAR(255) NOT NULL,
    
    PRIMARY KEY (ID),
    
    FOREIGN KEY (ID) REFERENCES ARTIFACTS(ID) ON DELETE CASCADE
);

CREATE TABLE EXT_ART_PROPS (
    ART_ID        VARCHAR(36) NOT NULL,
    `NS`          VARCHAR(255) NOT NULL,
    `KEY`         VARCHAR(255) NOT NULL,
    `VALUE`       TEXT,
    
    PRIMARY KEY (ART_ID, `NS`, `KEY` ),
    
    FOREIGN KEY (ART_ID) REFERENCES ARTIFACTS(ID) ON DELETE CASCADE
);

CREATE TABLE PROV_ART_PROPS (
    ART_ID        VARCHAR(36) NOT NULL,
    `NS`          VARCHAR(255) NOT NULL,
    `KEY`         VARCHAR(255) NOT NULL,
    `VALUE`       TEXT,
    
    PRIMARY KEY ( ART_ID, `NS`, `KEY` ),
    
    FOREIGN KEY ( ART_ID ) REFERENCES ARTIFACTS(ID) ON DELETE CASCADE
);

CREATE TABLE CHANNEL_ASPECTS (
    CHANNEL_ID    VARCHAR(36) NOT NULL,
    ASPECT        VARCHAR(255) NOT NULL,
    
    PRIMARY KEY ( CHANNEL_ID, ASPECT ),
    
    FOREIGN KEY (CHANNEL_ID) REFERENCES CHANNELS(ID) ON DELETE CASCADE
);
{'fraction_non_alphanumeric': 0.0840466926070039, 'fraction_numerical': 0.023865110246433202, 'mean_word_length': 2.043409629044988, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6525070', 'n_tokens_mistral': 1535, 'n_tokens_neox': 1369, 'n_words': 378}