davedevelopment / phpmig

Simple migrations system for php
Other
569 stars 92 forks source link

Generate migration in local, apply them on a development server #107

Closed phaberest closed 8 years ago

phaberest commented 8 years ago

I'm trying to generate migration on my machine which is rsynced with a development server, but phpmig keeps yelling at me because it can't connect to mysql.

Is there a way to just create the migration files and then migrate them just like I'm used to with laravel?

davedevelopment commented 8 years ago

Maybe if you have an environment variable or something you could switch on?

// phpmig.php

if (getenv("IS_DEV")) {
    // use a dummy adapter so we don't need a db
    $container['phpmig.adapter'] = new Adapter\File\Flat(__DIR__ . DIRECTORY_SEPARATOR . 'migrations/.migrations.log');
} else {
    // normal adapter bootstrapping 
}
phaberest commented 8 years ago

Awesome, that did the trick.

Thank you Dave!