<commit_before>BEGIN;

CREATE TABLE account (
    id serial NOT NULL,
    name varchar NOT NULL,
    apikey varchar NOT NULL,
    mbuser varchar,
    anonymous boolean DEFAULT false,
    created timestamp with time zone DEFAULT current_timestamp,
    lastlogin timestamp with time zone,
    submission_count int NOT NULL DEFAULT 0
);

CREATE TABLE account_stats_control (
    id serial NOT NULL,
    last_updated timestamp with time zone NOT NULL
);

CREATE TABLE account_openid (
    openid varchar NOT NULL,
    account_id int NOT NULL
);

CREATE TABLE application (
    id serial NOT NULL,
    name varchar NOT NULL,
    version varchar NOT NULL,
    apikey varchar NOT NULL,
    created timestamp with time zone DEFAULT current_timestamp,
    active boolean DEFAULT true,
    account_id int NOT NULL
);

CREATE TABLE format (
    id serial NOT NULL,
    name varchar NOT NULL
);

CREATE TABLE source (
    id serial NOT NULL,
    application_id int NOT NULL,
    account_id int NOT NULL
);

CREATE TABLE fingerprint (
    id serial NOT NULL,
    fingerprint int[] NOT NULL,
    length smallint NOT NULL CHECK (length > 0),
    bitrate smallint CHECK (bitrate > 0),
    format_id int,
    created timestamp with time zone NOT NULL DEFAULT current_timestamp,
	source_id int NOT NULL,
    track_id int NOT NULL,
    meta_id int,
	submission_id int,
	hash_full bytea,
	hash_query bytea
);

CREATE TABLE track (
    id serial NOT NULL,
    created timestamp with time zone DEFAULT current_timestamp
);

CREATE TABLE track_mbid (
    track_id int NOT NULL,
    mbid uuid NOT NULL,
    created timestamp with time zone DEFAULT current_timestamp,
	submission_id int
);

CREATE TABLE submission (
    id serial NOT NULL,
    fingerprint int[] NOT NULL,
    length smallint NOT NULL CHECK (length > 0),
    bitrate smallint CHECK (bitrate > 0),
    format_id int,
    created timestamp with time zone NOT NULL DEFAULT current_timestamp,
    source_id int NOT NULL,
    mbid uuid,
    handled boolean DEFAULT false,
    puid uuid,
    meta_id int<commit_msg>New table for updating the index<commit_after>BEGIN;

CREATE TABLE account (
    id serial NOT NULL,
    name varchar NOT NULL,
    apikey varchar NOT NULL,
    mbuser varchar,
    anonymous boolean DEFAULT false,
    created timestamp with time zone DEFAULT current_timestamp,
    lastlogin timestamp with time zone,
    submission_count int NOT NULL DEFAULT 0
);

CREATE TABLE account_stats_control (
    id serial NOT NULL,
    last_updated timestamp with time zone NOT NULL
);

CREATE TABLE account_openid (
    openid varchar NOT NULL,
    account_id int NOT NULL
);

CREATE TABLE application (
    id serial NOT NULL,
    name varchar NOT NULL,
    version varchar NOT NULL,
    apikey varchar NOT NULL,
    created timestamp with time zone DEFAULT current_timestamp,
    active boolean DEFAULT true,
    account_id int NOT NULL
);

CREATE TABLE format (
    id serial NOT NULL,
    name varchar NOT NULL
);

CREATE TABLE source (
    id serial NOT NULL,
    application_id int NOT NULL,
    account_id int NOT NULL
);

CREATE TABLE fingerprint (
    id serial NOT NULL,
    fingerprint int[] NOT NULL,
    length smallint NOT NULL CHECK (length > 0),
    bitrate smallint CHECK (bitrate > 0),
    format_id int,
    created timestamp with time zone NOT NULL DEFAULT current_timestamp,
	source_id int NOT NULL,
    track_id int NOT NULL,
    meta_id int,
	submission_id int,
	hash_full bytea,
	hash_query bytea
);

CREATE TABLE fingerprint_index_queue (
    fingerprint_id int NOT NULL
);

CREATE TABLE track (
    id serial NOT NULL,
    created timestamp with time zone DEFAULT current_timestamp
);

CREATE TABLE track_mbid (
    track_id int NOT NULL,
    mbid uuid NOT NULL,
    created timestamp with time zone DEFAULT current_timestamp,
	submission_id int
);

CREATE TABLE submission (
    id serial NOT NULL,
    fingerprint int[] NOT NULL,
    length smallint NOT NULL CHECK (length > 0),
    bitrate smallint CHECK (bitrate > 0),
    format_id int,
    created timestamp with time zone NOT NULL DEFAULT current_timestamp,
    source_id int NOT NULL,
    mbid uuid,
    handled boolean DEFAULT false,
    puid uuid,
    meta_id int
{'fraction_non_alphanumeric': 0.04408960915157293, 'fraction_numerical': 0.0023832221163012394, 'mean_word_length': 3.2308467741935485, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2317579', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1144, 'n_words': 525}