I am currently developing a CakePHP 2.4 app and trying to manage changes to my database table schemas with the schema manager. I figured out how to generate the schema and restore it, but is there a way to backup the entire database's schema with it? Seems like should be a method to solve this... Any thoughts?
-
3You might also want to take a look at Migrations Plugin. https://github.com/cakedc/migrations – Guillermo Mansilla Sep 10 '14 at 17:53
3 Answers
Of course, use the schema dump command from the Cake Console.
It will write the entire schema to a .sql
file and store it in App/Config/Schema
.
Example of usage:
Console/cake schema dump --write filename.sql
(change 'filename.sql' to whatever the dump file should be called.)
This can also be find in the cake docs: http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html

- 1,713
- 3
- 31
- 57
There is actually a better way to handle this using the CakeDC Migrations Plugin, this gives you Rails type "migrations" that will help you snapshot your schema, it is an improvement to the cake schema dump method specified above and is actually developed by the CakePHP core team.

- 893
- 7
- 14
You can dump your schema using cake schema command
First of all you have to set the cake command path
- In the windows system you have to set the path of the console/cake
- Go to the cmd
- Write the command "Console/cake schema generate" from this you can generate schema
- After that if you want to dump in to the sql file So, You have to use following command "Console/cake schema dump --write filename.sql"
For more information click on below link http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html

- 41
- 3