PHP code example of kingga / laravel-migrations

1. Go to this page and download the library: Download kingga/laravel-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/ */

    

kingga / laravel-migrations example snippets




use Kingga\LaravelMigrations\ChangeKeyTypeMigration;

class MigrationNameHere extends ChangeKeyTypeMigration
{
    /**
     * {@inheritDoc}
     */
    protected function getTable(): string
    {
        return 'users';
    }

    /**
     * {@inheritDoc}
     */
    protected function getColumn(): string
    {
        return 'id';
    }

    /**
     * {@inheritDoc}
     */
    protected function getFrom(): array
    {
        // These methods are used on the 'down' method.
        // 0 => parent.id->increments, foreign.user_id->unsignedInteger.
        return ['increments', 'unsignedInteger'];
    }

    /**
     * {@inheritDoc}
     */
    protected function getTo(): array
    {
        // These methods are used on the 'up' method.
        // 0 => parent.id->bigIncrements, foreign.user_id->unsignedBigIncrements.
        return ['bigIncrements', 'unsignedBigIncrements'];
    }
}