Migration |> New foreign column on existing table |> after X column


I’m wondering if there is some way to choose the position of a new column while I’m modifying an existing table. On eloquent, for example, there is a function ->after()

I’m adding a foreign id column, and I would like it on the second position, instead last after the timestamps.

Thanks so much!

On MySQL, you can use the after option to add in a migration when adding the column.

1 Like

In Postgres - you can’t. More info: Alter column position - PostgreSQL wiki


Yes, it is Postgres… Sad to hear… painful to see.