GithubHelp home page GithubHelp logo

davesloan / mysql-php-migrations Goto Github PK

View Code? Open in Web Editor NEW
262.0 262.0 54.0 183 KB

Command line utility for managing MySQL database migrations.

License: BSD 3-Clause "New" or "Revised" License

PHP 100.00%

mysql-php-migrations's People

Contributors

d13r avatar denis-bykov avatar webbp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mysql-php-migrations's Issues

migrate.php does not set exit code

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.

setting initialMigrationTimestamp does not migrate to latest with build

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.

Feature: Specify config file

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.

migrate init removed my not migration-related table

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.


Missing .gitignore file

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!

Problem with build with_data

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.