Hey guys, I'm trying to do CI (continuous integration) on web2py 
application.

I really need automatic database migration and web2py is really good with 
it, but using MySQL I notice that we have some caveats 
<http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#MySQL>
:

I can live without more than one alter table on migrations, but I can't 
without this other caveat that is not specified by web2py but is on mysql 
manual 
<http://dev.mysql.com/doc/refman/5.6/en/create-table-foreign-keys.html>:

Setting foreign_key_checks to 0 can also be useful for ignoring foreign key 
> constraints during LOAD DATA and ALTER TABLE operations. *However, even 
> if foreign_key_checks = 0, MySQL does not permit the creation of a foreign 
> key constraint where a column references a nonmatching column type*. 
> Also, if a table has foreign key constraints, ALTER TABLE cannot be used to 
> alter the table to use another storage engine. To change the storage 
> engine, you must drop any foreign key constraints first.
>

So, I can't drop a table without dropping it's foreign key constraints 
first, and I always get error 150 if I try.

Now I'm migrating my database to Postgres, because web2py REALLY support 
migrations on it. Just look this citation inside postgres manual 
<http://www.postgresql.org/docs/9.1/static/sql-altertable.html>:

*This form drops a column from a table. Indexes and table constraints 
> involving the column will be automatically dropped as well.* You will 
> need to say CASCADE if anything outside the table depends on the column, 
> for example, foreign key references or views. If IF EXISTS is specified and 
> the column does not exist, no error is thrown. In this case a notice is 
> issued instead.
>

What should we do to solve this issue with MySQL?  A Stackoverflow question 
<http://stackoverflow.com/questions/338978/mysql-innodb-need-to-delete-column-and-accompanying-foreign-key-constraint-a>
 said 
that we should create a table replica, apply migrations on it and than 
migrate data.

I don't know any other migrations solutions that do it on python. I think 
South have same problem because new Django 1.7 migration feature South-like 
have a lot of caveats: 
https://docs.djangoproject.com/en/dev/topics/migrations/

What do you think about make migrations as stackoverflow question suggest? (
http://stackoverflow.com/questions/338978/mysql-innodb-need-to-delete-column-and-accompanying-foreign-key-constraint-a
)

Is there another way to do that with MySQL?
 

>  Regards

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to