laravel-migrations-generator icon indicating copy to clipboard operation
laravel-migrations-generator copied to clipboard

PostgreSQL add migration to create domains

Open EmptySpace99 opened this issue 1 year ago • 1 comments

Imagine this scenario in a PostgreSQL db:

  1. Create a domain: create domain word64 as varchar(64);
  2. Create the following table:
CREATE TABLE cars (
  id serial PRIMARY KEY,
  name word64 NOT null
);
  1. Run the command: php artisan migrate:generate

  2. 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.

EmptySpace99 avatar Sep 05 '22 18:09 EmptySpace99

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.

kitloong avatar Sep 06 '22 14:09 kitloong