graphile / graphile/migrate

Document opinion: order of migration matters, hence linear

Open
#213 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
835
Forks
64
Avg merge
17m
Merged PRs (30d)
5

Description

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

```sql
alter table my_table add column column_1 int;
```

```sql
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:

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

versus:

```sql
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.