Skip to content

Commit

Permalink
Merge pull request #1134 from moonstream-to/set-version-schema
Browse files Browse the repository at this point in the history
Set schema for version table
  • Loading branch information
kompotkot authored Oct 16, 2024
2 parents b27a9d4 + 34fc6c5 commit 5dad0a3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions moonstreamdb-v3/moonstreamdbv3/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
from moonstreamdbv3.models import (
MOONSTREAM_DB_V3_SCHEMA_NAME,
AmoyLabel,
ArbitrumNovaLabel,
ArbitrumOneLabel,
Expand Down Expand Up @@ -112,6 +113,7 @@ def run_migrations_offline() -> None:
literal_binds=True,
dialect_opts={"paramstyle": "named"},
version_table="alembic_version",
version_table_schema=MOONSTREAM_DB_V3_SCHEMA_NAME,
include_schemas=True,
include_symbol=include_symbol,
)
Expand All @@ -138,6 +140,7 @@ def run_migrations_online() -> None:
connection=connection,
target_metadata=target_metadata,
version_table="alembic_version",
version_table_schema=MOONSTREAM_DB_V3_SCHEMA_NAME,
include_schemas=True,
include_symbol=include_symbol,
)
Expand Down
5 changes: 5 additions & 0 deletions moonstreamdb-v3/moonstreamdbv3/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
}
"""

import os
import uuid

from sqlalchemy import (
Expand Down Expand Up @@ -56,6 +57,10 @@
3. https://stackoverflow.com/a/33532154/13659585
"""

MOONSTREAM_DB_V3_SCHEMA_NAME = os.environ.get(
"MOONSTREAM_DB_V3_SCHEMA_NAME", "blockchain"
)


class utcnow(expression.FunctionElement):
type = DateTime # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion moonstreamdb-v3/moonstreamdbv3/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.20
0.0.21

0 comments on commit 5dad0a3

Please sign in to comment.