Skip to content

Commit

Permalink
Merge pull request #639 from wri/make_alembic_happier
Browse files Browse the repository at this point in the history
Correct type of tags column, add metadata models to env.py
  • Loading branch information
dmannarino authored Feb 27, 2025
2 parents d1b326a + a14fc6f commit a09c347
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/models/orm/asset_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AssetMetadata(db.Model):
resolution = db.Column(db.Numeric)
min_zoom = db.Column(db.Integer)
max_zoom = db.Column(db.Integer)
tags = db.Column(db.String)
tags = db.Column(db.ARRAY(db.String))


class FieldMetadata(db.Model):
Expand Down
16 changes: 9 additions & 7 deletions app/models/orm/migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@
from app.application import db

# To include a model in migrations, add a line here.
from app.models.orm.api_keys import ApiKey # noqa: F401
from app.models.orm.asset_metadata import AssetMetadata # noqa: F401
from app.models.orm.assets import Asset # noqa: F401
from app.models.orm.dataset_metadata import DatasetMetadata # noqa: F401
from app.models.orm.datasets import Dataset # noqa: F401
from app.models.orm.geostore import Geostore # noqa: F401
from app.models.orm.tasks import Task # noqa: F401
from app.models.orm.user_areas import UserArea # noqa: F401
from app.models.orm.version_metadata import VersionMetadata # noqa: F401
from app.models.orm.versions import Version # noqa: F401
from app.models.orm.api_keys import ApiKey # noqa: F401

###############################################################################

Expand Down Expand Up @@ -58,13 +61,12 @@ def include_object(obj, name, type_, reflected, compare_to):
def run_migrations_offline():
"""Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
This configures the context with just a URL and not an Engine,
though an Engine is acceptable here as well. By skipping the Engine
creation we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script output.
Calls to context.execute() here emit the given string to the script
output.
"""
context.configure(
url=ALEMBIC_CONFIG.url.__to_string__(hide_password=False),
Expand Down
2 changes: 1 addition & 1 deletion app/models/pydantic/asset_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


class AssetBase(StrictBaseModel):
tags: Optional[str]
tags: Optional[List[str]]


class FieldMetadata(StrictBaseModel):
Expand Down

0 comments on commit a09c347

Please sign in to comment.