CREATE TABLE public.user_scores
(
    id                                            uuid                                  not null default gen_random_uuid(),
    added_at                                      timestamptz DEFAULT CURRENT_TIMESTAMP NULL,
    beatmap_id                                    int4                                  NULL,
    beatmap_hash                                  varchar(32)                           NULL,
    game_mode                                     int4                                  NULL,
    game_version                                  int4                                  NULL,
    player_name                                   varchar(256)                          NULL,
    replay_hash                                   varchar(32)                           NULL,
    count_300                                     int2                                  NULL,
    count_100                                     int2                                  NULL,
    count_50                                      int2                                  NULL,
    count_geki                                    int2                                  NULL,
    count_katu                                    int2                                  NULL,
    count_miss                                    int2                                  NULL,
    total_score                                   int4                                  NULL,
    max_combo                                     int2                                  NULL,
    perfect                                       bool                                  NULL,
    mods                                          int4                                  NULL,
    life_bar_graph                                text                                  NULL,
    timestamp                                     int8                                  NULL,
    replay_length                                 int4                                  NULL,
    replay_data                                   text                                  NULL,
    online_score_id                               int8                                  NULL,
    additional_mod_info                           float8                                NULL,

    ur                                            float8                                NULL,
    frametime                                     float8                                NULL,
    edge_hits                                     int4                                  NULL,
    snaps                                         int4                                  NULL,
    adjusted_ur                                   float8                                NULL,
    mean_error                                    float8                                NULL,
    error_variance                                float8                                NULL,
    error_standard_deviation                      float8                                NULL,
    minimum_error                                 float8                                NULL,
    maximum_error                                 float8                                NULL,
    error_range                                   float8                                NULL,
    error_coefficient_of_variation                float8                                NULL,
    error_kurtosis                                float8                                NULL,
    error_skewness                                float8                                NULL,
    keypresses_times                              float8[]                              NULL,
    keypresses_median                             float8                                NULL,
    keypresses_standard_deviation                 float8                                NULL,
    sliderend_release_times                       float8[]                              NULL,
    sliderend_release_median                      float8                                NULL,
    sliderend_release_standard_deviation          float8                                NULL,
    keypresses_median_adjusted                    float8                                NULL,
    keypresses_standard_deviation_adjusted        float8                                NULL,
    sliderend_release_median_adjusted             float8                                NULL,
    sliderend_release_standard_deviation_adjusted float8                                NULL,
    judgements                                    bytea                                 NULL,

    CONSTRAINT life_bar_graph_check CHECK (OCTET_LENGTH(life_bar_graph) <= 524288),
    CONSTRAINT replay_data_check CHECK (OCTET_LENGTH(replay_data) <= 524288)
);