update webapp
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
CREATE DATABASE IF NOT EXISTS geofeed_manager;
|
||||
USE geofeed_manager;
|
||||
|
||||
-- Main geofeed entries table
|
||||
-- Main geofeed entries table with IP enrichment data
|
||||
CREATE TABLE IF NOT EXISTS geofeed_entries (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
ip_prefix VARCHAR(50) NOT NULL,
|
||||
@@ -14,13 +14,44 @@ CREATE TABLE IF NOT EXISTS geofeed_entries (
|
||||
postal_code VARCHAR(50) DEFAULT NULL,
|
||||
client_short_name VARCHAR(100) DEFAULT NULL,
|
||||
notes TEXT DEFAULT NULL,
|
||||
sort_order INT DEFAULT 0,
|
||||
|
||||
-- IP Registry enrichment data
|
||||
ipr_enriched_at TIMESTAMP NULL DEFAULT NULL,
|
||||
ipr_isp VARCHAR(255) DEFAULT NULL,
|
||||
ipr_org VARCHAR(255) DEFAULT NULL,
|
||||
ipr_asn INT DEFAULT NULL,
|
||||
ipr_asn_name VARCHAR(255) DEFAULT NULL,
|
||||
ipr_connection_type VARCHAR(50) DEFAULT NULL,
|
||||
ipr_country_name VARCHAR(100) DEFAULT NULL,
|
||||
ipr_region_name VARCHAR(100) DEFAULT NULL,
|
||||
ipr_timezone VARCHAR(100) DEFAULT NULL,
|
||||
ipr_latitude DECIMAL(10, 7) DEFAULT NULL,
|
||||
ipr_longitude DECIMAL(10, 7) DEFAULT NULL,
|
||||
|
||||
-- Security flags from IP Registry
|
||||
flag_abuser TINYINT(1) DEFAULT 0,
|
||||
flag_attacker TINYINT(1) DEFAULT 0,
|
||||
flag_bogon TINYINT(1) DEFAULT 0,
|
||||
flag_cloud_provider TINYINT(1) DEFAULT 0,
|
||||
flag_proxy TINYINT(1) DEFAULT 0,
|
||||
flag_relay TINYINT(1) DEFAULT 0,
|
||||
flag_tor TINYINT(1) DEFAULT 0,
|
||||
flag_tor_exit TINYINT(1) DEFAULT 0,
|
||||
flag_vpn TINYINT(1) DEFAULT 0,
|
||||
flag_anonymous TINYINT(1) DEFAULT 0,
|
||||
flag_threat TINYINT(1) DEFAULT 0,
|
||||
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
UNIQUE KEY unique_prefix (ip_prefix),
|
||||
INDEX idx_country (country_code),
|
||||
INDEX idx_region (region_code),
|
||||
INDEX idx_city (city),
|
||||
INDEX idx_client (client_short_name)
|
||||
INDEX idx_client (client_short_name),
|
||||
INDEX idx_sort_order (sort_order),
|
||||
INDEX idx_isp (ipr_isp),
|
||||
INDEX idx_asn (ipr_asn)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- Audit log for tracking changes
|
||||
@@ -71,6 +102,19 @@ CREATE TABLE IF NOT EXISTS webhook_queue (
|
||||
INDEX idx_scheduled (scheduled_for)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- User sessions table for authentication
|
||||
CREATE TABLE IF NOT EXISTS user_sessions (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
session_token VARCHAR(64) NOT NULL,
|
||||
username VARCHAR(100) NOT NULL,
|
||||
ip_address VARCHAR(45) DEFAULT NULL,
|
||||
user_agent TEXT DEFAULT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
expires_at TIMESTAMP NOT NULL,
|
||||
UNIQUE KEY unique_token (session_token),
|
||||
INDEX idx_expires (expires_at)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- Insert default settings
|
||||
INSERT INTO geofeed_settings (setting_key, setting_value) VALUES
|
||||
('bunny_cdn_storage_zone', ''),
|
||||
@@ -79,5 +123,7 @@ INSERT INTO geofeed_settings (setting_key, setting_value) VALUES
|
||||
('last_export_at', NULL),
|
||||
('n8n_webhook_url', ''),
|
||||
('n8n_webhook_enabled', '0'),
|
||||
('n8n_webhook_delay_minutes', '3')
|
||||
('n8n_webhook_delay_minutes', '3'),
|
||||
('ipregistry_api_key', ''),
|
||||
('ipregistry_enabled', '0')
|
||||
ON DUPLICATE KEY UPDATE setting_key = setting_key;
|
||||
|
||||
Reference in New Issue
Block a user