This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent sdbs with the same slug from being created (#186)
- Loading branch information
Showing
6 changed files
with
46 additions
and
2 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
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
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
13 changes: 13 additions & 0 deletions
13
src/main/resources/com/nike/cerberus/migration/V1.6.5.0__add_sdb_name_slug.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,13 @@ | ||
ALTER TABLE SAFE_DEPOSIT_BOX | ||
ADD COLUMN SDB_NAME_SLUG varchar(255) NOT NULL; | ||
|
||
UPDATE SAFE_DEPOSIT_BOX | ||
JOIN ( | ||
select substr(PATH_TRAILING_PATH_REMOVED, LOCATE('/', PATH_TRAILING_PATH_REMOVED) + 1, LENGTH(PATH_TRAILING_PATH_REMOVED)) as SDB_NAME_SLUG, SDB_ID | ||
from ( | ||
select SUBSTR(PATH, 1, LENGTH(PATH) -1) as PATH_TRAILING_PATH_REMOVED, ID as SDB_ID | ||
from SAFE_DEPOSIT_BOX | ||
) as PATH_TRAILING_PATH_REMOVED_VIRTUAL_TABLE | ||
) as JOINED_VIRTUAL_TABLE on SDB_ID = SAFE_DEPOSIT_BOX.ID | ||
SET SAFE_DEPOSIT_BOX.SDB_NAME_SLUG=(JOINED_VIRTUAL_TABLE.SDB_NAME_SLUG) | ||
WHERE JOINED_VIRTUAL_TABLE.SDB_ID = SAFE_DEPOSIT_BOX.ID; |