Skip to content

fix(test): oracle populate using oracle 19c and lower - #2864

Merged
bpamiri merged 3 commits into
wheels-dev:developfrom
mikegrogan:mikeg-fix/oracle-populate-test
Jun 6, 2026
Merged

bpamiri merged 3 commits into
wheels-dev:developfrom
mikegrogan:mikeg-fix/oracle-populate-test

Conversation

@mikegrogan

Copy link
Copy Markdown
Contributor

Summary

fix(test): resolve oracle ddl syntax errors in test suite population. Tested against Ran against oracle 19c. Oracle 23c and beyond there is no needed fix. the "if exists" got added to their create table syntax.
https://database.guide/oracle-adds-support-for-if-exists-and-if-not-exists-syntax-modifiers/

Related Issue

Closes #

Type of Change

  • Bug fix
  • New feature
  • Enhancement to existing feature
  • Documentation update
  • Refactoring

Feature Completeness Checklist

  • DCO sign-off -- Every commit carries Signed-off-by: (use git commit -s); see CONTRIBUTING.md
  • Tests -- Unit tests covering happy path, edge cases, and error conditions
  • Framework Docs -- New or updated MDX page under web/sites/guides/src/content/docs/v4-0-0-snapshot/ with matching sidebar entry
  • AI Reference Docs -- New or updated file in .ai/wheels/ directory
  • CLAUDE.md -- Updated if the feature changes model/controller/view conventions
  • CHANGELOG.md -- Entry under [Unreleased] section
  • Test runner passes -- All existing tests still pass (/wheels/tests/core?format=json)

Test Plan

Ran against oracle 19c

Screenshots / Output

@mikegrogan mikegrogan changed the title Mikeg fix/oracle populate test mikeg fix/oracle populate test Jun 5, 2026
@mikegrogan mikegrogan changed the title mikeg fix/oracle populate test fix(test): oracle populate using oracle 19c and lower Jun 5, 2026

@bpamiri bpamiri left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👋 Thanks for the fix, @mikegrogan — and welcome as a first-time contributor! Solid catch: Oracle only added IF EXISTS DDL modifiers in 23c, so DROP TABLE IF EXISTS is a hard parse error on 19c/21c.

Verdict: looks good — one process item before merge

The logic is correct, and the Lucee 7 + SQLite CI job passed on your latest commit bd2d84a. (It currently shows skipping only because editing the PR title re-runs CI as an edited event, which intentionally bypasses the test job — the earlier opened run on the same commit is green. The one earlier red was the PR-title commitlint check, which you've already fixed.)

Correctness ✅

  • local.dbinfo and local.db are both set earlier in the file (lines 4 and 12), and database_version is a valid cfdbinfo type="version" key — the existing H2 branch already reads it. Val(ListFirst(...)) keeps the parse safe on every engine, and it's only consulted in the Oracle branch.
  • Both DROP TABLE IF EXISTS sites in this file are covered, and you correctly left vendor/wheels/tests/populate.cfm alone — that one already drops Oracle tables via cfdbinfo type="tables" + CASCADE CONSTRAINTS PURGE, so it never had this bug.

Optional polish (non-blocking)

The guard is inlined twice; if you feel like it you could compute it once near dbMajorVersion:

<cfset local.dropIfExists = (local.db IS NOT "oracle" OR local.dbMajorVersion GTE 23) ? " IF EXISTS" : "">
...
<cfquery ...>DROP TABLE#local.dropIfExists# c_o_r_e_posts</cfquery>

Purely cosmetic — happy to merge as-is.

Before merge

  • DCO sign-off — our contribution flow needs every commit to carry Signed-off-by:. Please re-commit with sign-off (e.g. git rebase --signoff develop then force-push the branch). See CONTRIBUTING.md.

ℹ️ Heads-up (not for this PR): the same Oracle-<23 IF EXISTS pattern lives in framework code at vendor/wheels/databaseAdapters/Oracle/OracleMigrator.cfc:96 — we'll patch that separately so migrate down / rollback works on 19c/21c too.

Thanks again for contributing! 🙏

@mikegrogan

Copy link
Copy Markdown
Contributor Author

I actually had a commit like 10 years ago, but it's been a while! Thanks.

@bpamiri
bpamiri merged commit eaaef21 into wheels-dev:develop Jun 6, 2026
10 of 12 checks passed
bpamiri added a commit that referenced this pull request Jun 6, 2026
* fix(migrator): make Oracle DROP TABLE/VIEW work on Oracle <23c

Oracle only added the IF EXISTS DDL modifier in 23c, so OracleMigrator's
dropTable() — which emitted "DROP TABLE IF EXISTS ... CASCADE CONSTRAINTS"
unconditionally — produced a hard parse error (ORA-00933) on 19c/21c. The
remove-table migration template re-throws on error, so the whole migration
failed. dropView() inherited the same IF EXISTS bug from Abstract.

Wrap both in the version-agnostic Oracle PL/SQL idiom that runs the bare
DROP and swallows ORA-00942, preserving "drop if exists" semantics on every
supported Oracle version. $execute never splits on ';' and skips the
trailing-semicolon append for Oracle, so the anonymous block reaches the
driver intact.

Validated on Lucee 7 + SQLite via a new unit spec asserting the generated
SQL (OracleMigratorDropSpec); real-Oracle execution is covered by the
soft-fail Oracle compat-matrix job. Framework-side counterpart to the
demo-app test-populate fix in #2864.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs: add CHANGELOG entry for Oracle <23c migrator DROP fix

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* test(migrator): assert ORA-00942 guard in OracleMigrator dropView spec

Addresses Reviewer A's nit on #2869: the dropView assertions mirror the
dropTable block but omitted the -942 (table/view-does-not-exist) guard check.
Verified 252/0/0 on the migrator bundle (Lucee 7 + SQLite).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

---------

Signed-off-by: Peter Amiri <peter@alurium.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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