<commit_before>-- Set default connected user to empty string
ALTER DATABASE :db SET user_vars.user_id TO '';

/*
 * Data for read-only tests
 * The data bellow is shared among several test cases,
 * So make sure no test changes this records.
 * For mutable data look for the next comment section by the end of this file.
 */

INSERT INTO public.project_states (state, state_order) VALUES
    ('deleted', 'archived'),
    ('rejected', 'created'),
    ('draft', 'created'),
    ('in_analysis', 'created'),
    ('approved', 'publishable'),
    ('online', 'published'),
    ('waiting_funds', 'published'),
    ('failed', 'finished'),
    ('successful', 'finished');

INSERT INTO public.flexible_project_states (state, state_order) VALUES
    ('deleted', 'archived'),
    ('rejected', 'created'),
    ('draft', 'created'),
    ('online', 'published'),
    ('waiting_funds', 'published'),
    ('successful', 'finished');


INSERT INTO public.states (id, name, acronym) VALUES
    (1, 'Rio de Janeiro', 'RJ');

INSERT INTO public.cities (id, name, state_id) VALUES
    (1, 'Rio de Janeiro (Capital)', 1);

INSERT INTO public.categories (id, name_pt) VALUES
    (1, 'Música');

INSERT INTO public.users (id, email, name) VALUES
    (1, '<EMAIL>', 'Realizador de vários projetos'),
    (2, '<EMAIL>', 'Apoiador');

INSERT INTO public.category_followers (category_id, user_id) VALUES
    (1, 1);

INSERT INTO public.projects (id, name, state, user_id, category_id, permalink, headline, uploaded_image, about_html) VALUES
    (1, 'Rascunho de projeto tudo ou nada', 'draft',  1, 1, 'teste_tudo_ou_nada','headline', 'https::/amazon/some_image.jpg', 'sobre o projeto tudo ou nada'),
    (2, 'Rascunho de projeto flexível',     'draft',  1, 1, 'teste_flexivel',    'headline', 'https::/amazon/some_image.jpg', 'sobre o projeto flex'),
    (3, 'Projeto tudo ou nada no ar',       'online', 1, 1, 'tudo_ou_nada',      'headline', 'https::/amazon/some_image.jpg', 'captando no meu projeto tudo ou nada'),
    (4, 'Projeto flexível no ar',           'draft', 1, 1, 'flexivel',          'headline', 'https::/amazon/some_image.jpg', 'captando no meu projeto flex');

INSERT INTO public.flexible_projects (id, project_id, state) VALUES
    (1, 2, 'draft'),
    (2, 4, 'online');

-- Refresh all materialized views
REFRESH MATERIALIZED VIEW "1".user_totals;
REFRESH MATERIALIZED VIEW "1".statistics;

/*
 * Create all data that will be modified bellow
 * Add a comment with the file name where it is used.
 * Ex.:
 * -- users.yml
 * INSERT INTO users ...
 */

-- contribution_details.yml
INSERT INTO contributions (id, project_id, user_id, value, payer_email) VALUES
    (1, 4, 1, 10, '<EMAIL>');

INSERT INTO payments (id, contribution_id, state, key, gateway, payment_method, value) VALUES
    (1, 1, 'paid', 'key 1', 'Payment Gateway', 'Credit Card', 10);

<commit_msg>add some balance_transactions to users<commit_after>-- Set default connected user to empty string
ALTER DATABASE :db SET user_vars.user_id TO '';

/*
 * Data for read-only tests
 * The data bellow is shared among several test cases,
 * So make sure no test changes this records.
 * For mutable data look for the next comment section by the end of this file.
 */

INSERT INTO public.project_states (state, state_order) VALUES
    ('deleted', 'archived'),
    ('rejected', 'created'),
    ('draft', 'created'),
    ('in_analysis', 'created'),
    ('approved', 'publishable'),
    ('online', 'published'),
    ('waiting_funds', 'published'),
    ('failed', 'finished'),
    ('successful', 'finished');

