Skip to content

Commit

Permalink
chore: only make schema locally
Browse files Browse the repository at this point in the history
  • Loading branch information
robcxyz committed Oct 31, 2023
1 parent aca994f commit 106cd96
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion icon_stats/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from alembic import context

from icon_stats.db import ASYNC_CONNECTION_STRING
from icon_stats.config import config as icon_config

# Imports
from icon_stats.models.cmc_cryptocurrency_quotes_latest import \
Expand Down Expand Up @@ -42,7 +43,10 @@ def do_run_migrations(connection):
)

# Make sure the schema exists
connection.execute(text('CREATE SCHEMA IF NOT EXISTS stats'))
if icon_config.db.stats.server == 'localhost':
# In production environment we need escalated privileges to create a schema
# so we do it manually. Local it is assumed we have these privileges
connection.execute(text('CREATE SCHEMA IF NOT EXISTS stats'))

with context.begin_transaction():
context.run_migrations()
Expand Down

0 comments on commit 106cd96

Please sign in to comment.