PHP code example of 0x6d617474 / wp-migrations
1. Go to this page and download the library: Download 0x6d617474/wp-migrations library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
0x6d617474 / wp-migrations example snippets
$migrator = new Migrator($root, $instance, $hook);
$migrator->setNamespace('Custom\\Namespace\\Migrations');
public function up()
{
$lock = '_migration_lock_Blah';
if (get_site_option($lock, false) === false) {
// Do the migration
update_site_option($lock, true)
}
}
public function down()
{
$lock = '_migration_lock_Blah';
if (get_site_option($lock, false) === true) {
// Do the rollback
update_site_option($lock, false)
}
}