<commit_before>#!/usr/bin/env bash

set -e

CLI_ERR_MSG="Postgres CLI tools not available (psql). Using Postgres.app, look
at http://postgresapp.com/documentation/cli-tools.html. Aborting."
hash psql 2>/dev/null || { echo >&2 $CLI_ERR_MSG ; exit 1; }

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

cd $DIR


# Provision

SUPER_USER_PASSWORD=<PASSWORD> NEW_USER_PASSWORD=<PASSWORD> /data-scripts/create-db.sh localhost postgres rsrdb rsruserdb

RSR_PASSWORD=<PASSWORD> /data-scripts/restore-from-dump.sh localhost rsrdb rsruserdb $(pwd)/pg.dump.gz

PGPASSWORD=<PASSWORD> psql -d rsrdb -f $DIR/helpers/init.sql

echo ""<commit_msg>[#3337] Local/CI DB user requires CREATEDB perms<commit_after>#!/usr/bin/env bash

set -e

CLI_ERR_MSG="Postgres CLI tools not available (psql). Using Postgres.app, look
at http://postgresapp.com/documentation/cli-tools.html. Aborting."
hash psql 2>/dev/null || { echo >&2 $CLI_ERR_MSG ; exit 1; }

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

cd $DIR


# Provision

SUPER_USER_PASSWORD=<PASSWORD> NEW_USER_PASSWORD=<PASSWORD> /data-scripts/create-db.sh localhost postgres rsrdb rsruserdb

RSR_PASSWORD=<PASSWORD> /data-scripts/restore-from-dump.sh localhost rsrdb rsruserdb $(pwd)/pg.dump.gz

PGPASSWORD=<PASSWORD> psql -c "ALTER USER rsruserdb CREATEDB;"
PGPASSWORD=<PASSWORD> psql -d rsrdb -f $DIR/helpers/init.sql

echo ""
{'fraction_non_alphanumeric': 0.15021770682148042, 'fraction_numerical': 0.008708272859216255, 'mean_word_length': 4.995652173913044, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 16, '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': '5065642', 'n_tokens_mistral': 562, 'n_tokens_neox': 530, 'n_words': 117}