laravel-migrations-generator
laravel-migrations-generator copied to clipboard
PostgreSQL add migration to create domains
Imagine this scenario in a PostgreSQL db:
- Create a domain:
create domain word64 as varchar(64);
- Create the following table:
CREATE TABLE cars (
id serial PRIMARY KEY,
name word64 NOT null
);
-
Run the command:
php artisan migrate:generate
-
Migration created:
Schema::create('cars', function (Blueprint $table) {
$table->increments('id');
});
DB::statement("ALTER TABLE cars ADD name word64 NOT NULL");
Obviously if you try to execute this migration you will get an error cause postgres can't recognize the word64 type. I would like that the command php artisan migrate:generate
generate another migration to specify the domains created previously.
Hi @EmptySpace99, thanks for reporting the issue.
I like the idea of create type
. However, I have limited time to implement this feature due to my tight schedule.
I will revisit this issue in the near future.
Please feel free to push PR, or any SQL statement
that you think will be helpful for development.