Database - COS-301/graduates GitHub Wiki
Stores the tags of a particular company (Web Development company, Technical Support company, Networking Company, IT Security company,Cloud Services, Other). This allows the user to filter based on the tags of a Company on the Company Explore Page.
Field Name | Description | Datatype |
---|---|---|
user_id | Foreign key from the user table, used to identify the company that obtains the tag | CUID |
tag | Type of company - Web Development company, Technical Support company, Networking Company, IT Security company,Cloud Services and Other | String? |
Stores the data of all student shorts
Field Name | Description | Datatype |
---|---|---|
short_id | Primary key, used to uniquely identify the short. | CUID |
user_id | Foreign key from the user table, used to identify the student that posted the short | CUID |
description | Text that is used as to describe the short | String? |
link | Contains the path to the video uploaded on the server | String? |
thumbnail | Contains the path to the thumbnail uploaded on the server | String? |
date_posted | Stores the date and time of the short creation | DateTime |
archived | Indicates whether the short has been archived. Only non-archived shorts are displayed | Boolean |
Stores the data of reported shorts
Field Name | Description | Datatype |
---|---|---|
short_id | Foreign key, used to uniquely identify the short. Forms the Primary key with the user_id | CUID |
user_id | Foreign key from the user table, used to identify the student that reported the short. Forms the Primary key with the short_id | CUID |
reason | Contains the reason for the report | String? |
Stores the data for the tags linked to the short
Field Name | Description | Datatype |
---|---|---|
short_id | Foreign key, used to uniquely identify the short. Forms the Primary key with the tag | CUID |
tag | Stores the tag linked to the short. Forms the Primary key with the short_id | String |
Stores the data of all user notification types.
Field Name | Description | Datatype |
---|---|---|
id | Primary key, used to uniquely identify notification. | CUID |
user_id_to | Foreign key from the user table, used to identify the source(actor) of the notification. (Can be nullable; if null, notification is from the system) | CUID |
user_id_from | Foreign Key from the user table used to identify the destination(notifier) of the notification. | CUID |
data | A JSON Object of varying formats with the relevant information: notification_type, etc. | JSON |
date | Stores the date and time of the notification creation. | DateTime |
seen | Indicates whether the notification has been marked as seen, only unseen notifications will be displayed in the notifications tab. | Boolean |
Stores the data of blog posts.
Field Name | Description | Datatype |
---|---|---|
id | Primary key. Unique ID to identify the blog post | String (cuid) |
user_id | Foreign key from the user table. Unique ID to identify the author of the post | String |
title | The post title to be displayed when viewing | String |
content | The post data | String? |
date | Stores the date and time at which the blog post was created | DateTime |
archived | Indicates whether the post has been archived. Only non-archived blog posts are displayed | Boolean |
Stores the data of comments made on blog posts.
Field Name | Description | Datatype |
---|---|---|
comment_id | Primary Key. Unique ID to identify the comment | String (cuid) |
blog_id | Foreign key from blog table. Used to identify which blog the comment is posted on | String |
user_id | Foreign key from the user table. Used to identify which user posted the comment | String |
content | The comment data | String |
date | Stores the date and time at which the comment was created | DateTime |
Stores information regarding the media used in blog posts.
Field Name | Description | Datatype |
---|---|---|
blog_id | Partial Key. Foreign key from blog table. Used to identify which blog the media is used on | String |
media | Partial Key. Identifies the filename of the media | String |
Document revision: 1.1
Last modified: 2022/03/12
Snake case (stylized as snake_case) refers to the style of writing in which each space is replaced by an underscore (_) character and the first letter of each word written in lowercase.
snake_case is used for all names unless specifically stated otherwise in this document for a given naming condition/style.
Additionally abbreviations which are all capital must be considered as lower case words when applying the snake_case rules.
1.1.1 Examples
Original text | Snake case |
Red Riding Hood | red_riding_hood |
An HTML file | an_html_file |
DBM XML | dbm_xml |
1.1.2 Exceptions
The general conventions for name construction must be followed except where the standard defines a different naming convention.
Constants are written with all Uppercase letters but are still separated by an underscore.
Spelling mistakes are not acceptable; when in doubt, check a dictionary, use a spell-checker, or ask someone knowledgeable.
Be consistent throughout a document. Do not mix British and US English within a single document. Always set your spellchecker accordingly.
Names of variables, functions, types, files, and directories must be meaningful and descriptive.
Abbreviations may be used if it is commonly recognized.
Longer names are preferred above short unclear names.
Name source files following the convention defined in the table below.
File type | Name template | Example |
sql | [name].sql | user_profile.sql |
All sql files must be contained in a single directory unless stated otherwise.
There may never be two files with the same name, even if they are in separate directories.
File names must start with the most general use and end with the most specific use.
1.4.1 Example
truck_payload_volume
user_profile_information
Doxygen comment blocks must start with /*! and end with */. Every line in-between must start with a left-aligned *. Doxygen commands and text must be indented with one tab space. Tab aligns the arguments that follow the Doxygen commands. You may also start a new paragraph (blank line) starting with * to add a detailed description, alternatively use the @details command. Also, leave blank lines for paragraph breaks. The first line must be a brief description starting with @brief.
Doxygen single-line comments must start with a //! followed by a space.
Doxygen single-line comments must start with a //! followed by a space.
Start each file with the path from the project's directory to the file using forward slashes. On the next line supply the copyright notice.
1.5.2.1 Example
// Path/To/File.sql
// Copyrighted (C) 2022 University Of Pretoria
// TODO: [name surname] description
// FIXME: [name surname] description
Code or comments are not allowed to go off-screen for a standard 1920x1080p monitor unless otherwise stated or it breaks convention.
Schema names follow the general naming convention and must be descriptive and meaningful.
All schemas should be contained in a single directory unless stated otherwise by another more recognized convention.
CUID’s will be used for identifying records.
Collision-resistant ids optimized for horizontal scaling and binary search lookup performance.
cuid() returns a short random string with some collision-busting measures. Safe to use as HTML element ID's, and unique server-side record lookups.
All parameters must be aligned if they are on separate lines.
Function and variable names follow the general naming convention and must be descriptive and meaningful.
Function names follow the general naming convention and must be descriptive and meaningful.
There must be no space between the function name and the opening parenthesis.
Leading and trailing spaces inside the parentheses are not allowed.
The return type must always be on the same line as the function name.
Global functions should start with an uppercase letter and still follow snake case conventions for the rest of the name.
Local functions should start with a lowercase letter and still follow snake case conventions for the rest of the name.
Curly braces must appear on a line by themselves and line up with each other and the control structure keyword to which they belong.
A tab spacing of 4 must be used for indentation. Tabs must use the tab character and not spaces. Text editors must be set up appropriately so that tabs are handled correctly as most editors allow both options and the text editor defaults may not use the tab character.
When formatting expressions that contain operators (e.g. +, -, <, =, etc), there must be spaces between all binary operators and their arguments and no space between a unary operator and its argument.
3.2.3.1 Examples
x = 0;
4 * ((x + y) + (z - 5));
All related data in a relation should be in columns separated by tab characters.
All keywords should be uppercase and at the start of a new line.
The keyword ‘AS’.
All relation aliases should be descriptive and prefixed with the relation they originate from.