Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Baptouuuu committed Oct 4, 2024
1 parent 74f58e6 commit e54e92d
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
[![codecov](https://codecov.io/gh/formal-php/migrations/branch/develop/graph/badge.svg)](https://codecov.io/gh/formal-php/migrations)
[![Type Coverage](https://shepherd.dev/github/formal-php/migrations/coverage.svg)](https://shepherd.dev/github/formal-php/migrations)

Description
This library is a simple one way migration system.

You can run both SQL and Commands migrations.

## Installation

Expand All @@ -14,4 +16,30 @@ composer require formal/migrations

## Usage

Todo
```php
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](https://formal-php.github.io/migrations/).

0 comments on commit e54e92d

Please sign in to comment.