PHP code example of vados / phalcon-migration-runner
1. Go to this page and download the library: Download vados/phalcon-migration-runner 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/ */
vados / phalcon-migration-runner example snippets
public function up(): bool
{
$this->getDbConnection()->createTable('foo', null, [
'columns' => [
new \Phalcon\Db\Column('bar', [
'type' => \Phalcon\Db\Column::TYPE_INTEGER
])
]
]);
return true;
}
use Phalcon\Db\Column;
use Vados\MigrationRunner\migration\Migration;
class m1522260172_new_migration extends Migration
{
public function up(): bool
{
$this->getDbConnection()->createTable('foo', null, [
'columns' => [
new Column('bar', [
'type' => Column::TYPE_INTEGER
])
]
]);
return true;
}
public function down(): bool
{
$this->getDbConnection()->dropTable('foo');
return true;
}
}
bash
$ ./migration_runner up
m1522260172_new_migration.php
Apply the above migrations? (yes|no) [yes]: yes
Migration m1522260172_new_migration.php: true
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.