Addition of migrations
Migrations allow you to version control your database schema. You can create a migration file using the make:migration command.
Example:
php tiny make:migration create_products_tableExample Migration
Here's an example that creates a migration for a products table:
<?php
namespace app\migrations;
class CreateProductsTable
{
public function up()
{
$tableCmd = db()->createTable('products');
$tableCmd->id();
$tableCmd->string('title');
$tableCmd->string('image');
$tableCmd->timestamps();
$tableCmd->execute();
}
public function down()
{
db()->dropTable('products');
}
}Executing Migration
Finally, you can apply the migration using migrate command.
php tiny migrate