Skip to content

fix(migration): set explicit primary key and index names for Oracle compatibility#79

Merged
vitormattos merged 2 commits intomainfrom
fix/oracle-index-constraints
Apr 14, 2026
Merged

fix(migration): set explicit primary key and index names for Oracle compatibility#79
vitormattos merged 2 commits intomainfrom
fix/oracle-index-constraints

Conversation

@vitormattos
Copy link
Copy Markdown
Member

Problem

Issue #65 was re-opened because the bug persists even after v1.0.2.

After the previous fix (PR #74 shortened profile_fields_def_active_order_idx), two more Oracle naming constraint violations remain in Version1000Date20260309120000:

1. Primary key — profile_fields_definitions table

Nextcloud NC 32 ensureOracleConstraints rule: if no explicit primary key name is set (DBAL default 'primary'), the table name without prefix must be < 23 chars. The profile_fields_definitions table is 26 chars, so fresh installs fail with:

Primary index name on "oc_profile_fields_definitions" is too long.

2. Unique index — profile_fields_values table

profile_fields_val_field_user_uk is 32 chars, exceeding Oracle's 30-char limit.

Fix

  • profile_fields_definitions: setPrimaryKey(['id'], 'pf_definitions_pk') (16 chars)
  • profile_fields_values: setPrimaryKey(['id'], 'pf_values_pk') + rename profile_fields_val_field_user_ukpf_val_def_user_uk (18 chars)

Test

Added Version1000Date20260309120000Test::testAllNamesPassOracleConstraints replicating NC 32 Oracle constraint checks — confirmed red before fix, green after.

Closes #65

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…ompatibility

- setPrimaryKey with explicit name 'pf_definitions_pk' (16 chars) for
  profile_fields_definitions table (table name without prefix is 26 chars,
  requires explicit PK name when >= 23 chars per NC Oracle constraint)
- setPrimaryKey with explicit name 'pf_values_pk' for profile_fields_values
- rename unique index 'profile_fields_val_field_user_uk' (32 chars) to
  'pf_val_def_user_uk' (18 chars); Oracle max identifier length is 30

Fixes #65

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos merged commit 39787ee into main Apr 14, 2026
23 checks passed
@vitormattos vitormattos deleted the fix/oracle-index-constraints branch April 14, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant