davesloan / mysql-php-migrations Goto Github PK
View Code? Open in Web Editor NEWCommand line utility for managing MySQL database migrations.
License: BSD 3-Clause "New" or "Revised" License
Command line utility for managing MySQL database migrations.
License: BSD 3-Clause "New" or "Revised" License
When issuing php migrate.php build, the program attempts to drop all tables, but omits dropping views. Please add that views are dropped, too.
When calling a migrate.php from an external script, one cannot check for %ERRORLEVEL% in windows. %ERRORLEVEL% is set when exit() is called.
0 should be that everything was okay
any other integer would mean that there was a problem with migrating or building.
If I set the initialMigrationTimestamp in schema.php __construct(), and the build() method inserts a database dump with all tables, then "migrate.php build" will not go to the latest version. Only if I run "migrate.php latest" afterwards, the database will have the newest updates.
to make sure that the migrations themselves are correctly and reversibly altering the db...
Hi
It would be great to be able to specify the db_config file in the command line so that the same install can be used for multiple projects.
I don't think this is done already but I think it would be a good feature.
Thanks for your work.
I ran php -f migrate.php init, answered some questions and at the last step ("Perform build of database...") I choosed Y.
I had no idea it would remove my table, thought it would only build the schema file and run migrations (since there is no migrations on the step, nothing would happen)
So maybe it's just me, but i think the script should mention that it's going to delete all tables.
P.S No valuable data were lost.
Log:
C:\Users\Kedo\gittest\mysql-php-migrations>php -f migrate.php init
MYSQL-PHP-MIGRATIONS
******************************************************************** v2.1.4 ***
Defaults are in brackets ([]). To accept the default, simply press ENTER.
Enter a name to use for the table that will hold your migration data [mpm_migrat
ions]:
Which method would you like to use to connect to
the database? 1=PDO or 2=MySQLi: 1
Enter your MySQL database hostname or IP address [localhost]:
Enter your MySQL database port [3306]:
Enter your MySQL database username: root
Enter your MySQL database password (enter - for no password) []:
Enter your MySQL database name: tests
Enter the directory where you'd like to store your
migration files [C:\Users\Kedo\gittest\mysql-php-migrations/db/]:
Perform build of database after initialization (builds schema
and runs all existing migrations) [y/N]: y
Configuration saved... looking for existing migrations table... not found.
Creating migrations table... done.
PHP Warning: Missing argument 1 for MpmBuildController::build(), called in C:\U
sers\Kedo\gittest\mysql-php-migrations\lib\controllers\init_controller.php on li
ne 351 and defined in C:\Users\Kedo\gittest\mysql-php-migrations\lib\controllers
\build_controller.php on line 154
Warning: Missing argument 1 for MpmBuildController::build(), called in C:\Users
Kedo\gittest\mysql-php-migrations\lib\controllers\init_controller.php on line 35
1 and defined in C:\Users\Kedo\gittest\mysql-php-migrations\lib\controllers\buil
d_controller.php on line 154
Looking for existing tables... found 1. Disabling foreign key restrictions... d
one.
Removing:
friends
Re-enabling foreign key restrictions... done.
Clearing out existing migration data... done.
Rebuilding migration data... done.
Building initial database schema... done.
Applying migrations... no migrations exist.PHP Notice: Undefined variable: with
_data in C:\Users\Kedo\gittest\mysql-php-migrations\lib\controllers\build_contro
ller.php on line 184
Notice: Undefined variable: with_data in C:\Users\Kedo\gittest\mysql-php-migrati
ons\lib\controllers\build_controller.php on line 184
Database build complete.
Initalization complete! Type 'php migrate.php help' for a list of commands.
When calling
migrate.php build with_data --force
the --force parameter is ignored.
You might want to update the link on your old Google Code site - http://code.google.com/p/mysql-php-migrations/ . Seems your github profile name has changed.
Currently there's no .gitignore file to ignore the generated config file, so git status
always shows config/db_config.php as an untracked file.
This is particularly annoying because I'm using git submodules to include this repository inside mine, and this makes the parent repo status always say "modified: mysql-php-migrations (untracked content)".
Thanks!
Hi, how to use this utility on Windows 7?
Hi,
i discovered a small quirk. build with_data doesn't execute test_data.php as it should when there aren't any existing migrations.
It seems like the exit command on line 54 in latest_controller.php is the problem.
Perhaps an initial migration should be created to prevent this behavior?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.