-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alembic does not carry the uuid format parameter #59
Comments
Actually it should be just
I changed the column repr method to return char. It should not use ormar at all but unfortunately by default alembic uses full module name for autoganeration. To change it you have to pass """
***Beginning of the sample revision file***
Revision ID: XXX
Revises:
Create Date: XXXX-XX-XX
"""
from alembic import op
# alembic by default imports sqlalchemy as sa
# this has to match the set prefix ('sa.' in example above)
import sqlalchemy as sa
So it should look like this: (<===trimmed for clarity===>)
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.
Calls to context.execute() here emit the given string to the
script output.
"""
context.configure(
url=URL,
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
# if you use UUID field set also this param
# the prefix has to match sqlalchemy import name in alembic
# that can be set by sqlalchemy_module_prefix option (default 'sa.')
user_module_prefix='sa.'
)
with context.begin_transaction():
context.run_migrations()
def run_migrations_online():
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
"""
connectable = create_engine(URL)
with connectable.connect() as connection:
context.configure(
connection=connection,
target_metadata=target_metadata,
# if you use UUID field set also this param
# the prefix has to match sqlalchemy import name in alembic
# that can be set by sqlalchemy_module_prefix option (default 'sa.')
user_module_prefix='sa.'
)
with context.begin_transaction():
context.run_migrations()
(<===trimmed for clarity===>) Please update to 0.5.5 for this feature - also included this in the alembic docs. |
I see the problem now, thanks for the quick fix and instructions! |
Thanks for previous fixes for 57, After that I found out that alembic does not carry the uuid format parameter when creating the migration file for uuid.
generate:
should be:
The text was updated successfully, but these errors were encountered: