Skip to content

Latest commit

 

History

History
45 lines (34 loc) · 1.24 KB

README.md

File metadata and controls

45 lines (34 loc) · 1.24 KB

migrations

Build Status codecov Type Coverage

This library is a simple one way migration system.

You can run both SQL and Commands migrations.

Installation

composer require formal/migrations

Usage

use Formal\Migrations\Factory;
use Innmind\OperatingSystem\Factory as OS;
use Innmind\Url\{
    Url,
    Path,
};

$dsn = Url::of('mysql://user:[email protected]:3306/database');

Factory::of(OS::build())
    ->storeVersionsInDatabase($dsn)
    ->sql()
    ->files(Path::of('migrations/folder/'))
    ->migrate($dsn)
    ->match(
        static fn() => print('Everything has been migrated'),
        static fn(\Throwable $error) => printf(
            'Migrations failed with the message : %s',
            $error->getMessage(),
        ),
    );

Documentation

Full documentation available here.