umami/prisma/migrations
iskandarsulaili 5cf1e0c16a feat: Add user ID mapping migration for WordPress integration
Added Prisma migration to support user identification:

1. Session Table Enhancement
   - Added user_id column (VARCHAR(36)) to session table
   - Stores WordPress user ID for logged-in users
   - Indexed for efficient lookups

2. User Mapping Table
   - New table to track visitor_id to user_id relationships
   - Maps anonymous visitors to authenticated users
   - Tracks first_seen_at, last_seen_at, and session_count
   - Unique constraint on (visitor_id, user_id) pair

3. Indexes
   - idx_session_user_id - Fast user_id lookups
   - idx_session_visitor_user - Composite index for visitor+user queries
   - idx_user_mapping_visitor - Visitor ID lookups
   - idx_user_mapping_user - User ID lookups
   - idx_user_mapping_last_seen - Time-based queries

This migration enables unified user tracking across anonymous and authenticated sessions, supporting the WordPress plugin's user identification feature.
2025-11-06 19:53:33 +08:00
..
01_init New schema for pixels and links. 2025-08-13 20:27:54 -07:00
02_report_schema_session_data New schema for pixels and links. 2025-08-13 20:27:54 -07:00
03_metric_performance_index New schema for pixels and links. 2025-08-13 20:27:54 -07:00
04_team_redesign New schema for pixels and links. 2025-08-13 20:27:54 -07:00
05_add_visit_id New schema for pixels and links. 2025-08-13 20:27:54 -07:00
06_session_data New schema for pixels and links. 2025-08-13 20:27:54 -07:00
07_add_tag New schema for pixels and links. 2025-08-13 20:27:54 -07:00
08_add_utm_clid New schema for pixels and links. 2025-08-13 20:27:54 -07:00
09_update_hostname_region New schema for pixels and links. 2025-08-13 20:27:54 -07:00
10_add_distinct_id New schema for pixels and links. 2025-08-13 20:27:54 -07:00
11_add_segment New schema for pixels and links. 2025-08-13 20:27:54 -07:00
12_update_report_parameter New schema for pixels and links. 2025-08-13 20:27:54 -07:00
13_add_revenue New schema for pixels and links. 2025-08-13 20:27:54 -07:00
14_add_link_and_pixel clean up funnel migration and report errors 2025-09-10 16:38:51 -07:00
15_add_woocommerce_fields feat: integrate First8 Marketing hyper-personalization system 2025-11-05 19:17:57 +08:00
16_create_recommendation_tables feat: integrate First8 Marketing hyper-personalization system 2025-11-05 19:17:57 +08:00
17_setup_apache_age feat: integrate First8 Marketing hyper-personalization system 2025-11-05 19:17:57 +08:00
18_setup_timescaledb feat: integrate First8 Marketing hyper-personalization system 2025-11-05 19:17:57 +08:00
19_add_user_id_mapping feat: Add user ID mapping migration for WordPress integration 2025-11-06 19:53:33 +08:00
migration_lock.toml New schema for pixels and links. 2025-08-13 20:27:54 -07:00