<commit_before>
// Remove unused or bad structure TYPE and TABLES
DROP TYPE caliopen.device_location;
DROP TABLE caliopen.public_key;
DROP TABLE caliopen.device_public_key;
DROP TABLE caliopen.device;

ALTER TYPE caliopen.message_attachment ADD temp_id uuid;

// Recreate never used tables to new design

CREATE TABLE caliopen.device (
    user_id uuid,
    device_id uuid,
    date_insert timestamp,
    date_revoked timestamp,
    ip_creation text,
    name text,
    pi frozen<pimodel>,
    privacy_features map<text, text>,
    status text,
    type text,
    user_agent text,
    PRIMARY KEY (user_id, device_id)
) WITH CLUSTERING ORDER BY (device_id ASC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'ALL'}
    AND comment = ''
    AND compaction = {'class': 'SizeTieredCompactionStrategy'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99.0PERCENTILE';

CREATE TABLE caliopen.public_key (
    user_id uuid,
    resource_id uuid,
    key_id uuid,
    alg text,
    crv text,
    date_insert timestamp,
    date_update timestamp,
    expire_date timestamp,
    fingerprint text,
    key text,
    kty text,
    label text,
    resource_type text,
    'use' text,
    x varint,
    y varint,
    PRIMARY KEY (user_id, resource_id, key_id)
) WITH CLUSTERING ORDER BY (resource_id ASC, key_id ASC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'ALL'}
    AND comment = ''
    AND compaction = {'class': 'SizeTieredCompactionStrategy'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99.0PERCENTILE';

CREATE TABLE caliopen.device_location (
    user_id uuid,<commit_msg>Sound a better syntax to be accepter by scylla and cassandra<commit_after>
// Remove unused or bad structure TYPE and TABLES
DROP TYPE caliopen.device_location;
DROP TABLE caliopen.public_key;
DROP TABLE caliopen.device_public_key;
DROP TABLE caliopen.device;

ALTER TYPE caliopen.message_attachment ADD temp_id uuid;

// Recreate never used tables to new design

CREATE TABLE caliopen.device (
    user_id uuid,
    device_id uuid,
    date_insert timestamp,
    date_revoked timestamp,
    ip_creation text,
    name text,
    pi frozen<pimodel>,
    privacy_features map<text, text>,
    status text,
    type text,
    user_agent text,
    PRIMARY KEY (user_id, device_id)
) WITH CLUSTERING ORDER BY (device_id ASC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'ALL'}
    AND comment = ''
    AND compaction = {'class': 'SizeTieredCompactionStrategy'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99.0PERCENTILE';

CREATE TABLE caliopen.public_key (
    user_id uuid,
    resource_id uuid,
    key_id uuid,
    alg text,
    crv text,
    date_insert timestamp,
    date_update timestamp,
    expire_date timestamp,
    fingerprint text,
    key text,
    kty text,
    label text,
    resource_type text,
    "use" text,
    x varint,
    y varint,
    PRIMARY KEY (user_id, resource_id, key_id)
) WITH CLUSTERING ORDER BY (resource_id ASC, key_id ASC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'ALL'}
    AND comment = ''
    AND compaction = {'class': 'SizeTieredCompactionStrategy'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99.0PERCENTILE';

CREATE TABLE caliopen.device_location (
    user_id uuid,
{'fraction_non_alphanumeric': 0.07645958861416996, 'fraction_numerical': 0.02327030957822564, 'mean_word_length': 3.5803996194100858, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7634993', 'n_tokens_mistral': 1751, 'n_tokens_neox': 1663, 'n_words': 439}