Skip to content

Commit

Permalink
Added a unique index for aegis name to the item tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemongrass3110 committed Jan 6, 2016
1 parent 8ab031f commit 09a8730
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
3 changes: 2 additions & 1 deletion sql-files/item_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ CREATE TABLE `item_db` (
`script` text,
`equip_script` text,
`unequip_script` text,
PRIMARY KEY (`id`)
PRIMARY KEY (`id`),
UNIQUE INDEX `UniqueAegisName` (`name_english`)
) ENGINE=MyISAM;

# Items Database
Expand Down
3 changes: 2 additions & 1 deletion sql-files/item_db2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ CREATE TABLE `item_db2` (
`script` text,
`equip_script` text,
`unequip_script` text,
PRIMARY KEY (`id`)
PRIMARY KEY (`id`),
UNIQUE INDEX `UniqueAegisName` (`name_english`)
) ENGINE=MyISAM;

# Items Additional Database
Expand Down
3 changes: 2 additions & 1 deletion sql-files/item_db2_re.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ CREATE TABLE `item_db2_re` (
`script` text,
`equip_script` text,
`unequip_script` text,
PRIMARY KEY (`id`)
PRIMARY KEY (`id`),
UNIQUE INDEX `UniqueAegisName` (`name_english`)
) ENGINE=MyISAM;

# Items Additional Database
Expand Down
3 changes: 2 additions & 1 deletion sql-files/item_db_re.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ CREATE TABLE `item_db_re` (
`script` text,
`equip_script` text,
`unequip_script` text,
PRIMARY KEY (`id`)
PRIMARY KEY (`id`),
UNIQUE INDEX `UniqueAegisName` (`name_english`)
) ENGINE=MyISAM;

# Items Database
Expand Down
13 changes: 13 additions & 0 deletions sql-files/upgrades/upgrade_20160106.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Please only run those, that you need

ALTER TABLE `item_db`
ADD UNIQUE INDEX `UniqueAegisName` (`name_english`) ;

ALTER TABLE `item_db2`
ADD UNIQUE INDEX `UniqueAegisName` (`name_english`) ;

ALTER TABLE `item_db_re`
ADD UNIQUE INDEX `UniqueAegisName` (`name_english`) ;

ALTER TABLE `item_db2_re`
ADD UNIQUE INDEX `UniqueAegisName` (`name_english`) ;

2 comments on commit 09a8730

@nanakiwurtz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of output will it generate if duplicated names were found?
Apple1, Apple2, Apple3?

@Lemongrass3110
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These constraints block duplicate insertion. So if you try to insert it a second time it gives you a sql error.

Please sign in to comment.