INSERT INTO public.flexible_project_states (state, state_order) VALUES
    ('deleted', 'archived'),
    ('rejected', 'created'),
    ('draft', 'created'),
    ('online', 'published'),
    ('waiting_funds', 'published'),
    ('successful', 'finished');


INSERT INTO public.states (id, name, acronym) VALUES
    (1, 'Rio de Janeiro', 'RJ');

INSERT INTO public.cities (id, name, state_id) VALUES
    (1, 'Rio de Janeiro (Capital)', 1);

INSERT INTO public.categories (id, name_pt) VALUES
    (1, 'Música');

INSERT INTO public.users (id, email, name) VALUES
    (1, '<EMAIL>', 'Realizador de vários projetos'),
    (2, '<EMAIL>', 'Apoiador');

INSERT INTO public.category_followers (category_id, user_id) VALUES
    (1, 1);

INSERT INTO public.projects (id, name, state, user_id, category_id, permalink, headline, uploaded_image, about_html) VALUES
    (1, 'Rascunho de projeto tudo ou nada', 'draft',  1, 1, 'teste_tudo_ou_nada','headline', 'https::/amazon/some_image.jpg', 'sobre o projeto tudo ou nada'),
    (2, 'Rascunho de projeto flexível',     'draft',  1, 1, 'teste_flexivel',    'headline', 'https::/amazon/some_image.jpg', 'sobre o projeto flex'),
    (3, 'Projeto tudo ou nada no ar',       'online', 1, 1, 'tudo_ou_nada',      'headline', 'https::/amazon/some_image.jpg', 'captando no meu projeto tudo ou nada'),
    (4, 'Projeto flexível no ar',           'draft', 1, 1, 'flexivel',          'headline', 'https::/amazon/some_image.jpg', 'captando no meu projeto flex'),
    (5, 'Projeto tudo ou nada bem sucedido','successful', 1, 1, 'tudo_ou_nada_successful',      'headline', 'https::/amazon/some_image.jpg', 'captando no meu projeto tudo ou nada bem sucedido');

INSERT INTO public.project_transitions (id, project_id, to_state, sort_key, most_recent, created_at, updated_at) VALUES
       (1, 3, 'online', 0, true, now(), now()),
       (2, 5, 'successful', 0, true, now(), now());

INSERT INTO public.flexible_projects (id, project_id, state) VALUES
    (1, 2, 'draft'),
    (2, 4, 'online');

INSERT INTO public.flexible_project_transitions (id, flexible_project_id, to_state, sort_key, most_recent, created_at, updated_at) VALUES
       (1, 2, 'online', 0, true, now(), now());

-- Refresh all materialized views
REFRESH MATERIALIZED VIEW "1".user_totals;
REFRESH MATERIALIZED VIEW "1".statistics;

/*
 * Create all data that will be modified bellow
 * Add a comment with the file name where it is used.
 * Ex.:
 * -- users.yml
 * INSERT INTO users ...
 */

-- contribution_details.yml
INSERT INTO contributions (id, project_id, user_id, value, payer_email) VALUES
    (1, 4, 1, 10, '<EMAIL>');

INSERT INTO payments (id, contribution_id, state, key, gateway, payment_method, value) VALUES
    (1, 1, 'paid', 'key 1', 'Payment Gateway', 'Credit Card', 10);

-- balances.yml
INSERT INTO balance_transactions (id, project_id, event_name, user_id, amount) VALUES
       (1, 5, 'successful_project_pledged', 1, 100),
       (2, 5, 'catarse_project_service_fee', 1, -13);
       
INSERT INTO balance_transactions (id, event_name, user_id, amount) VALUES
       (3, 'for_fun_credits', 2, 10);

{'fraction_non_alphanumeric': 0.15141955835962145, 'fraction_numerical': 0.014871563767462822, 'mean_word_length': 4.137345679012346, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4179982', 'n_tokens_mistral': 2364, 'n_tokens_neox': 2206, 'n_words': 732}