Commit graph

15 commits

Author SHA1 Message Date
iskandarsulaili
7c1db78050 feat: Add UserMapping constraints and schema improvements
## Database Schema Enhancements

### Migration 19 - Fixed
- Removed invalid composite index on session(visitor_id, user_id)
- visitor_id column doesn't exist in session table
- Fixed migration to only create valid indexes

### Migration 20 - New Constraints (with rollback support)
- Added websiteId foreign key to UserMapping table
- Added foreign key constraint to Website table for referential integrity
- Added composite index on UserMapping(websiteId, userId) for query performance
- Added composite index on Session(websiteId, userId) for join optimization

### Schema Updates
- Updated UserMapping model with websiteId field
- Added foreign key relationship: UserMapping -> Website
- Added userMappings relation to Website model
- Added composite indexes for better query performance

## Files Changed

### Modified
- prisma/schema.prisma - Added foreign keys and composite indexes
- prisma/migrations/19_add_user_id_mapping/migration.sql - Fixed invalid index

### New
- prisma/migrations/20_add_user_mapping_constraints/migration.sql - Forward migration
- prisma/migrations/20_add_user_mapping_constraints/rollback.sql - Rollback script

## Benefits
-  Referential integrity enforced at database level
-  Optimized queries for Umami sync operations
-  Better join performance on Session table
-  Rollback capability for safe schema changes

## Breaking Changes
- UserMapping table now requires websiteId field
- Existing data will be migrated to use first available website_id

## Migration Notes
Run the migration with:
```bash
npx prisma migrate deploy
```

To rollback if needed:
```bash
psql -d umami -f prisma/migrations/20_add_user_mapping_constraints/rollback.sql
```
2025-11-06 22:04:57 +08:00
iskandarsulaili
5f496fdb79 feat: integrate First8 Marketing hyper-personalization system
Enhanced Umami Analytics with First8 Marketing integration for
hyper-personalized recommendation engine.

Database Enhancements:
- PostgreSQL 17 with Apache AGE 1.6.0 (graph database)
- TimescaleDB 2.23.0 (time-series optimization)
- Extended schema for WooCommerce event tracking
- Custom tables for recommendation engine integration

Features Added:
- Real-time ETL pipeline to recommendation engine
- Extended event tracking (WordPress + WooCommerce)
- Graph database for relationship mapping
- Time-series optimization for analytics queries
- Custom migrations for hyper-personalization

Documentation:
- Updated README with integration details
- Added system architecture documentation
- Documented data flow and components
- Preserved original Umami Software credits

Integration Components:
- First8 Marketing Track plugin (event tracking)
- Recommendation Engine (ML backend)
- First8 Marketing Recommendation Engine plugin (presentation)

Status: Production-ready
Version: Based on Umami latest + First8 Marketing enhancements
2025-11-05 19:17:57 +08:00
Mike Cao
67105f2cff Updated packages. 2025-09-10 17:16:04 -07:00
Mike Cao
3c5c1e48e9 Refactored settings. Updated sidebar. 2025-08-15 22:16:28 -07:00
Mike Cao
eabdd18604 Updated Prisma build. 2025-08-15 12:29:33 -07:00
Mike Cao
88639dfe83 New schema for pixels and links. 2025-08-13 20:27:54 -07:00
Mike Cao
585706cc16 Fix css issue. 2020-08-13 00:29:07 -07:00
Mike Cao
000f84df96 Rename website column. Table component. 2020-08-06 23:02:24 -07:00
Mike Cao
e17c9da3d5 Added device collection. 2020-08-06 19:14:44 -07:00
Mike Cao
0f0b1e39e7 Build cli using rollup. 2020-07-24 17:00:56 -07:00
Mike Cao
cb0c912c5b Switch to json web tokens. 2020-07-22 20:45:09 -07:00
Mike Cao
d8c8df2955 Updated schema. 2020-07-18 23:54:25 -07:00
Mike Cao
58a1c63407 Added CORS middleware. Updated umami script. 2020-07-18 10:36:46 -07:00
Mike Cao
c681441601 Add indexes to tables. 2020-07-17 19:33:40 -07:00
Mike Cao
f7f0c05e12 Initial commit. 2020-07-17 01:03:38 -07:00