<commit_before>-- Copyright (C) 2007, 2008, 2009 The Collaborative Software Foundation
--
-- This file is part of TriSano.
--
-- TriSano is free software: you can redistribute it and/or modify it under the
-- terms of the GNU Affero General Public License as published by the
-- Free Software Foundation, either version 3 of the License,
-- or (at your option) any later version.
--
-- TriSano is distributed in the hope that it will be useful, but
-- WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Affero General Public License for more details.
--
-- You should have received a copy of the GNU Affero General Public License
-- along with TriSano. If not, see http://www.gnu.org/licenses/agpl-3.0.txt.


-- This script creates new denormalized tables from a freshly dumped OLTP
-- database, using a schema called "staging".

BEGIN;
    DROP SCHEMA IF EXISTS staging CASCADE;
    ALTER SCHEMA public RENAME TO staging;
    CREATE SCHEMA public;
COMMIT;

BEGIN;

SET search_path = staging, public;

CREATE TABLE dw_date_dimension (
    fulldate        DATE PRIMARY KEY,<commit_msg>Remove fuzzy search indexes from people table, as they're unneeded in the warehouse and cause querying problems.<commit_after>-- Copyright (C) 2007, 2008, 2009 The Collaborative Software Foundation
--
-- This file is part of TriSano.
--
-- TriSano is free software: you can redistribute it and/or modify it under the
-- terms of the GNU Affero General Public License as published by the
-- Free Software Foundation, either version 3 of the License,
-- or (at your option) any later version.
--
-- TriSano is distributed in the hope that it will be useful, but
-- WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Affero General Public License for more details.
--
-- You should have received a copy of the GNU Affero General Public License
-- along with TriSano. If not, see http://www.gnu.org/licenses/agpl-3.0.txt.


-- This script creates new denormalized tables from a freshly dumped OLTP
-- database, using a schema called "staging".

BEGIN;
    DROP SCHEMA IF EXISTS staging CASCADE;
    ALTER SCHEMA public RENAME TO staging;
    CREATE SCHEMA public;
COMMIT;

BEGIN;
-- The people table doesn't need its infrastructure for fuzzy name search
-- anymore, and it sometimes causes bugs, so remove it

SET search_path = staging, public;

DROP INDEX first_name_trgm_ix;
DROP INDEX full_name_fts_ix;
DROP INDEX full_name_trgm_ix;
DROP INDEX last_name_trgm_ix;
    
COMMIT;

BEGIN;

SET search_path = staging, public;

CREATE TABLE dw_date_dimension (
    fulldate        DATE PRIMARY KEY,
{'fraction_non_alphanumeric': 0.06771595900439238, 'fraction_numerical': 0.010980966325036604, 'mean_word_length': 3.6087689713322093, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '472705', 'n_tokens_mistral': 823, 'n_tokens_neox': 746, 'n_words': 375}