https://github.com/formal-php/migrations
https://github.com/formal-php/migrations
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/formal-php/migrations
- Owner: formal-php
- Created: 2024-09-29T09:26:22.000Z (almost 2 years ago)
- Default Branch: develop
- Last Pushed: 2025-02-28T10:41:40.000Z (over 1 year ago)
- Last Synced: 2025-10-20T20:15:16.916Z (9 months ago)
- Language: PHP
- Homepage: https://formal-php.github.io/migrations/
- Size: 1.38 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# migrations
[](https://github.com/formal-php/migrations/actions/workflows/ci.yml)
[](https://codecov.io/gh/formal-php/migrations)
[](https://shepherd.dev/github/formal-php/migrations)
This library is a simple one way migration system.
You can run both SQL and Commands migrations.
## Installation
```sh
composer require formal/migrations
```
## Usage
```php
use Formal\Migrations\{
Factory,
Failure,
}
use Innmind\OperatingSystem\Factory as OS;
use Innmind\Url\{
Url,
Path,
};
$dsn = Url::of('mysql://user:pwd@127.0.0.1:3306/database');
Factory::of(OS::build())
->storeVersionsInDatabase($dsn)
->unwrap()
->sql()
->files(Path::of('migrations/folder/'))
->migrate($dsn)
->match(
static fn() => print('Everything has been migrated'),
static fn(Failure $failure) => printf(
'Migrations failed with the message : %s',
$failure->error()->getMessage(),
),
);
```
## Documentation
Full documentation available [here](https://formal-php.github.io/migrations/).