Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update oracledb.ts #5331

Merged
merged 1 commit into from
Apr 28, 2021
Merged

Update oracledb.ts #5331

merged 1 commit into from
Apr 28, 2021

Conversation

aidenfoxx
Copy link
Contributor

@aidenfoxx aidenfoxx commented Apr 28, 2021

As explained in the code comment, Oracle doesn't return AUTO_INCREMENT, causing authorization.ts to throw a error because it doesn't know primary keys are AUTO_INCREMENT.

This was the last fix required to get things running with Oracle 19c (with a few minor issues).

As explained in the code comment, Oracle doesn't return "AUTO_INCREMENT", causing `authorization.ts` to throw a error that primary keys are required values.
@rijkvanzanten
Copy link
Member

@aidenfoxx How did this migration go on your end?

For me, on Oracle 18, it's throwing an error not being able to change a varchar to a clob..

Error: alter table "directus_webhooks" modify "url" clob - ORA-22858: invalid alteration of datatype

@rijkvanzanten rijkvanzanten merged commit da826e2 into directus:main Apr 28, 2021
@rijkvanzanten rijkvanzanten added this to the v9.0.0-rc.62 milestone Apr 28, 2021
@aidenfoxx
Copy link
Contributor Author

aidenfoxx commented Apr 28, 2021

@rijkvanzanten Ah yes, about those... I manually patched out lines:

20201105B-change-webhook-url-type.js:16
20210312A-webhooks-collections-text.js:16

Oracle apparently doesn't like changing VARCHAR2 to CLOB.

If you're trying to get everything running with Oracle, you'll also have to patch knex-schema-inspector. The schema query it uses was very broken for Oracle. I'm gonna create a PR for that tomorrow, but I've attached the patched file here if you want to try it. Just replace the dialects/oracledb.ts and build.

oracledb.ts.zip

@rijkvanzanten
Copy link
Member

Oracle apparently doesn't like changing VARCHAR2 to CLOB.

I'm wondering if that's something we can fix in Knex itself, or if we should rework those migrations to:

  • create a new column with text
  • copy all content
  • remove old column
  • rename new column to old name

@aidenfoxx
Copy link
Contributor Author

aidenfoxx commented Apr 28, 2021

That would be the nice way to go. Fudging the migrations might be a workaround too, but it doesn't fix the underlying issue.

If might be worth wrapping those two problematic migrations in an if (adapter != 'oracledb') until knex is fixed.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants