Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate init removed my not migration-related table #10

Open
mkedo opened this issue Oct 2, 2011 · 2 comments
Open

migrate init removed my not migration-related table #10

mkedo opened this issue Oct 2, 2011 · 2 comments

Comments

@mkedo
Copy link

mkedo commented Oct 2, 2011

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.


@dannykopping
Copy link

Same thing for me...

@Pawka
Copy link

Pawka commented Jun 26, 2012

Yes, same here. At 1st I was thinking there is some bug with this tool, but if you would look at build_controller.php, you would see, it drops database at 1st:

public function build($with_data = false)
{
    require_once(MPM_DB_PATH . 'schema.php');
    $obj = new MpmInitialSchema();
    $obj->destroy();
    ...
}

Maybe additional confirmation request from user would be the best here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants