CakePHP / CakePHP 2.4 Application

I am currently developing CakePHP 2.4 and am trying to manage changes to database table schemas using Schema Manager. I figured out how to generate a schema and restore it, but is there a way to back up the entire database schema with it? Looks like it should be a way to solve this ... Any thoughts?

+5
source share
3 answers

Of course, use the schema dump command from the Cake Console.

It will write the whole schema to a .sql file and save it in App/Config/Schema .

Usage example:

Console/cake schema dump --write filename.sql

(change 'filename.sql' to what the dump file should call.)

This can also be found in the cake docs: http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html

+9
source

Actually, there is a better way to handle this using CakeDC Migrations Plugin, it gives you a “Rails” migration type that will help you take a snapshot of your circuit, this is an improvement on the cake schema dump method mentioned above, and is actually developed by the core CakePHP team.

CakeDC Migrations

+8
source

You can reset your schema using the cake schema command

First of all, you must set the path of the cake command.

  • On Windows, you must set the console path to / cake
  • Go to cmd
  • Write the command "Console / cake schema generate" from which you can generate the circuit
  • After that, if you want to dump the contents to the sql file So, you should use the following command: "Dump the console / cake schema --write filename.sql"

For more information, click on the link below http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html

+2
source

Source: https://habr.com/ru/post/1202264/


All Articles