Skip to content

refactor: update ids from int32 to int64 - #12

Merged
tugascript merged 2 commits into
masterfrom
tugascript/refactor-ids
Oct 10, 2026
Merged

tugascript merged 2 commits into
masterfrom
tugascript/refactor-ids

Conversation

@tugascript

Copy link
Copy Markdown
Owner

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes)
  • Other... Please describe:

Uses int 64 for IDs to allow for more users

What is the current behavior?

IDs are int 32

Issue Number: N/A

What is the new behavior?

@tugascript
tugascript requested a balanced review from Copilot October 10, 2026 13:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T13:41:05.147307Z d8177a3 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tugascript

Copy link
Copy Markdown
Owner Author

@codex

@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: d8177a31a7

ℹ️ 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".

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

A system-wide primary-key type migration across security-sensitive auth/session/credential tables, plus a bundled out-of-scope OAuth behavior change, warrants human verification (including a compile/migration run).

1 open finding
What changed in this PR

This PR widens all internal database entity identifiers from 32-bit to 64-bit (serial/integer → bigserial/bigint in Postgres, and int32 → int64 in Go) to support a larger number of users and records. It is a broad, mostly mechanical refactor spanning the DBML schema, the generated sqlc models/queries, DTOs, services, controllers, cache, and crypto helper signatures, plus corresponding pgtype.Int4 → pgtype.Int8 updates for nullable ID columns.

Changes:

  • Migrate primary/foreign key ID columns to bigserial/bigint in initial_schema.dbml and the initial schema migration, and regenerate models.go and all *.sql.go query signatures to int64.
  • Update hand-written service/controller/cache/crypto code (DTO ID() getters, option structs, callback type aliases, strconv parsing to base-64) to use int64.
  • Bundle an unrelated behavioral change to CreateNativeApp (default response types + added validation) and a project.md status reorg.
File Description
initial_schema.dbml, migrations/​...up.sql Change ID columns to bigserial/bigint
database/​models.go, database/​*.sql.go Regenerated structs/queries with int64 IDs and pgtype.Int8
services/​*.go, services/​dtos/​*.go Option structs, ID() getters, parsing updated to int64
providers/​crypto/​*.go Store/Get callback type aliases widened to int64
providers/​cache/​*.go Cache key/options and strconv parsing updated to int64
controllers/​middleware.go, controllers/​users.go, params/​users.go Locals assertion, URL param, and casts updated to int64
services/​apps.go Includes an out-of-scope CreateNativeApp response-type behavior change
project.md Status list reorganization
tests/​dynamic_registration_test.go Scan targets updated to int64

I verified the refactor is internally consistent: no leftover int32 ID declarations/casts, Locals("accountID") reads int64 matching its int64 source, remaining pgtype.Int4 usages are non-ID (TTL/MaxAge) columns, and tokens carry UUID public IDs rather than internal ints.

Files not reviewed (18)
  • idp/internal/providers/database/account_2fa_configs.sql.go: Generated file
  • idp/internal/providers/database/account_credential_secrets.sql.go: Generated file
  • idp/internal/providers/database/account_credentials.sql.go: Generated file
  • idp/internal/providers/database/account_credentials_keys.sql.go: Generated file
  • idp/internal/providers/database/account_data_encryption_keys.sql.go: Generated file
  • idp/internal/providers/database/account_dynamic_registration_configs.sql.go: Generated file
  • idp/internal/providers/database/account_grants.sql.go: Generated file
  • idp/internal/providers/database/account_hmac_secrets.sql.go: Generated file
  • idp/internal/providers/database/account_key_encryption_keys.sql.go: Generated file
  • idp/internal/providers/database/account_sessions.sql.go: Generated file
  • idp/internal/providers/database/account_token_signing_keys.sql.go: Generated file
  • idp/internal/providers/database/account_totps.sql.go: Generated file
  • idp/internal/providers/database/accounts.sql.go: Generated file
  • idp/internal/providers/database/app_designs.sql.go: Generated file
  • idp/internal/providers/database/app_dynamic_registration_configs.sql.go: Generated file
  • idp/internal/providers/database/app_keys.sql.go: Generated file
  • idp/internal/providers/database/app_profiles.sql.go: Generated file
  • idp/internal/providers/database/app_secrets.sql.go: Generated file

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread idp/internal/services/apps.go
@tugascript
tugascript merged commit 0379d7d into master Oct 10, 2026
1 check passed
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.

2 participants