DEV Community

Cover image for 🐔 I made a PHP Library "Conv-Laravel": Auto-generate MySQL migration queries. 🤖
howyi
howyi

Posted on

🐔 I made a PHP Library "Conv-Laravel": Auto-generate MySQL migration queries. 🤖

thumbnail
full size

GitHub logo howyi / conv-laravel

MySQL migration query auto generate on Laravel/Lumen

conv-laravel

MySQL migration query auto generate on Laravel/Lumen

Install

  1. require library (Laravel/Lumen)
composer require "howyi/conv-laravel" --dev
  1. publish config (only Laravel)
php artisan vendor:publish --provider="Howyi\ConvLaravel\ConvServiceProvider"
  1. schema initialize (Laravel/Lumen)
php artisan conv:reflect

generate CREATE queries on database/schemas

Usage

  1. edit CREATE query (in schema directory)
  2. php artisan conv:generate to generate migrations from actual Database - CREATE queries
  3. php artisan migrate to migration





feature

Generate MySQL migration queries from actual DB (\PDO) and DDLs (CREATE queries)

motivation

I'm tired of writing migration queries ... 😌

install

  1. require library (Laravel/Lumen)
composer require "howyi/conv-laravel" --dev
Enter fullscreen mode Exit fullscreen mode
  1. publish config (only Laravel)
php artisan vendor:publish --provider="Howyi\ConvLaravel\ConvServiceProvider"
Enter fullscreen mode Exit fullscreen mode
  1. schema initialize (Laravel/Lumen)
php artisan conv:reflect
Enter fullscreen mode Exit fullscreen mode

generate CREATE queries on database/schemas

usage

  1. edit CREATE query (in schema directory)
  2. php artisan conv:generate to generate migrations from actual Database - CREATE queries
  3. php artisan migrate to migration

example

example repository 😉

Top comments (1)

Collapse
 
steamwind profile image
SteamWind

Good idea, transforming sql to migration syntax would be the heaven!