Download the PHP package othyn/laravel-migrate-to-sql without Composer

On this page you can find all versions of the php package othyn/laravel-migrate-to-sql. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-migrate-to-sql

Laravel: Migrate to SQL

Tests Style Code Coverage Licence

Quickly convert and export all Laravel migrations into an SQL file, or to TTY, with options to prettify the output via a new handy artisan command that extends the default migrate command list.


Index


Installation

Via Composer, you can run a composer require which will grab the latest version of this repo via packagist. Although, for the time being you will need to first add the custom repo to load the patched version of doctrine/sql-formatter until the PR is merged:

If you want to have composer use your SSH key instead of an oauth token (like I do) when fetching the package, you can use the no-api key:

Then you can run composer require as normal:


Installation - This Package Version vs. PHP & Laravel Versions

The following table describes which version of this packagae you will require for the given PHP & Laravel version.

Package Version PHP Version Laravel Version
^2.0.0 ^7.4 | ^8.0 ^7.0 | ^8.0
^1.0.0 - -

Usage

Outlined below are all of the explicit command options, detailing their usage:


Usage - Default behaviour

By default, the command will:


Usage - Output a specific type of migration

By type, I'm referring to both the up and down methods within a migration - in which those are your only two options here.

By default, the command will generate up migrations, but if you wish to generate down migrations, then you can my doing the following:

which will generate the down migrations to a file on disk, in the default directory specified above, in the following structure:


Usage - Output to a specific custom export path

If you wish for the command to export to a custom defined location, then pass it with the --exportPath option, for example:

which will generate the up migrations to ~/migrations.up.sql on disk, in the following structure:


Usage - Output without formatting or prettifying the query

If you wish for the command to export the queries without doing any sort of formatting or pretty-ing of them, then pass the --ugly option, for example:

which will generate the up migrations to a file on disk, in the default directory specified above, in the following structure:


Usage - Output to TTY instead of to disk

If you wish for the command to export the queries without storing them to disk and stead sending them to TTY, then pass the --tty option, for example (which will generate the up migrations):


Usage - Custom database connection

If you wish for the command to use a custom database connection, so that it can read the migration state from the provided database connection and only generate queries for migrations that have not been run, then pass it with the --connection option, for example:

which will generate the up migrations to ~/migrations.up.sql on disk, for the sqlite connection, only containing migrations not run against that connection, in the following structure:


Usage - Combining multiple options

Options can be combined with each other to get a more customised output, for example you could do this:

To generate only down migrations, against the sqlite connection, to TTY only and without any SQL formatting taking place.


Testing

There is a Docker container that is pre-built that contains an Alpine CLI release of PHP + PHPUnit + xdebug. This is setup to test the project and can be setup via the following:

This should trigger Docker Compose to build the image.

There are tests for all code written, in which can be run via:

In those tests, there are Feature tests for a production ready implementation of the package. There are also Unit tests for each class written for full coverage.

You can also easily open a shell in the testing container by using the command:


Todo


Changelog

Any and all project changes for releases should be documented below. Versioning follows the SEMVER standard.


Version 2.0.0

Custom DB connection support for generating partial, only non-migrated patch files.

The original v1.1.0 patch that this was should've triggered this major semver version bump due to the new composer version dependencies. This causing a breaking change to build dependencies in environments accepting the original minor version upgrade, apologies for any inconvenience caused.

Added

Changed

Fixed

Removed


Version 1.0.0

Initial release.

Added

Changed

Fixed

Removed


All versions of laravel-migrate-to-sql with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
doctrine/sql-formatter Version dev-temp-until-pr-merged
illuminate/support Version ^7.0|^8.0
spatie/macroable Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package othyn/laravel-migrate-to-sql contains the following files

Loading the files please wait ....