-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove default empty project if unused
- Loading branch information
Showing
4 changed files
with
121 additions
and
1 deletion.
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
40 changes: 40 additions & 0 deletions
40
src/main/resources/io/lavagna/db/HSQLDB/V8__REMOVE_DEFAULT_PROJECT_IF_NOT_USED.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,40 @@ | ||
-- | ||
-- This file is part of lavagna. | ||
-- | ||
-- lavagna is free software: you can redistribute it and/or modify | ||
-- it under the terms of the GNU General Public License as published by | ||
-- the Free Software Foundation, either version 3 of the License, or | ||
-- (at your option) any later version. | ||
-- | ||
-- lavagna is distributed in the hope that it will be useful, | ||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
-- GNU General Public License for more details. | ||
-- | ||
-- You should have received a copy of the GNU General Public License | ||
-- along with lavagna. If not, see <http://www.gnu.org/licenses/>. | ||
-- | ||
|
||
DELETE FROM LA_BOARD_COLUMN_DEFINITION WHERE | ||
BOARD_COLUMN_DEFINITION_PROJECT_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_CARD_LABEL_LIST_VALUE WHERE CARD_LABEL_LIST_VALUE_ID IN (SELECT CARD_LABEL_LIST_VALUE_ID FROM LA_CARD_LABEL_LIST_VALUE INNER JOIN | ||
LA_CARD_LABEL ON CARD_LABEL_ID_FK = CARD_LABEL_ID WHERE CARD_LABEL_PROJECT_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT')) AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_CARD_LABEL WHERE | ||
CARD_LABEL_PROJECT_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_PROJECT_ROLE_PERMISSION WHERE | ||
PROJECT_ROLE_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_PROJECT_ROLE WHERE | ||
PROJECT_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_PROJECT WHERE | ||
(PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; |
40 changes: 40 additions & 0 deletions
40
src/main/resources/io/lavagna/db/MYSQL/V8__REMOVE_DEFAULT_PROJECT_IF_NOT_USED.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,40 @@ | ||
-- | ||
-- This file is part of lavagna. | ||
-- | ||
-- lavagna is free software: you can redistribute it and/or modify | ||
-- it under the terms of the GNU General Public License as published by | ||
-- the Free Software Foundation, either version 3 of the License, or | ||
-- (at your option) any later version. | ||
-- | ||
-- lavagna is distributed in the hope that it will be useful, | ||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
-- GNU General Public License for more details. | ||
-- | ||
-- You should have received a copy of the GNU General Public License | ||
-- along with lavagna. If not, see <http://www.gnu.org/licenses/>. | ||
-- | ||
|
||
DELETE FROM LA_BOARD_COLUMN_DEFINITION WHERE | ||
BOARD_COLUMN_DEFINITION_PROJECT_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_CARD_LABEL_LIST_VALUE WHERE CARD_LABEL_LIST_VALUE_ID IN (SELECT * FROM (SELECT CARD_LABEL_LIST_VALUE_ID FROM LA_CARD_LABEL_LIST_VALUE INNER JOIN | ||
LA_CARD_LABEL ON CARD_LABEL_ID_FK = CARD_LABEL_ID WHERE CARD_LABEL_PROJECT_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT')) A) AND | ||
(SELECT COUNT(PROJECT_ID) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_CARD_LABEL WHERE | ||
CARD_LABEL_PROJECT_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_PROJECT_ROLE_PERMISSION WHERE | ||
PROJECT_ROLE_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_PROJECT_ROLE WHERE | ||
PROJECT_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_PROJECT WHERE | ||
(PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT * FROM ((SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT')) A) = 0; |
40 changes: 40 additions & 0 deletions
40
src/main/resources/io/lavagna/db/PGSQL/V8__REMOVE_DEFAULT_PROJECT_IF_NOT_USED.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,40 @@ | ||
-- | ||
-- This file is part of lavagna. | ||
-- | ||
-- lavagna is free software: you can redistribute it and/or modify | ||
-- it under the terms of the GNU General Public License as published by | ||
-- the Free Software Foundation, either version 3 of the License, or | ||
-- (at your option) any later version. | ||
-- | ||
-- lavagna is distributed in the hope that it will be useful, | ||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
-- GNU General Public License for more details. | ||
-- | ||
-- You should have received a copy of the GNU General Public License | ||
-- along with lavagna. If not, see <http://www.gnu.org/licenses/>. | ||
-- | ||
|
||
DELETE FROM LA_BOARD_COLUMN_DEFINITION WHERE | ||
BOARD_COLUMN_DEFINITION_PROJECT_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_CARD_LABEL_LIST_VALUE WHERE CARD_LABEL_LIST_VALUE_ID IN (SELECT CARD_LABEL_LIST_VALUE_ID FROM LA_CARD_LABEL_LIST_VALUE INNER JOIN | ||
LA_CARD_LABEL ON CARD_LABEL_ID_FK = CARD_LABEL_ID WHERE CARD_LABEL_PROJECT_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT')) AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_CARD_LABEL WHERE | ||
CARD_LABEL_PROJECT_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_PROJECT_ROLE_PERMISSION WHERE | ||
PROJECT_ROLE_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_PROJECT_ROLE WHERE | ||
PROJECT_ID_FK = (SELECT PROJECT_ID FROM LA_PROJECT WHERE PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; | ||
|
||
DELETE FROM LA_PROJECT WHERE | ||
(PROJECT_SHORT_NAME = 'DEFAULT') AND | ||
(SELECT COUNT(*) FROM LA_BOARD INNER JOIN LA_PROJECT ON BOARD_PROJECT_ID_FK = PROJECT_ID WHERE PROJECT_SHORT_NAME = 'DEFAULT') = 0; |