hockey-blast-common-lib 0.1.16__tar.gz → 0.1.18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/PKG-INFO +1 -1
- hockey_blast_common_lib-0.1.18/hockey_blast_common_lib/restore_sample_db.sh +37 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib.egg-info/PKG-INFO +1 -1
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/setup.py +2 -1
- hockey_blast_common_lib-0.1.16/hockey_blast_common_lib/restore_sample_db.sh +0 -34
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/MANIFEST.in +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/README.md +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/__init__.py +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/aggregate_goalie_stats.py +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/aggregate_human_stats.py +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/aggregate_referee_stats.py +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/aggregate_skater_stats.py +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/db_connection.py +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/dump_sample_db.sh +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/hockey_blast_sample_backup.sql.gz +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/models.py +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/options.py +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/stats_models.py +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/utils.py +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/wsgi.py +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib.egg-info/SOURCES.txt +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib.egg-info/dependency_links.txt +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib.egg-info/requires.txt +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib.egg-info/top_level.txt +0 -0
- {hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/setup.cfg +0 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/bin/zsh
|
2
|
+
|
3
|
+
# Database credentials from environment variables
|
4
|
+
DB_USER=${DB_USER:-"frontend_user"}
|
5
|
+
DB_PASSWORD=${DB_PASSWORD:-"hockey-blast"}
|
6
|
+
DB_NAME=${DB_NAME:-"hockey_blast_sample"}
|
7
|
+
DB_HOST=${DB_HOST:-"localhost"}
|
8
|
+
DB_PORT=${DB_PORT:-"5432"}
|
9
|
+
COMPRESSED_DUMP_FILE="hockey_blast_sample_backup.sql.gz"
|
10
|
+
|
11
|
+
# Superuser credentials
|
12
|
+
SUPERUSER="your_superuser"
|
13
|
+
SUPERUSER_PASSWORD="your_superuser_password"
|
14
|
+
|
15
|
+
# Export PGPASSWORD to avoid password prompt
|
16
|
+
export PGPASSWORD=$SUPERUSER_PASSWORD
|
17
|
+
|
18
|
+
# Drop the existing database if it exists
|
19
|
+
psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT -d postgres --command="SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$DB_NAME' AND pid <> pg_backend_pid();"
|
20
|
+
psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT -d postgres --command="DROP DATABASE IF EXISTS $DB_NAME"
|
21
|
+
|
22
|
+
# Create a new database
|
23
|
+
psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT -d postgres --command="CREATE DATABASE $DB_NAME OWNER $SUPERUSER"
|
24
|
+
|
25
|
+
# Export PGPASSWORD for frontend_user user
|
26
|
+
export PGPASSWORD=$DB_PASSWORD
|
27
|
+
|
28
|
+
# Restore the database from the dump file with --no-owner option
|
29
|
+
gunzip -c $COMPRESSED_DUMP_FILE | pg_restore --username=$DB_USER --host=$DB_HOST --port=$DB_PORT --dbname=$DB_NAME --format=custom --no-owner
|
30
|
+
|
31
|
+
# Create the frontend_user if it does not exist
|
32
|
+
psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT --dbname=$DB_NAME --command="DO \$\$ BEGIN IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'frontend_user') THEN CREATE ROLE frontend_user LOGIN PASSWORD '$DB_PASSWORD'; END IF; END \$\$;"
|
33
|
+
|
34
|
+
# Grant necessary permissions to the user
|
35
|
+
psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT --dbname=$DB_NAME --command="GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO frontend_user"
|
36
|
+
|
37
|
+
echo "Database restore completed: $DB_NAME"
|
@@ -2,11 +2,12 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name='hockey-blast-common-lib', # The name of your package
|
5
|
-
version='0.1.
|
5
|
+
version='0.1.18',
|
6
6
|
description='Common library for shared functionality and DB models',
|
7
7
|
author='Pavel Kletskov',
|
8
8
|
author_email='kletskov@gmail.com',
|
9
9
|
packages=find_packages(), # Automatically find all packages
|
10
|
+
include_package_data=True, # Include non-Python files specified in MANIFEST.in
|
10
11
|
install_requires=[
|
11
12
|
"setuptools", # For package management
|
12
13
|
"Flask-SQLAlchemy", # For Flask database interactions
|
@@ -1,34 +0,0 @@
|
|
1
|
-
#!/bin/zsh
|
2
|
-
|
3
|
-
# Database credentials from environment variables
|
4
|
-
DB_USER=${DB_USER:-"frontend_user"}
|
5
|
-
DB_PASSWORD=${DB_PASSWORD:-"hockey-blast"}
|
6
|
-
DB_NAME=${DB_NAME:-"hockey_blast_sample"}
|
7
|
-
DB_HOST=${DB_HOST:-"localhost"}
|
8
|
-
DB_PORT=${DB_PORT:-"5432"}
|
9
|
-
COMPRESSED_DUMP_FILE="hockey_blast_sample_backup.sql.gz"
|
10
|
-
|
11
|
-
# Superuser credentials
|
12
|
-
SUPERUSER="your_superuser"
|
13
|
-
SUPERUSER_PASSWORD="your_superuser_password"
|
14
|
-
|
15
|
-
# Export PGPASSWORD to avoid password prompt
|
16
|
-
export PGPASSWORD=$SUPERUSER_PASSWORD
|
17
|
-
|
18
|
-
# Drop the existing database if it exists
|
19
|
-
psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT --command="SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$DB_NAME' AND pid <> pg_backend_pid();"
|
20
|
-
psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT --command="DROP DATABASE IF EXISTS $DB_NAME"
|
21
|
-
|
22
|
-
# Create a new database
|
23
|
-
psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT --command="CREATE DATABASE $DB_NAME OWNER $SUPERUSER"
|
24
|
-
|
25
|
-
# Export PGPASSWORD for read-only user
|
26
|
-
export PGPASSWORD=$DB_PASSWORD
|
27
|
-
|
28
|
-
# Restore the database from the dump file with --no-owner option
|
29
|
-
gunzip -c $COMPRESSED_DUMP_FILE | pg_restore --username=$DB_USER --host=$DB_HOST --port=$DB_PORT --dbname=$DB_NAME --format=custom --no-owner
|
30
|
-
|
31
|
-
# Grant necessary permissions to the read-only user
|
32
|
-
psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT --dbname=$DB_NAME --command="GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO frontend_user"
|
33
|
-
|
34
|
-
echo "Database restore completed: $DB_NAME"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/models.py
RENAMED
File without changes
|
{hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/options.py
RENAMED
File without changes
|
File without changes
|
{hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/utils.py
RENAMED
File without changes
|
{hockey_blast_common_lib-0.1.16 → hockey_blast_common_lib-0.1.18}/hockey_blast_common_lib/wsgi.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|