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

Clean on embedded derby database does not clean triggers #1085

Closed
khelsen opened this issue Aug 21, 2015 · 1 comment
Closed

Clean on embedded derby database does not clean triggers #1085

khelsen opened this issue Aug 21, 2015 · 1 comment

Comments

@khelsen
Copy link

@khelsen khelsen commented Aug 21, 2015

When calling flyway.clean() from our Java application (on derby embedded db) using the maven Flyway plugin (v3.2.1), we get exceptions telling that there still are triggers depending on tables. It seems thus that the triggers are forgotten in the clean.

Exception:
Operation 'DROP TABLE' cannot be performed on object 'table-name' because TRIGGER 'trigger-name' is dependent on that object.

Example script:

CREATE TABLE TEST (
ID INTEGER NOT NULL,
NAME VARCHAR(128) NOT NULL,
PRIMARY KEY (ID)
);

CREATE TABLE TEST_REFERENCE (
REF_ID INTEGER NOT NULL,
TEST_ID INTEGER NOT NULL,
PRIMARY KEY (REF_ID),
CONSTRAINT FK_TEST_ID FOREIGN KEY (TEST_ID) REFERENCES TEST (ID)
);

CREATE TRIGGER TRG_Del_Test AFTER DELETE ON TEST_REFERENCE
REFERENCING OLD AS EXISTING
FOR EACH ROW MODE DB2SQL
DELETE FROM TEST
WHERE ID = EXISTING.TEST_ID
;

INSERT INTO TEST VALUES (1, 'Test trigger');
INSERT INTO TEST_REFERENCE VALUES (1, 1);

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Oct 27, 2015

Thank you very much. Your sample script was hugely helpful in creating a test for this. Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants