Reputation: 12005
Does Laravel allow to use database migration based on ready SQL created in Workbench as an option?
As I know, now it suggests to write migration file manually following the specific format.
Upvotes: 0
Views: 1086
Reputation: 1730
A few weeks ago we released support for Laravel framework for our visual editor Skipper (https://www.skipper18.com). From your question I suppose, it might be very useful for you.
You can import your project from a database (MySql, Postgres, MSSQL or Sqlite) and you will get a clear graphical diagram of it which you can then automatically export to model classes and migrations files.
In addition, you can make changes in the model and create new migrations and repetitively export all changes back to Laravel PHP files. All of this via a user-friendly interface.
If you want to try it, it's completely free during the beta period. You can download it here https://www.skipper18.com/en/download and in the initial application license screen select "Laravel Beta license".
Upvotes: 0
Reputation: 3594
Yes, Laravel allows the use of ready SQL created in Workbench. You just have to connect your Laravel application to the database, and you should be fine.
The use of migrations in Laravel is not mandatory, but very useful in tracking versions your database structure.
Since tracking the structure of your database is very essential, I recommend you try one of these packages to convert your SQL to Laravel migrations:
Laravel Migration Exporter for Sequel Pro – A bundle for Sequel Pro that lets you generate Laravel migration files from existing tables. Written in PHP language.
Xethron Laravel Migrations Generator – Laravel artisan-command tool, available as Laravel package
Upvotes: 0
Reputation: 696
Sure, there's nothing preventing you from running SQL in a migration. You can use DB::statement()
to do this inside of up()
in your migration.
\Illuminate\Support\Facades\DB::statement('
create table application_pages_test
(
id int unsigned auto_increment
primary key,
application_id tinyint unsigned not null,
title varchar(64) not null,
created_at timestamp null,
updated_at timestamp null
)
collate=utf8_unicode_ci
;');
Upvotes: 2