An application for MySQL that can create database tables with the help of console in simple applications.
composer require migration/app
Create migrate.php file.
Paste the following codes into the migrate file.
#!usr/bin/php
<?php
use SimpleMigration\Application;
use SimpleMigration\Database\Connection;
require __DIR__ . '/vendor/autoload.php';
$database = require __DIR__ . '/Database/database.php';
$connection = new Connection($database);
$app = new Application($connection, $argv);
$app->run();
Edit the database.php file according to your mysql database.
<?php
return [
'connection' => 'mysql',
'host' => 'localhost',
'database' => 'migration_exam',
'user' => 'root',
'password' => 'root',
'port' => 3306,
];
Command | Description |
---|---|
php migrate |
Sends all migrations to the database. |
php migrate create <migration name> |
Create a migration file. |
php migrate down |
Deletes inserted databases |