11 lines
546 B
SQL
11 lines
546 B
SQL
CREATE TABLE interactions (
|
|
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
|
contact_id BIGINT UNSIGNED NOT NULL,
|
|
type VARCHAR(50) NOT NULL DEFAULT 'note',
|
|
notes TEXT NULL,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
FOREIGN KEY (contact_id) REFERENCES contacts(id) ON DELETE CASCADE,
|
|
INDEX idx_interactions_contact (contact_id),
|
|
INDEX idx_interactions_type (type)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |