38873-vm/db/migrations/07_startup_followers.sql
Flatlogic Bot 3b76e4ec5b v9
2026-02-28 17:01:09 +00:00

11 lines
427 B
SQL

-- Migration: Add startup_followers table
CREATE TABLE IF NOT EXISTS startup_followers (
id INT AUTO_INCREMENT PRIMARY KEY,
startup_id INT NOT NULL,
user_id INT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY unique_follow (startup_id, user_id),
FOREIGN KEY (startup_id) REFERENCES startups(id) ON DELETE CASCADE,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);