Search code examples
sql-server-2008database-design

Verify and/or Recommend Re Database Design for an Internal Admin Chat System


I'm implementing an internal chat system for our admins to use.

What can you verify and/or recommend?

Employees {
    EmployeeId (smallint)
    // ...
}

Chat {
    ChatId (int)
    Stamp (datetime) // Obsolete, ignore...
}

ChatEmployees {
    ChatEmployeeId (int) // Or bigint?
    ChatId (int) -> Chat.ChatId
    EmployeeId (smallint) -> Employees.EmployeeId
}

Messages {
    MessageId (int) // Or bigint?
    AuthorId (smallint) -> Employees.EmployeeId
    ChatId (int) -> Chat.ChatId
    Text (varchar(512))
    Stamp (datetime)
}

The application interacting with the database is built with ASP.NET MVC 2 and LINQ to SQL.


Solution

  • The ChatEmployees table seems kind of redundant. Unless you need to record that someone was in a chat but never said anything I'd drop it.

    Re: Message.text
    I think "text" might be a reserved word as it is used as a datatype in SQL. Might want to avoid that name.

    Also, varchar 512 seems like kind of an arbitrary number of characters to allow for a message, why the odd number? Are you picking it just because it is a power of 2 for some reason?