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

Document opinion: order of migration matters, hence linear #213

Open
benjie opened this issue May 13, 2024 · 0 comments
Open

Document opinion: order of migration matters, hence linear #213

benjie opened this issue May 13, 2024 · 0 comments

Comments

@benjie
Copy link
Member

benjie commented May 13, 2024

Imagine you have the table create table my_table (id serial primary key); and these two migrations on separate branches:

alter table my_table add column column_1 int;
alter table my_table add column column_a text;

At first you might think these don't conflict, but actually they do, the end result is dependent on order:

create table my_table (
  id serial primary key,
  column_1 int,
  column_a text
);

versus:

create table my_table (
  id serial primary key,
  column_a text,
  column_1 int
);

Now if you try and represent this table value as a tuple - (1, 2, 'three')::my_table - then this will work against one DB but fail against the other. Order of columns is significant.

So it's best to ensure that your migrations are completely linear.

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