An open API service indexing awesome lists of open source software.

https://github.com/andrewgatenbyvs/snap-migrations

🚀 Super-fast alternative to running database migrations (and optionally, seeds) during Tests, for Lumen & Laravel. Can save 75% of the migration (and seed) setup time, versus using the regular DatabaseMigrations trait.
https://github.com/andrewgatenbyvs/snap-migrations

database-migrations integration-testing laravel lumen lumen-package lumen-php-framework php-library phpunit phpunit-util unit-testing

Last synced: 3 months ago
JSON representation

🚀 Super-fast alternative to running database migrations (and optionally, seeds) during Tests, for Lumen & Laravel. Can save 75% of the migration (and seed) setup time, versus using the regular DatabaseMigrations trait.

Awesome Lists containing this project

README

        

[![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/AndrewGatenbyVS/snap-migrations.svg)](https://codeclimate.com/github/AndrewGatenbyVS/snap-migrations)
[![Code Climate technical debt](https://img.shields.io/codeclimate/tech-debt/AndrewGatenbyVS/snap-migrations.svg)](https://codeclimate.com/github/AndrewGatenbyVS/snap-migrations)
[![GitHub last commit](https://img.shields.io/github/last-commit/AndrewGatenbyVS/snap-migrations.svg)](https://github.com/AndrewGatenbyVS/snap-migrations/commits/master)
![PHP from Packagist](https://img.shields.io/packagist/php-v/andrewgatenby/snapmigrations.svg)
![Packagist](https://img.shields.io/packagist/dd/AndrewGatenby/snapmigrations.svg?color=00cc00&style=flat)

# Snap Migrations (for Lumen & Laravel)

This package is designed to be used within your TestCase class and allows for Lumen & Laravel applications to create a static SQL
dump of a migrated (and seeded) database. It will automatically do this on the first Test run from a TestCase that uses
this Trait. Each subsequent Test run will then use the SQL dumped copy of the database.

## Install

Install the package via Composer:

```
composer require --dev andrewgatenby/snapmigrations
```

## Usage

After a successful installation, you can add `SnapMigration` to your Test classes (potentially a parent class). This
package is designed to *replace* the regular `DatabaseMigrations` class that you might use:

```php
setUpSnapMigrations();
// my regular setUp tasks for MyAmazingTestCase
}
}
```

## Credit
This package was inspired by the awesome looking [Snipe Migrations](https://github.com/drfraker/snipe-migrations) that I'd tried to make use of first, but needed a Lumen-friendly implementation. It also uses the excellent
[MySQL Dump](https://github.com/dg/MySQL-dump) package.