-
Notifications
You must be signed in to change notification settings - Fork 38
Description
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.
-
Require the Oracle developer to drop these items manually:
queryExecute( "DROP SEQUENCE SEQ_#tableName#" )andqueryExecute( "DROP TRIGGER TRG_#tableName#" ). This is the most straightforward as it requires no extra code inSchemaBuilder. It is not as nice since thetableNameneeds to be repeated. -
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
tableNameand matches the behavior of usingincrements. It also could be a little unexpected. (Not totally unexpected since the user is usingSchemaBuilderin the first place.)
@murpg Your thoughts?