Skip to content

Commit 41dc85a

Browse files
authored
feat!: remove support for postgresql (#263)
BREAKING CHANGE: This commit removes support for postgresql as it was unmaintained and untested. Removing the code will make maintenance easier. Please note that this does not mean that postgresql will never be supported, if there is demand for other databases than SQLite, it will be evaluated.
1 parent cfabbf4 commit 41dc85a

File tree

7 files changed

+19
-200
lines changed

7 files changed

+19
-200
lines changed

.vscode/launch.json

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,6 @@
1212
"GIN_MODE": "debug"
1313
},
1414
"console": "integratedTerminal"
15-
},
16-
{
17-
"name": "Run API (postgresql in compose)",
18-
"type": "go",
19-
"request": "launch",
20-
"mode": "auto",
21-
"cwd": "${workspaceFolder}",
22-
"program": "${workspaceFolder}/main.go",
23-
"env": {
24-
"LOG_LEVEL": "debug",
25-
"DB_HOST": "localhost",
26-
"DB_USER": "ez",
27-
"DB_PASSWORD": "thisisunsafe",
28-
"DB_NAME": "postgres"
29-
},
30-
"console": "integratedTerminal"
3115
}
3216
]
3317
}

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ See [docs/upgrading.md](docs/upgrading.md).
2121

2222
### Configuration
2323

24-
:warning: If you do not configure a postgresql database, sqlite will automatically be used. Mount a persistent volume to the `/data` directory - this is where the sqlite database is stored. If you do not do this, you will lose all data every time the container is deleted.
24+
:warning: You need to configure a persistent storage to be mounted to `/data`, e.g. a docker volume. If you do not do this, upon deleting the container, all your data will be lost.
2525

2626
The backend can be configured with the following environment variables.
2727

@@ -31,10 +31,6 @@ The backend can be configured with the following environment variables.
3131
| `GIN_MODE` | One of `release`, `debug` | `release` | The mode that gin runs in. Only set this to `debug` on your development environment! |
3232
| `PORT` | `number` | `8080` | The port the backend listens on |
3333
| `LOG_FORMAT` | One of `json`, `human` | `json` if `GIN_MODE` is `release`, otherwise `human` | If log output is written human readable or as JSON. |
34-
| `DB_HOST` | `string` | `""` | hostname or address of postgresql |
35-
| `DB_USER` | `string` | `""` | username for the postgresql connection |
36-
| `DB_PASSWORD` | `string` | `""` | password for `DB_USER` |
37-
| `DB_NAME` | `string` | `""` | name of the database to use |
3834
| `CORS_ALLOW_ORIGINS` | `string` | `""` | hosts that are allowed to use cross origin requests, separated by spaces. Only set this when your frontend runs on a different host and/or port than the backend! |
3935

4036
### Deployment methods

docker-compose.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
version: "3"
22

33
services:
4-
db:
5-
image: postgres:14.4-alpine
6-
restart: always
7-
environment:
8-
- POSTGRES_USER=ez
9-
- POSTGRES_PASSWORD=thisisunsafe
10-
ports:
11-
- 5432:5432
12-
volumes:
13-
- db:/var/lib/postgresql/data
14-
154
backend:
165
build: .
176
depends_on:
@@ -20,10 +9,8 @@ services:
209
- 8080:8080
2110
environment:
2211
GIN_MODE: debug
23-
DB_HOST: db
24-
DB_USER: ez
25-
DB_PASSWORD: thisisunsafe
26-
DB_NAME: postgres
12+
volumes:
13+
- data:/data
2714

2815
volumes:
29-
db:
16+
data:

docs/upgrading.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
If upgrades between versions require manual actions, those are described here.
44

5+
## v0.32.0 to v0.33.0
6+
7+
[v0.33.0](https://github.com/envelope-zero/backend/releases/tag/v0.33.0) removes support for postgresql.
8+
9+
If you are currently using postgresql, you need to:
10+
11+
1. Export your data with `pg_dump --data-only`.
12+
2. Upgrade to `v0.33.0` and then re-import the data with `.read database-dump.sql` to the sqlite database.
13+
514
## v0.31.0 to v0.31.1
615

716
[v0.31.1](https://github.com/envelope-zero/backend/releases/tag/v0.31.1), fixes buggy behaviour from `v0.31.0` and simplifies base URL configuration at the same time.

go.mod

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ require (
1717
github.com/swaggo/gin-swagger v1.5.1
1818
github.com/swaggo/swag v1.8.4
1919
github.com/wei840222/gorm-zerolog v0.0.0-20210303025759-235c42bb33fa
20-
gorm.io/driver/postgres v1.3.8
2120
gorm.io/gorm v1.23.8
2221
)
2322

@@ -33,14 +32,6 @@ require (
3332
github.com/go-playground/universal-translator v0.18.0 // indirect
3433
github.com/go-playground/validator/v10 v10.11.0 // indirect
3534
github.com/goccy/go-json v0.9.8 // indirect
36-
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
37-
github.com/jackc/pgconn v1.12.1 // indirect
38-
github.com/jackc/pgio v1.0.0 // indirect
39-
github.com/jackc/pgpassfile v1.0.0 // indirect
40-
github.com/jackc/pgproto3/v2 v2.3.0 // indirect
41-
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
42-
github.com/jackc/pgtype v1.11.0 // indirect
43-
github.com/jackc/pgx/v4 v4.16.1 // indirect
4435
github.com/jinzhu/inflection v1.0.0 // indirect
4536
github.com/jinzhu/now v1.1.5 // indirect
4637
github.com/josharian/intern v1.0.0 // indirect

0 commit comments

Comments
 (0)