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

drop in Oracle needs to check for associated sequences and triggers #262

Open
elpete opened this issue Jul 17, 2023 · 1 comment
Open

drop in Oracle needs to check for associated sequences and triggers #262

elpete opened this issue Jul 17, 2023 · 1 comment

Comments

@elpete
Copy link
Collaborator

elpete commented Jul 17, 2023

Creating a table with an increments column in Oracle is tricky. Oracle doesn't have any idea of IDENTITY or AUTO_INCREMENT, so instead we use a NUMBER as the column type and create an associated sequence and trigger. This works, but the sequence and trigger are completely separate entities; they are not tied to the table. So when we drop the table, the sequence and trigger stay around.

We can drop the sequence and triggers using the same naming convention as when we create them. Unfortunately, SchemaBuilder does not know if we created the table using an increments column when calling drop.

So, I have two ideas on fixing this.

  1. Require the Oracle developer to drop these items manually: queryExecute( "DROP SEQUENCE SEQ_#tableName#" ) and queryExecute( "DROP TRIGGER TRG_#tableName#" ). This is the most straightforward as it requires no extra code in SchemaBuilder. It is not as nice since the tableName needs to be repeated.

  2. Check if a sequence and/or a trigger exists using the naming convention and drop it if it does. This takes out the repeating of tableName and matches the behavior of using increments. It also could be a little unexpected. (Not totally unexpected since the user is using SchemaBuilder in the first place.)

@murpg Your thoughts?

@murpg
Copy link
Contributor

murpg commented Jul 18, 2023 via email

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

No branches or pull requests

2 participants