-- Page Views Table Schema
CREATE TABLE IF NOT EXISTS `page_views` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `page` varchar(255) NOT NULL,
  `timestamp` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `page` (`page`),
  KEY `timestamp` (`timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Add foreign key constraint if user table exists
-- ALTER TABLE `page_views` 
--   ADD CONSTRAINT `page_views_ibfk_1` 
--   FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) 
--   ON DELETE CASCADE; 