/tadoku-migrate-ory

Document Ory Kratos migration process for Tadoku v1 -> v2

Primary LanguageJavaScriptMIT LicenseMIT

tadoku-migrate-ory

How to migrate

  1. Load data with kubectl exec -it postgres-immersion-0 -- env PGPASSWORD=$PGPASSWORD psql $DATABASE -U $PGUSER < ./backup_tadoku_prod_20230125_015624.pgdump with the correct parameters. Make sure this creates a new schema old.
  2. Add new fields to store the new UUIDs
alter table old.contests add column new_id uuid default (uuid_generate_v4());
alter table old.contest_logs add column new_id uuid default (uuid_generate_v4());
alter table old.users add column new_id uuid default null;
  1. Check if the configuration is correct in migrate.js
  2. Run the migration script pnpm run migrate
  3. There might be some conflicting users, you can ignore those.
  4. Generate the query to fix the created_at timestamps and apply it kratos db pnpm run kratos | pbcopy