Thursday, February 14, 2013

Cakephp 2.x - Changing the name of a table within the schema

Is there a way to change the name of a table (tables) within the database schema?

reference: (http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html)

I was unable to find out how to do this via googling, or searching the api/book.

Basically this is what I'm trying to do:

1. I have a table named say 'cars'. I want to change the table name to 'vehicles'.
2. I would like to be able to do this within the built in schema.
3. I don't want to drop the old table and create a new one.

The only way have come up with to do this would be to do something in the before() function.
and do something like this: http://dev.mysql.com/doc/refman/5.0/en/rename-table.html

I haven't tested this idea as I don't want to actually change anything.
Is this the only way?
Will cakephp recognize the change instead of resorting to looking at it's own cache?


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: