Objective
Create a comprehensive archive for corporate communications including executive messages, company announcements, town halls, and internal memos with full-text search and multimedia support.
Step 1: Create Communication Types Table
Define communication categories.
CREATE TABLE communication_types (
id INTEGER PRIMARY KEY,
type_code VARCHAR(50) NOT NULL UNIQUE,
type_name VARCHAR(100),
description TEXT,
requires_approval BOOLEAN DEFAULT TRUE,
retention_years INTEGER DEFAULT 7,
is_active BOOLEAN DEFAULT TRUE
);
Step 2: Create Communications Table
Store communication records.
CREATE TABLE corporate_communications (
id INTEGER PRIMARY KEY,
comm_id VARCHAR(50) NOT NULL UNIQUE,
type_id INTEGER NOT NULL,
title VARCHAR(300) NOT NULL,
summary TEXT,
full_content TEXT,
author_id VARCHAR(50),
author_name VARCHAR(200),
author_title VARCHAR(100),
department VARCHAR(100),
target_audience TEXT,
priority VARCHAR(20) DEFAULT 'normal',
status VARCHAR(50) DEFAULT 'draft',
published_at TIMESTAMP,
expires_at TIMESTAMP,
view_count INTEGER DEFAULT 0,
is_pinned BOOLEAN DEFAULT FALSE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP,
FOREIGN KEY (type_id) REFERENCES communication_types(id)
);
Step 3: Create Communication Attachments Table
Store attached media.
CREATE TABLE comm_attachments (
id INTEGER PRIMARY KEY,
comm_id INTEGER NOT NULL,
attachment_type VARCHAR(50),
file_name VARCHAR(255),
document_file PDF,
video_file VIDEO(MP4),
audio_file AUDIO(MP3),
image_file IMAGE(JPEG),
file_size_mb DECIMAL(10, 2),
duration_seconds INTEGER,
page_count INTEGER,
upload_order INTEGER,
uploaded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (comm_id) REFERENCES corporate_communications(id)
);
Step 4: Create Town Halls Table
Track company meetings.
CREATE TABLE town_hall_meetings (
id INTEGER PRIMARY KEY,
meeting_id VARCHAR(50) NOT NULL UNIQUE,
title VARCHAR(300),
description TEXT,
meeting_date DATE,
start_time TIME,
duration_minutes INTEGER,
location VARCHAR(200),
is_virtual BOOLEAN DEFAULT TRUE,
recording VIDEO(MP4),
presentation_slides PDF,
transcript TEXT,
attendee_count INTEGER,
host_name VARCHAR(200),
status VARCHAR(50) DEFAULT 'scheduled',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Step 5: Create Q&A Sessions Table
Store Q&A from town halls.
CREATE TABLE town_hall_qa (
id INTEGER PRIMARY KEY,
meeting_id INTEGER NOT NULL,
question_text TEXT,
question_submitted_by VARCHAR(200),
question_department VARCHAR(100),
answer_text TEXT,
answered_by VARCHAR(200),
timestamp_seconds INTEGER,
is_answered BOOLEAN DEFAULT FALSE,
is_featured BOOLEAN DEFAULT FALSE,
upvote_count INTEGER DEFAULT 0,
FOREIGN KEY (meeting_id) REFERENCES town_hall_meetings(id)
);
Step 6: Create Communication Read Receipts Table
Track readership.
CREATE TABLE comm_read_receipts (
id INTEGER PRIMARY KEY,
comm_id INTEGER NOT NULL,
user_id VARCHAR(50),
user_name VARCHAR(200),
user_department VARCHAR(100),
read_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
time_spent_seconds INTEGER,
FOREIGN KEY (comm_id) REFERENCES corporate_communications(id)
);
Step 7: Insert Communication Types
Add categories.
INSERT INTO communication_types (id, type_code, type_name, description, requires_approval, retention_years) VALUES
(1, 'CEO-MSG', 'CEO Message', 'Direct communications from the CEO', TRUE, 10),
(2, 'EXEC-MEMO', 'Executive Memo', 'Communications from executive leadership', TRUE, 7),
(3, 'HR-ANN', 'HR Announcement', 'Human resources announcements', TRUE, 5),
(4, 'POLICY', 'Policy Update', 'Company policy changes', TRUE, 10),
(5, 'NEWS', 'Company News', 'General company news and updates', TRUE, 5),
(6, 'PRODUCT', 'Product Update', 'Product launch and update announcements', TRUE, 5),
(7, 'AWARD', 'Recognition', 'Employee recognition and awards', FALSE, 3),
(8, 'EVENT', 'Event Announcement', 'Company events and activities', FALSE, 2);
Step 8: Insert Sample Communications
Add archived communications.
INSERT INTO corporate_communications (id, comm_id, type_id, title, summary, full_content, author_id, author_name, author_title, department, target_audience, priority, status, published_at, view_count, is_pinned) VALUES
(1, 'COMM-2024-001', 1, 'New Year Message from CEO', 'Looking back at 2023 and ahead to 2024', 'Dear Team, As we begin 2024, I want to reflect on our incredible journey...', 'CEO-001', 'John Smith', 'Chief Executive Officer', 'Executive', 'All Employees', 'high', 'published', '2024-01-02 09:00:00', 2450, TRUE),
(2, 'COMM-2024-002', 3, 'Updated Benefits Package for 2024', 'Summary of changes to employee benefits', 'We are pleased to announce enhancements to our benefits program...', 'HR-001', 'Sarah Johnson', 'VP of Human Resources', 'Human Resources', 'All Employees', 'high', 'published', '2024-01-05 10:00:00', 2180, TRUE),
(3, 'COMM-2024-003', 4, 'Remote Work Policy Update', 'Clarifications to our hybrid work policy', 'Following employee feedback, we are updating our remote work guidelines...', 'HR-002', 'Mike Williams', 'HR Director', 'Human Resources', 'All Employees', 'normal', 'published', '2024-01-10 14:00:00', 1890, FALSE),
(4, 'COMM-2024-004', 6, 'Introducing Product X 2.0', 'Major product update announcement', 'We are excited to announce the launch of Product X 2.0...', 'PROD-001', 'Emily Chen', 'VP of Product', 'Product', 'All Employees', 'normal', 'published', '2024-01-15 11:00:00', 1250, FALSE),
(5, 'COMM-2024-005', 5, 'Q4 2023 Results Summary', 'Financial performance highlights', 'Q4 2023 was our strongest quarter yet...', 'CFO-001', 'Robert Brown', 'Chief Financial Officer', 'Finance', 'All Employees', 'normal', 'published', '2024-01-20 09:00:00', 1680, FALSE),
(6, 'COMM-2024-006', 7, 'Employee of the Month - January', 'Recognizing outstanding performance', 'Please join us in congratulating...', 'HR-001', 'Sarah Johnson', 'VP of Human Resources', 'Human Resources', 'All Employees', 'normal', 'published', '2024-01-25 10:00:00', 980, FALSE);