Dumped schema cannot be loaded
- 主要語言
- Go
- 星號
- 7.4k
- 分支
- 379
- 平均合併
- 6 分鐘
- 30 天內合併 PR
- 1
描述
**Description**
Schemas produced with `dbmate dump` for PostgreSQL cannot be used to provision databases. This is especially annoying because I wanted to use the dump to provision test database as well as to generate code with `bob` and it requires loading the dump into a running database.
I understand that dbmate simply uses pg_dump under the the hood, but it could at least try to clean up the produced dumps and make sure they are loadable.
- Version: 2.27
- Database: PostgreSQL 17.x
- Operating System: Ubuntu 24.04
**Steps To Reproduce**
1. Create an empty database using `dbmate create`
2. Create a dump with `dbmate dump`
3. Try loading this dump with `dbmate load`
4. Observe
```
Reading: ./db/schema.sql
Error: pq: schema "public" already exists
```
`SET` statements also cause problems when loading pg17 dumps in pg16.
**Expected Behavior**
1. No errors should be raised, dbmate should either filter out sql commands related to creating public schema and it's own `schema_migrations` table from the dump or ignore them when loading it.
I volunteer myself to prepare a fix if we agree on a solution.
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。