mirror of
https://github.com/suitenumerique/docs.git
synced 2026-09-29 13:05:16 +02:00
♻️(yhub) maintain database schema using npm run init-db
The yhub database schema have new update and will probably be modified in the future. We don't want to maintain this sql schema in the Docs repo, we want to reuse what is directly made in the yhub project. For this we reuse the existing bin/init-db.js script
This commit is contained in:
@@ -101,6 +101,7 @@ pre-bootstrap: \
|
||||
|
||||
post-bootstrap: \
|
||||
migrate \
|
||||
migrate-yhub \
|
||||
demo \
|
||||
back-i18n-compile \
|
||||
mails-install \
|
||||
@@ -332,6 +333,20 @@ migrate: ## run django migrations for the impress project.
|
||||
@$(MANAGE) migrate
|
||||
.PHONY: migrate
|
||||
|
||||
# Runs the DDL script yhub ships (`bin/init-db.js`, wrapped as `npm run
|
||||
# init-db`): it creates the yhub database when missing, then every table the
|
||||
# installed @y/hub version needs. yhub never runs DDL from the server or the
|
||||
# worker, so this is what applies a schema change after an upgrade.
|
||||
# Both stores are started because the script also creates the valkey worker
|
||||
# stream and connects to it whenever REDIS is set. Re-running is safe and
|
||||
# expected; on an existing stream it logs a harmless `BUSYGROUP` error and
|
||||
# still exits 0, since the server creates that stream at startup anyway.
|
||||
migrate-yhub: ## create or upgrade the collaboration server (yhub) schema.
|
||||
@echo "$(BOLD)Running yhub migrations$(RESET)"
|
||||
@$(COMPOSE) up -d yhub-postgres yhub-valkey
|
||||
@$(COMPOSE_RUN) --no-deps yhub npm run init-db
|
||||
.PHONY: migrate-yhub
|
||||
|
||||
superuser: ## Create an admin superuser with password "admin"
|
||||
@echo "$(BOLD)Creating a Django superuser$(RESET)"
|
||||
@$(MANAGE) createsuperuser --email admin@example.com --password admin
|
||||
|
||||
Reference in New Issue
Block a user