diff options
| author | UMTS at Teleco <crt@teleco.ch> | 2026-01-08 03:05:33 +0100 |
|---|---|---|
| committer | UMTS at Teleco <crt@teleco.ch> | 2026-01-08 03:05:33 +0100 |
| commit | 0c7c41f8586378511633b19d44510318108b2bf7 (patch) | |
| tree | 0cc26e2c4974e3aed474fd1833098f1099ddda29 | |
| parent | 14efd7487c042d0bb707fa793749ce907aa75ec3 (diff) | |
mmm
| -rwxr-xr-x | apply-updates.sh | 2 | ||||
| -rw-r--r-- | backend/database/dev/update_003_make_zone_code_required_unique.sql | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/apply-updates.sh b/apply-updates.sh index ae13767..76c3519 100755 --- a/apply-updates.sh +++ b/apply-updates.sh @@ -70,7 +70,7 @@ if [[ ! -d "$UPDATES_DIR" ]]; then fi # Find update scripts -update_scripts=($(find "$UPDATES_DIR" -name "update_*.sql" | sort)) +update_scripts=($(find "$UPDATES_DIR" -name "update_003*.sql" | sort)) if [[ ${#update_scripts[@]} -eq 0 ]]; then echo "No update scripts found in $UPDATES_DIR." diff --git a/backend/database/dev/update_003_make_zone_code_required_unique.sql b/backend/database/dev/update_003_make_zone_code_required_unique.sql new file mode 100644 index 0000000..08e8896 --- /dev/null +++ b/backend/database/dev/update_003_make_zone_code_required_unique.sql @@ -0,0 +1,8 @@ +-- Make zone_code required and unique +-- This ensures data integrity for audits and lookups + +-- First, modify the column to be NOT NULL +ALTER TABLE `zones` MODIFY `zone_code` VARCHAR(50) NOT NULL; + +-- Then add the unique constraint +ALTER TABLE `zones` ADD UNIQUE KEY `unique_zone_code` (`zone_code`); |
