60 Zeilen
2.0 KiB
SQL
60 Zeilen
2.0 KiB
SQL
-- Migration: Remove unused fingerprint columns and tables
|
|
-- Date: 2025-01-13
|
|
-- Description: Removes evolution history, trust score, rotation policy and related unused columns
|
|
|
|
-- Drop unused table
|
|
DROP TABLE IF EXISTS fingerprint_rotation_history;
|
|
|
|
-- Drop unused view
|
|
DROP VIEW IF EXISTS v_account_fingerprints;
|
|
|
|
-- Create temporary table with desired schema
|
|
CREATE TABLE browser_fingerprints_new (
|
|
id TEXT PRIMARY KEY,
|
|
canvas_noise_config TEXT,
|
|
webrtc_config TEXT,
|
|
fonts TEXT,
|
|
hardware_config TEXT,
|
|
navigator_props TEXT,
|
|
webgl_vendor TEXT,
|
|
webgl_renderer TEXT,
|
|
audio_context_config TEXT,
|
|
timezone TEXT,
|
|
timezone_offset INTEGER,
|
|
plugins TEXT,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
last_rotated TIMESTAMP,
|
|
platform_specific TEXT,
|
|
static_components TEXT,
|
|
rotation_seed TEXT,
|
|
account_bound BOOLEAN DEFAULT FALSE
|
|
);
|
|
|
|
-- Copy data from old table (excluding unused columns)
|
|
INSERT INTO browser_fingerprints_new (
|
|
id, canvas_noise_config, webrtc_config, fonts,
|
|
hardware_config, navigator_props, webgl_vendor,
|
|
webgl_renderer, audio_context_config, timezone,
|
|
timezone_offset, plugins, created_at, last_rotated,
|
|
platform_specific, static_components, rotation_seed,
|
|
account_bound
|
|
)
|
|
SELECT
|
|
id, canvas_noise_config, webrtc_config, fonts,
|
|
hardware_config, navigator_props, webgl_vendor,
|
|
webgl_renderer, audio_context_config, timezone,
|
|
timezone_offset, plugins, created_at, last_rotated,
|
|
platform_specific, static_components, rotation_seed,
|
|
account_bound
|
|
FROM browser_fingerprints;
|
|
|
|
-- Drop old table
|
|
DROP TABLE browser_fingerprints;
|
|
|
|
-- Rename new table to original name
|
|
ALTER TABLE browser_fingerprints_new RENAME TO browser_fingerprints;
|
|
|
|
-- Recreate indexes
|
|
CREATE INDEX idx_fingerprints_created ON browser_fingerprints(created_at);
|
|
CREATE INDEX idx_fingerprints_rotated ON browser_fingerprints(last_rotated);
|
|
CREATE INDEX idx_fingerprints_account_bound ON browser_fingerprints(account_bound); |