Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Axel Fontaine
committed
Oct 27, 2015
1 parent
9d73922
commit f96a36b
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
flyway-core/src/test/resources/migration/dbsupport/derby/sql/trigger/V1__Trigger.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
-- | ||
-- Copyright 2010-2015 Axel Fontaine | ||
-- | ||
-- Licensed under the Apache License, Version 2.0 (the "License"); | ||
-- you may not use this file except in compliance with the License. | ||
-- You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
-- | ||
|
||
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); |