Can I ignore it when the result of the generation is empty?

34 views
Skip to first unread message

jackad...@gmail.com

unread,
Jan 11, 2019, 4:33:34 AM1/11/19
to sqlalchemy-alembic
Can I ignore it when the result of the generation is empty?
I use it in docker, there is a startup command to upgrade the database version to the latest.
The database version is updated at startup and a record update version_num is generated.
Sorry for my bad English

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'c9bc72b06651'
down_revision = '713561aabb78'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###

Mike Bayer

unread,
Jan 11, 2019, 9:01:16 AM1/11/19
to sqlalchem...@googlegroups.com
one thing to note with "empty" migrations is that autogenerate does
not pick up things like changes of server default or datatypes unless
you set some flags to turn it on,
https://alembic.sqlalchemy.org/en/latest/api/runtime.html?highlight=compare_server_default#alembic.runtime.environment.EnvironmentContext.configure.params.compare_server_default
https://alembic.sqlalchemy.org/en/latest/api/runtime.html?#alembic.runtime.environment.EnvironmentContext.configure.params.compare_type

so keeping that in mind, if you want to skip generating empty
migrations, use the recipe at:
https://alembic.sqlalchemy.org/en/latest/cookbook.html#don-t-generate-empty-migrations-with-autogenerate
> --
> You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alem...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages