Add countries/install/tables.sql

This commit is contained in:
git 2025-06-19 13:28:02 +01:00
commit 3a89a98ea5

View File

@ -0,0 +1,26 @@
-- Table: country_codes
CREATE TABLE `country_codes` (
`iso_3166_alpha2` CHAR(2) NOT NULL,
PRIMARY KEY (`iso_3166_alpha2`)
) ENGINE=InnoDB
DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_unicode_ci;
-- Table: country_networks
CREATE TABLE `country_networks` (
`ip_country` CHAR(2) NOT NULL,
`ip_network` VARCHAR(15) NOT NULL,
`ip_network_bitmask` TINYINT UNSIGNED NOT NULL,
PRIMARY KEY (
`ip_country`,
`ip_network`,
`ip_network_bitmask`
),
CONSTRAINT `fk_country_networks_country_codes`
FOREIGN KEY (`ip_country`)
REFERENCES `country_codes` (`iso_3166_alpha2`)
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE=InnoDB
DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_unicode_ci;