Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom postgres types fails if there is an index on the type #198

Open
esbenp opened this issue Jan 21, 2024 · 1 comment
Open

Custom postgres types fails if there is an index on the type #198

esbenp opened this issue Jan 21, 2024 · 1 comment

Comments

@esbenp
Copy link

esbenp commented Jan 21, 2024

Describe the bug

#107 added support for custom postgres types. The problem is the type is added outside of the normal migration, which is a problem if said column is also in an index on the table

To Reproduce

  1. Create table with column that is a type, but which also has an index on that column
  2. Generate migrations

This will create a migration ala

public function up()
{
    Schema::create('table', function (Blueprint $table) {
        ...

        $table->index(['column']);
    });
    DB::statement("ALTER TABLE table ADD column custom_type NOT NULL");
}

Which will fail since column is not defined when the index is added

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Details (please complete the following information):

  • DB: Postgresql
  • DB Version: 10+
  • Laravel Version: 10
  • PHP Version: 8.3
  • Migrations Generator Version: 6.11
  • Doctrine DBAL Version [composer info doctrine/dbal | grep versions]: 3.7.2

Additional context
Add any other context about the problem here.

@esbenp
Copy link
Author

esbenp commented Jan 21, 2024

Correction: I think this only happens if it's part of a composite index

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant