-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGeoLite2-Country-CSV.mysql.funnyranks.ini
191 lines (173 loc) · 10.4 KB
/
GeoLite2-Country-CSV.mysql.funnyranks.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
// Configuration file maxmind-geoip2-csv2sql-converter for converting GeoLite2-Country-CSV for MySQL
// Section syntax: Settings: [Settings:key]; Template: [template_name]
// Merge next template line to current: \ on end line; Allowed: \n \r \t; Escaping: \\n \\r \\t
// Escape bracket char \{ or \[section name] if char '{' or section is a part of template
// Comments line: //
// Example template engine syntax:
// Field with getter or method(optional parameters): ${(.|..)fieldWithGetter|method("string param", longParam) key{value} key2{value2}}
// forEach: #{forEach{some text ${collection reference key{value} key2{value2}} ${collection2 reference key3{value3} key4{value4}} some textN} key5{value5} key6{value6}}
[Settings:Import]
locations_filenames=#{forEach{GeoLite2-Country-Locations-${locales..code}.csv} Separator{,}}
ipv4_filename=GeoLite2-Country-Blocks-IPv4.csv
ipv6_filename=GeoLite2-Country-Blocks-IPv6.csv
[Settings:Export]
values_separator=,
values_end=;
values_end_of_file=
values_count_per_insert=
country_create_filename=country_create.sql
country_insert_filename=country_%03d.sql
country_indexes_filename=country_indexes.sql
ipv4_create_filename=ipv4_create.sql
ipv4_insert_filename=ipv4_%03d.sql
ipv4_indexes_filename=ipv4_indexes.sql
ipv6_create_filename=ipv6_create.sql
ipv6_insert_filename=ipv6_%03d.sql
ipv6_indexes_filename=ipv6_indexes.sql
// One of valid geoname_id for ipv4_values/ipv6_values templates from Blocks-IPv4/Blocks-IPv6 files (${.priorityGeonameId} placeholder);
ipblocks_priority_geonameId_groupNames=geoname_id,registered_country_geoname_id,represented_country_geoname_id
log_ignored_locations=false
log_ignored_ipblocks=false
log_undefined_all_geonameIds=true
log_undefined_all_subdivisions_and_city_name=false
schema_name=funnyranks_maxmind_country
load_data_filename=load_data.sql
windows_loader_filename=loader.bat
unix_loader_filename=loader.sh
[load_data]
[windows_loader]
[unix_loader]
[country_create]
CREATE TABLE `country` (
`geoname_id` int unsigned NOT NULL,
//`continent_code` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
//`continent_name_en` varchar(${locationMaxLengths.getOrDefault("continent_name", 31)}) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
// Uncomment one line above and comment one line below, if you need only EN (or yours) continent (add 'en' locale to required argument -l):
//#{forEach{`continent_name_${locales..code}` varchar(${locales..getMaxLengthOrDefault("continent_name", 31)}) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL} Separator{,\n}},
//`iso_code` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`emoji` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
#{forEach{`name_${locales..code}` varchar(${locales..getMaxLengthOrDefault("country_name", 77)}) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL} Separator{,\n}},
//`is_in_european_union` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`geoname_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
[country_indexes]
//ALTER TABLE `country`
//ADD UNIQUE INDEX `country_iso_code_UNIQUE` (`iso_code`);
[country_insert]
insert into country(geoname_id,\//continent_code,\
//continent_name_en,\
// Uncomment one line above and comment one line below, if you need only EN (or yours) continent (add 'en' locale to required argument -l):
//#{forEach{`continent_name_${locales..code}`} Separator{,}},\
//iso_code,
emoji,#{forEach{`name_${locales..code}`} Separator{,}}\
//,is_in_european_union
) values
[country_values]
(${.values.get("geoname_id")},\
//${.values.get("continent_code") Prefix{'} Postfix{'}},\
//${.localeValues.get("en").get("continent_name") Prefix{'} Postfix{'} Escape{[']} Escaper{\\$0}},\
// Uncomment one line above and comment one line below, if you need only EN (or yours) continent (add 'en' locale to required argument -l):
//#{forEach{${.localeValues.values()..get("continent_name") Prefix{'} Postfix{'} Escape{[']} Escaper{\\$0}}} Separator{,}},\
//${.values.get("country_iso_code") Prefix{'} Postfix{'}},
${.emoji Prefix{'} Postfix{'}},\
#{forEach{${.localeValues.values()..get("country_name") Prefix{'} Postfix{'} Escape{[']} Escaper{\\$0}}} Separator{,}}\
//${.values.get("is_in_european_union")}
)
[ipv4_create]
CREATE TABLE `ipv4` (
//`network` varchar(${ipv4MaxLengths.getOrDefault("network", 18)}) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
//`start_ip` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
//`last_ip` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`start_int` int unsigned NOT NULL,
`last_int` int unsigned NOT NULL,
//`start_bin` binary(4) NOT NULL,
//`last_bin` binary(4) NOT NULL,
// Comment line below, if one of valid geoname_id is redundant (from ipblocks_priority_geonameId_groupNames setting)
`v_geoname_id` int unsigned NOT NULL COMMENT 'One of valid geoname_id (from ipblocks_priority_geonameId_groupNames setting)'
//,`geoname_id` int unsigned DEFAULT NULL,
//`registered_country_geoname_id` int unsigned DEFAULT NULL,
//`represented_country_geoname_id` int unsigned DEFAULT NULL,
//`is_anonymous_proxy` tinyint(1) unsigned NOT NULL,
//`is_satellite_provider` tinyint(1) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
[ipv6_create]
//CREATE TABLE `ipv6` (
//`network` varchar(${ipv6MaxLengths.getOrDefault("network", 43)}) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
//`start_ip` varchar(39) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
//`last_ip` varchar(39) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
//`start_int` decimal(39,0) unsigned NOT NULL,
//`last_int` decimal(39,0) unsigned NOT NULL,
//`start_bin` binary(16) NOT NULL,
//`last_bin` binary(16) NOT NULL,
//// Comment line below, if one of valid geoname_id is redundant (from ipblocks_priority_geonameId_groupNames setting)
//`v_geoname_id` int unsigned NOT NULL COMMENT 'One of valid geoname_id (from ipblocks_priority_geonameId_groupNames setting)',
//`geoname_id` int unsigned DEFAULT NULL,
//`registered_country_geoname_id` int unsigned DEFAULT NULL,
//`represented_country_geoname_id` int unsigned DEFAULT NULL,
//`is_anonymous_proxy` tinyint(1) unsigned NOT NULL,
//`is_satellite_provider` tinyint(1) unsigned NOT NULL
//) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
[ipv4_indexes]
ALTER TABLE `ipv4`
ADD UNIQUE INDEX `ipv4_start_int_UNIQUE` (`start_int`),
ADD UNIQUE INDEX `ipv4_last_int_UNIQUE` (`last_int`),
ADD INDEX `ipv4_v_geoname_id_fk_idx` (`v_geoname_id`), // Comment this line, if one of valid geoname_id is redundant (from ipblocks_priority_geonameId_groupNames setting)
// Comment line below, if one of valid geoname_id is redundant (from ipblocks_priority_geonameId_groupNames setting)
ADD CONSTRAINT `ipv4_v_geoname_id_fk` FOREIGN KEY (`v_geoname_id`) REFERENCES `country` (`geoname_id`) ON UPDATE CASCADE ON DELETE RESTRICT;
[ipv6_indexes]
//ALTER TABLE `ipv6`
//ADD UNIQUE INDEX `ipv6_network_UNIQUE` (`network`),
//ADD UNIQUE INDEX `ipv6_start_ip_UNIQUE` (`start_ip`),
//ADD UNIQUE INDEX `ipv6_last_ip_UNIQUE` (`last_ip`),
//ADD UNIQUE INDEX `ipv6_start_int_UNIQUE` (`start_int`),
//ADD UNIQUE INDEX `ipv6_last_int_UNIQUE` (`last_int`),
//ADD UNIQUE INDEX `ipv6_start_bin_UNIQUE` (`start_bin`),
//ADD UNIQUE INDEX `ipv6_last_bin_UNIQUE` (`last_bin`),
//ADD INDEX `ipv6_v_geoname_id_fk_idx` (`v_geoname_id`), // Comment this line, if one of valid geoname_id is redundant (from ipblocks_priority_geonameId_groupNames setting)
//ADD INDEX `ipv6_geoname_id_fk_idx` (`geoname_id`),
//ADD INDEX `ipv6_registered_country_geoname_id_fk_idx` (`registered_country_geoname_id`),
//ADD INDEX `ipv6_represented_country_geoname_id_fk_idx` (`represented_country_geoname_id`),
//// Comment line below, if one of valid geoname_id is redundant (from ipblocks_priority_geonameId_groupNames setting)
//ADD CONSTRAINT `ipv6_v_geoname_id_fk` FOREIGN KEY (`v_geoname_id`) REFERENCES `country` (`geoname_id`) ON UPDATE CASCADE ON DELETE RESTRICT,
//ADD CONSTRAINT `ipv6_geoname_id_fk` FOREIGN KEY (`geoname_id`) REFERENCES `country` (`geoname_id`) ON UPDATE CASCADE ON DELETE RESTRICT,
//ADD CONSTRAINT `ipv6_registered_country_geoname_id_fk` FOREIGN KEY (`registered_country_geoname_id`) REFERENCES `country` (`geoname_id`) ON UPDATE CASCADE ON DELETE RESTRICT,
//ADD CONSTRAINT `ipv6_represented_country_geoname_id_fk` FOREIGN KEY (`represented_country_geoname_id`) REFERENCES `country` (`geoname_id`) ON UPDATE CASCADE ON DELETE RESTRICT;
[ipv4_insert]
insert into ipv4(\//network,\
//start_ip,last_ip,\
start_int,last_int,\
//start_bin,last_bin,\
v_geoname_id\
//,geoname_id,registered_country_geoname_id,represented_country_geoname_id,\
//is_anonymous_proxy,is_satellite_provider
)values
[ipv6_insert]
//insert into ipv6(network,\
//start_ip,last_ip,\
//start_int,last_int,\
//start_bin,last_bin,\
//v_geoname_id,geoname_id,registered_country_geoname_id,represented_country_geoname_id,\
//is_anonymous_proxy,is_satellite_provider)values
[ipv4_values]
(\//${.values.get("network") Prefix{'} Postfix{'} Escape{[']} Escaper{\\$0}},\
//${.range.start() Prefix{'} Postfix{'}},\
//${.range.end() Prefix{'} Postfix{'}},\
${.range.start().asBigInteger()},\
${.range.end().asBigInteger()},\
//0x${.range.start().asBigInteger().toString(16)},\
//0x${.range.end().asBigInteger().toString(16)},\
${.priorityGeonameId}\ // Comment this line, if one of valid geoname_id is redundant (from ipblocks_priority_geonameId_groupNames setting)
//${.values.get("geoname_id")},${.values.get("registered_country_geoname_id")},${.values.get("represented_country_geoname_id")},\
//${.values.get("is_anonymous_proxy")},${.values.get("is_satellite_provider")}
)
[ipv6_values]
//(${.values.get("network") Prefix{'} Postfix{'} Escape{[']} Escaper{\\$0}},\
//${.range.start() Prefix{'} Postfix{'}},\
//${.range.end() Prefix{'} Postfix{'}},\
//${.range.start().asBigInteger()},\
//${.range.end().asBigInteger()},\
//0x${.range.start().asBigInteger().toString(16)},\
//0x${.range.end().asBigInteger().toString(16)},\
//${.priorityGeonameId},\ // Comment this line, if one of valid geoname_id is redundant (from ipblocks_priority_geonameId_groupNames setting)
//${.values.get("geoname_id")},${.values.get("registered_country_geoname_id")},${.values.get("represented_country_geoname_id")},\
//${.values.get("is_anonymous_proxy")},${.values.get("is_satellite_provider")})