<commit_before>-- 01-tables.sql
-- création du schema si il n'existe pas, et des tables
DO $$
BEGIN

    CASE WHEN (select count(*) = 0 from pg_namespace where nspname = 'jormungandr')
    THEN
        CREATE SCHEMA jormungandr;
    ELSE
        RAISE NOTICE 'schema "jormungandr" already exists, skipping';
    END CASE;

END$$;


CREATE TABLE IF NOT EXISTS public.database_version (
    version INTEGER NOT NULL
);


CREATE TABLE IF NOT EXISTS jormungandr.user(
    id SERIAL PRIMARY KEY,
    login text UNIQUE,
    email text UNIQUE
);

CREATE TABLE IF NOT EXISTS jormungandr.key(
    id SERIAL PRIMARY KEY,
    user_id int NOT NULL REFERENCES jormungandr.user,
    token text NOT NULL,
    valid_until date
);

CREATE TABLE IF NOT EXISTS jormungandr.instance(
    id SERIAL PRIMARY KEY,
    key text UNIQUE NOT NULL,
    name text,
    is_free bool default false
);<commit_msg>Tyr: correction d'une erreur sur la table instance: il n'y a pas de champs key<commit_after>-- 01-tables.sql
-- création du schema si il n'existe pas, et des tables
DO $$
BEGIN

    CASE WHEN (select count(*) = 0 from pg_namespace where nspname = 'jormungandr')
    THEN
        CREATE SCHEMA jormungandr;
    ELSE
        RAISE NOTICE 'schema "jormungandr" already exists, skipping';
    END CASE;

END$$;


CREATE TABLE IF NOT EXISTS public.database_version (
    version INTEGER NOT NULL
);


CREATE TABLE IF NOT EXISTS jormungandr.user(
    id SERIAL PRIMARY KEY,
    login text UNIQUE,
    email text UNIQUE
);

CREATE TABLE IF NOT EXISTS jormungandr.key(
    id SERIAL PRIMARY KEY,
    user_id int NOT NULL REFERENCES jormungandr.user,
    token text NOT NULL,
    valid_until date
);

CREATE TABLE IF NOT EXISTS jormungandr.instance(
    id SERIAL PRIMARY KEY,
    name text UNIQUE NOT NULL,
    is_free bool default false
);
{'fraction_non_alphanumeric': 0.06563706563706563, 'fraction_numerical': 0.003309431880860452, 'mean_word_length': 3.132118451025057, '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': '5698458', 'n_tokens_mistral': 637, 'n_tokens_neox': 593, 'n_words': 228}