Skip to content

[stable35] fix(migration): create text_steps index ascending on oracle - #9472

Open
moodyjmz wants to merge 8 commits into
stable35from
backport/9440/stable35
Open

moodyjmz wants to merge 8 commits into
stable35from
backport/9440/stable35

Conversation

@moodyjmz

Copy link
Copy Markdown
Contributor

Backport of #9440

The class map is regenerated for this branch; the version bump is to 9.0.2 so the migrations run.

馃 AI (if applicable)

  • The content of this PR was partly or fully generated using AI tools
  • The AI-generated content was reviewed, comprehended and tested by a human

Oracle stores a DESC key as a hidden virtual column (SYS_NC...$). The
index then references a column the table does not list, so the schema
comparison of every later migration fails with "There is no column with
name ...". Oracle scans an ascending index backwards for ORDER BY id DESC,
so use the schema API as on MySQL.

Fresh installs only run changeSchema, so the test drives the migration
through the upgrade path on Oracle.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
Assert the index exists after install instead of skipping the drop when
it is missing, and keep the class constant untyped so the test backports
to PHP 8.1 and 8.2.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
An Oracle instance with text_steps_doc_id_id_index created as "id" DESC
cannot run any later migration that changes the schema. Drop that index
and recreate it ascending.

This only helps when no schema-changing step runs before it. Core
migrations run before app migrations, so on a major upgrade an instance
with the descending index still needs it replaced by hand.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
Fresh installs on PostgreSQL and SQLite, and Oracle installs that ran the
migration before it created the index, have no text_steps_doc_id_id_index.
Let occ db:add-missing-indices add it, and let the schema check treat it
as optional.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
Rector requires typed class constants on main, which stable32 to 34
cannot parse, so use the literal as the migrations do.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
Drop the descending index from the target schema in changeSchema instead
of with raw SQL in preSchemaChange. The comparison only fails while
rebuilding target indexes, so it then just emits a DROP INDEX.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>

This branch has not been deployed

No deployments
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