<commit_before>/*

    Copyright (c) 2010-2011, GEM Foundation.

    OpenQuake database is made available under the Open Database License:
    http://opendatacommons.org/licenses/odbl/1.0/. Any rights in individual
    contents of the database are licensed under the Database Contents License:
    http://opendatacommons.org/licenses/dbcl/1.0/

*/

-- renaming the table itself
ALTER TABLE riski.vulnerability_data
    RENAME TO vulnerability_function;


-- the primary key sequence
ALTER SEQUENCE riski.vulnerability_data_id_seq
    RENAME TO vulnerability_function_id_seq;


-- indexes
ALTER INDEX riski.vulnerability_data_pkey
    RENAME TO vulnerability_function_pkey;

ALTER INDEX riski.vulnerability_data_vulnerability_model_id_vf_ref_key
    RENAME TO  vulnerability_function_vulnerability_model_id_vf_ref_ke;


-- constraint (postgres doesn't support renaming constraints)
ALTER TABLE riski.vulnerability_function
    DROP CONSTRAINT riski_vulnerability_data_vulnerability_model_fk;

ALTER TABLE riski.vulnerability_function
    ADD CONSTRAINT riski_vulnerability_function_vulnerability_model_fk
        FOREIGN KEY (vulnerability_model_id)
        REFERENCES riski.vulnerability_model(id)
        ON DELETE CASCADE;

-- trigger
ALTER TRIGGER riski_vulnerability_data_refresh_last_update_trig
    ON riski.vulnerability_function
    RENAME TO riski_vulnerability_function_refresh_last_update_trig;
<commit_msg>removed unneeded index rename<commit_after>/*

    Copyright (c) 2010-2011, GEM Foundation.

    OpenQuake database is made available under the Open Database License:
    http://opendatacommons.org/licenses/odbl/1.0/. Any rights in individual
    contents of the database are licensed under the Database Contents License:
    http://opendatacommons.org/licenses/dbcl/1.0/

*/

-- renaming the table itself
ALTER TABLE riski.vulnerability_data
    RENAME TO vulnerability_function;


-- the primary key sequence
ALTER SEQUENCE riski.vulnerability_data_id_seq
    RENAME TO vulnerability_function_id_seq;


-- index
ALTER INDEX riski.vulnerability_data_pkey
    RENAME TO vulnerability_function_pkey;


-- constraint (postgres doesn't support renaming constraints)
ALTER TABLE riski.vulnerability_function
    DROP CONSTRAINT riski_vulnerability_data_vulnerability_model_fk;

ALTER TABLE riski.vulnerability_function
    ADD CONSTRAINT riski_vulnerability_function_vulnerability_model_fk
        FOREIGN KEY (vulnerability_model_id)
        REFERENCES riski.vulnerability_model(id)
        ON DELETE CASCADE;

-- trigger
ALTER TRIGGER riski_vulnerability_data_refresh_last_update_trig
    ON riski.vulnerability_function
    RENAME TO riski_vulnerability_function_refresh_last_update_trig;

{'fraction_non_alphanumeric': 0.04730229120473023, 'fraction_numerical': 0.008869179600886918, 'mean_word_length': 4.846652267818574, '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': '1378434', 'n_tokens_mistral': 923, 'n_tokens_neox': 869, 'n_words': 199}