You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it happens in both version 3.0.16 and 4, with Oracle.
when you run ./ace migration:run more than once, following errors shown:
Error: DECLARE PK_NAME VARCHAR(200); BEGIN EXECUTE IMMEDIATE ('CREATE SEQUENCE "adonis_schema_seq"'); SELECT cols.column_name INTO PK_NAME FROM all_constraints cons, all_cons_columns cols WHERE cons.constraint_type = 'P' AND cons.constraint_name = cols.constraint_name AND cons.owner = cols.owner AND cols.table_name = 'adonis_schema'; execute immediate ('create or replace trigger "adonis_schema_autoinc_trg" BEFORE INSERT on "adonis_schema" for each row declare checking number := 1; begin if (:new."' || PK_NAME || '" is null) then while checking >= 1 loop select "adonis_schema_seq".nextval into :new."' || PK_NAME || '" from dual; select count("' || PK_NAME || '") into checking from "adonis_schema" where "' || PK_NAME || '" = :new."' || PK_NAME || '"; end loop; end if; end;'); END; - ORA-00955: name is already used by an existing object
ORA-06512: at line 1
More Info
it is actually because knex #createTableIfNotExists is actually trying to create sequence even if the table exist already.
the contributors are still discussing, some said it is the indented behaviour, some said no: knex/knex#1303
Error
it happens in both version 3.0.16 and 4, with Oracle.
when you run ./ace migration:run more than once, following errors shown:
Error: DECLARE PK_NAME VARCHAR(200); BEGIN EXECUTE IMMEDIATE ('CREATE SEQUENCE "adonis_schema_seq"'); SELECT cols.column_name INTO PK_NAME FROM all_constraints cons, all_cons_columns cols WHERE cons.constraint_type = 'P' AND cons.constraint_name = cols.constraint_name AND cons.owner = cols.owner AND cols.table_name = 'adonis_schema'; execute immediate ('create or replace trigger "adonis_schema_autoinc_trg" BEFORE INSERT on "adonis_schema" for each row declare checking number := 1; begin if (:new."' || PK_NAME || '" is null) then while checking >= 1 loop select "adonis_schema_seq".nextval into :new."' || PK_NAME || '" from dual; select count("' || PK_NAME || '") into checking from "adonis_schema" where "' || PK_NAME || '" = :new."' || PK_NAME || '"; end loop; end if; end;'); END; - ORA-00955: name is already used by an existing object ORA-06512: at line 1
More Info
it is actually because knex #createTableIfNotExists is actually trying to create sequence even if the table exist already.
the contributors are still discussing, some said it is the indented behaviour, some said no:
knex/knex#1303
Proposed fix / change
change https://github.com/adonisjs/adonis-lucid/blob/develop/src/Migration/index.js#L46 to use hasTable and createTable separately. For example:
The text was updated successfully, but these errors were encountered: