Difference between migrate = False or migrate_enabled = False

62 views
Skip to first unread message

Alfonso Serra

unread,
Oct 15, 2016, 9:59:52 AM10/15/16
to web2py-users
Yes what's the difference between migrate = False and migrate_enabled = False on a DAL declaration?

Since all my mysql tables are defined and they need some extra UNIQUE indexes (that are removed automatically if migrate = True). What would be the way to disable migrations in general and only enable it for future tables that i may define?

Thank you very much.



黄祥

unread,
Oct 15, 2016, 10:19:13 AM10/15/16
to web2py-users
taken from the book :

migrate = True sets default migrate behavior for all tables

fake_migrate = False sets default fake_migrate behavior for all tables

migrate_enabled = True If set to False disables ALL migrations

fake_migrate_all = False If set to True fake migrates ALL tables

ref:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer

best regards,
stifan

Alfonso Serra

unread,
Oct 15, 2016, 12:07:34 PM10/15/16
to web...@googlegroups.com
Yes Stifan, but isnt the same thing?

migrate = False disables migration for all tables
migrate_enabled = False disables all migrations?

Are there migrations not meant for tables? Thats the question.
If they are the same thing why the need of 2 parameters?
Is it one of them a deprecated feature?

If i set migrate = False on a DAL declaration and migrate = True on a table will it migrate?

Thanks

Anthony

unread,
Oct 15, 2016, 4:13:36 PM10/15/16
to web2py-users
On Saturday, October 15, 2016 at 12:07:34 PM UTC-4, Alfonso Serra wrote:
Yes Stifan, but isnt the same thing?

migrate = False disables migration for all tables

No, it sets the default migration behavior for all tables -- you can override the default for any given table by setting its own "migrate" argument.

If you want to disable migrations for most tables but not all, then do:

db = DAL(..., migrate=False)

Then, in tables where you want migrations:

db.define_table('mytable', ..., migrate=True)

Anthony
Reply all
Reply to author
Forward
0 new messages