mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-28 18:08:15 +03:00
33 lines
1.1 KiB
Plaintext
33 lines
1.1 KiB
Plaintext
# Justfile for the v3 migration. To be deleted once everything has moved over.
|
|
|
|
# do the full migration suite.
|
|
migrate-v3:
|
|
just gen
|
|
just seeds-v3-migrate
|
|
just mongo-to-pg kamai kamai
|
|
just mongo-to-pg boku boku
|
|
|
|
# Migrate all MongoDB data into Postgres (run once, requires both DBs to be reachable).
|
|
mongo-to-pg POSTGRES_DB_NAME MONGO_DB_NAME:
|
|
just db-cheap-reset "{{ POSTGRES_DB_NAME }}"
|
|
|
|
cd typescript/server && VERSION=$(jq -r .version package.json) COMMIT_HASH=$(git rev-parse --short HEAD) POSTGRES_URL="{{POSTGRES_URL}}/{{POSTGRES_DB_NAME}}" MONGO_URL="mongodb://tachi-mongo/{{MONGO_DB_NAME}}" \
|
|
bun run src/scripts/migrate-to-postgres.ts
|
|
|
|
# Rollback the seeds to the state stored somewhere (v2 keeps seeds in seeds/collections, v3 in db/seeds).
|
|
seeds-rollback ROLLBACK_DIR="/host-pc/Documents/Repos/Tachi/seeds/collections":
|
|
rsync -avz --delete "{{ROLLBACK_DIR}}/" db/seeds
|
|
|
|
seeds-test:
|
|
cd "typescript/seeds-scripts" && ./run-tests.sh
|
|
|
|
seeds-v3-migrate: seeds-rollback
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
cd "typescript/seeds-scripts"
|
|
|
|
for script in $(ls -1 rerunners/v3/*.ts); do
|
|
bun run "./$script"
|
|
done
|
|
just seeds-test
|