drizzle-team / drizzle-team/drizzle-orm

[FEATURE]:Support multiple branch development ?

Open
#1,221 5 comments 20 reactions 0 assignees View on GitHub
docs docs/improvements drizzle/kit enhancement priority
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Describe what you want

When we develop on different branches, will cause migrate sql lost when merge.

This because of the sql:

```sql
Query: CREATE SCHEMA IF NOT EXISTS "drizzle"
Query:
CREATE TABLE IF NOT EXISTS "drizzle"."__drizzle_migrations" (
id SERIAL PRIMARY KEY,
hash text NOT NULL,
created_at bigint
)

Query: select id, hash, created_at from "drizzle"."__drizzle_migrations" order by created_at desc limit 1
Query: begin
Query: commit
```

When I generate migrate sql on different branches, will cause conflict. See the final result:

```txt
❯ tree drizzle
drizzle
├── 0000_calm_talos.sql
├── 0001_reflective_malice.sql
├── 0002_careful_northstar.sql
├── 0003_blushing_martin_li.sql
├── 0004_bumpy_katie_power.sql
├── 0004_even_cyclops.sql
├── 0006_luxuriant_bloodscream.sql
└── meta
├── 0000_snapshot.json
├── 0001_snapshot.json
├── 0002_snapshot.json
├── 0003_snapshot.json
├── 0004_snapshot.json
├── 0006_snapshot.json
└── _journal.json

2 directories, 14 files
```

You can see there're 2 `0004_` sqls here.

So if ` 0004_even_cyclops.sql` first migrate, then merge branch with file `0004_bumpy_katie_power.sql`, will cause `0004_bumpy_katie_power.sql` never execute, this because the sql of migrate:

```sql
select id, hash, created_at from "drizzle"."__drizzle_migrations" order by created_at desc limit 1
```

I hope you can support multiple branches development. Thanks.

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.