Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshmaker/d0ab568a67170b052a982850b32c2882 to your computer and use it in GitHub Desktop.
Save joshmaker/d0ab568a67170b052a982850b32c2882 to your computer and use it in GitHub Desktop.
Task
====
Table Name: task
Columns
-------
id
title: text
description: text
user_id: Foreign key to user who created the event (NULL not allowed)
message_id: Foreign Key to message
event_id: Foreign key to event
due_at: datetime
Relationships
-------------
user
message
event
owners (many-to-many relationship to contacts through task_participants)
listeners (many-to-many relationship to contacts through task_participants)
labels (many-to-many relationship to labels through task_labels)
attachments (many-to-one to task_attachment)
TaskParticipants
=================
Many-to-many relationship between a Task and a Contact
Table Name: task_participants
Columns
-------
id
task_id: FK to task (NULL not allowed)
contact_id: FK to contact (NULL not allowed)
participation_type: text, either "owner" or "listener"
status: text, only these choices allowed: todo, completed, archived, deleted
TaskLabels
==========
Many-to-many relationship
Columns
-------
id
task_id: FK to task (NULL not allowed)
label_id: FK to label (NULL not allowed)
TaskAttachment
==============
Attachments to tasks, extends File class using SQLAlchemy polymorphic inheritance.
(If we add this, should we rename the existing Attachment class to be EmailAttachment?)
Table Name: task_attachment
Columns
-------
id (FK to File id field)
task_id: FK to task (NULL not allowed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment