Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dwreeves committed Nov 20, 2024
1 parent 9426f36 commit 013aa82
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
14 changes: 3 additions & 11 deletions alembic/versions/rev001.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"""

import os

import sqlalchemy as sa
from sqlalchemy import schema

Expand Down Expand Up @@ -52,7 +54,7 @@ def upgrade():
sa.PrimaryKeyConstraint("boathouse"),
)

with open(f"{QUERIES_DIR}/override_event_triggers_v1.sql", "r") as f:
with open(os.path.join(QUERIES_DIR, "override_event_triggers_v1.sql"), "r") as f:
sql = sa.text(f.read())
conn.execute(sql)

Expand All @@ -71,16 +73,6 @@ def upgrade():
sa.Column("reason", sa.TEXT(), nullable=True),
)

with open(f"{QUERIES_DIR}/define_reach.sql", "r") as f:
sql = sa.text(f.read())
conn.execute(sql)
with open(f"{QUERIES_DIR}/define_boathouse.sql", "r") as f:
sql = sa.text(f.read())
conn.execute(sql)
with open(f"{QUERIES_DIR}/define_default_options.sql", "r") as f:
sql = sa.text(f.read())
conn.execute(sql)


def downgrade():
op.drop_table("live_website_options")
Expand Down
13 changes: 12 additions & 1 deletion alembic/versions/rev002.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"""

import os

import sqlalchemy as sa
from sqlalchemy.engine.reflection import Inspector

Expand Down Expand Up @@ -77,7 +79,16 @@ def upgrade():
op.create_unique_constraint(None, "boathouses", ["name"])
op.create_foreign_key(None, "boathouses", "reach", ["reach_id"], ["id"])
op.rename_table("boathouses", "boathouse")
with open(QUERIES_DIR + "/override_event_triggers_v2.sql", "r") as f:
with open(os.path.join(QUERIES_DIR, "override_event_triggers_v2.sql"), "r") as f:
sql = sa.text(f.read())
conn.execute(sql)
with open(os.path.join(QUERIES_DIR, "define_reach.sql"), "r") as f:
sql = sa.text(f.read())
conn.execute(sql)
with open(os.path.join(QUERIES_DIR, "define_boathouse.sql"), "r") as f:
sql = sa.text(f.read())
conn.execute(sql)
with open(os.path.join(QUERIES_DIR, "define_default_options.sql"), "r") as f:
sql = sa.text(f.read())
conn.execute(sql)

Expand Down
4 changes: 0 additions & 4 deletions app/data/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ def init_db():

alembic.config.main(["upgrade", "head"])

execute_sql_from_file("define_reach.sql")
execute_sql_from_file("define_boathouse.sql")
execute_sql_from_file("define_default_options.sql")

# Now update the database
from app.data.processing.core import update_db

Expand Down

0 comments on commit 013aa82

Please sign in to comment.