Skip to content

[codex] Add appId tenant schema migration - #350

Open
Bosn wants to merge 2 commits into
mainfrom
op/app-id-migration
Open

[codex] Add appId tenant schema migration#350
Bosn wants to merge 2 commits into
mainfrom
op/app-id-migration

Conversation

@Bosn

@Bosn Bosn commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add an appId tenant schema migration command for active TiDB/MySQL tenants
  • move manual schema files under server/database/ and document the new layout
  • update schema references across README, AGENTS, and design docs

Details

The migration reads MNEMO_DSN, decrypts tenant DB passwords with MNEMO_ENCRYPT_TYPE / MNEMO_ENCRYPT_KEY, processes active tenants in batches, and writes success.tsv, failed.tsv, and skipped.tsv state files so the job can be resumed safely.

For each tenant it requires both memories and sessions tables, adds app_id columns and indexes when missing, and replaces the old session dedup index with idx_sessions_dedup(app_id, session_id, content_hash) when needed.

Validation

  • cd server && go test -race -count=1 ./database/migration
  • cd server && go test -race -count=1 ./internal/tenant

@Bosn
Bosn marked this pull request as ready for review June 4, 2026 08:05

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 253ab0f9f5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/database/migration/app_id_tenant_schema_migration.go Outdated
@Bosn

Bosn commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant