mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-24 22:57:12 -04:00
1.7 KiB
1.7 KiB
Docker
-
follow the instructions to install docker.
-
open terminal and run:
docker pull postgres
-
run
make init_docker
if you have not run before. You can find out the running container by rundocker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bfcdd6369e89 postgres "docker-entrypoint.s…" 19 minutes ago Up 19 minutes 0.0.0.0:5433->5432/tcp, :::5433->5432/tcp brave_bassi
- run
make init_database
. It will create the database on the remote specified by DATABASE_URL. You can connect you database using pgAdmin.
The information you enter must be the same as the make init_docker
. e.g.
export DB_USER=postgres
export DB_PASSWORD=password
export DB_NAME=flowy
export DB_PORT=5433
Run
By default, Docker images do not expose their ports to the underlying host machine. We need to do it explicitly using the -p flag.
docker run -p 8000:8000 backend
Sqlx
Sqlx and Diesel commands
-
create migration
- sqlx: sqlx migrate add $(table)
- diesel: diesel migration generation $(table)
-
run migration
- sqlx: sqlx migrate run
- diesel: diesel migration run
-
reset database
- sqlx: sqlx database reset
- diesel: diesel database reset
offline mode
cargo sqlx prepare -- --bin backend
Type mapping