# favourite

0 rows

### Description

Stores the relationship between an arbitrary item (itemtype, itemid), and a context area (component, contextid) for a specific user. Used by the favourites subsystem.

### Columns

Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments
--- | --- | --- | --- | --- | --- | --- | --- | ---
id | BIGINT | 19 |  | √ | null |  |  |
component | VARCHAR | 100 |  |  |  |  |  | Defines the Moodle component in which the favourite was created.
itemtype | VARCHAR | 100 |  |  |  |  |  | The type of the item which is being favourited. Usually a table name, but doesn't have to be. E.g. 'messages' or 'message_conversations'.
itemid | BIGINT | 19 |  |  | null |  |  | The identifier of the item which is being favourited.
contextid | BIGINT | 19 |  |  | null |  |
context.id | favo_con2_fkR
| The context id of the item being favourited
userid | BIGINT | 19 |  |  | null |  |
user.id | favo_use2_fkR
| The id of the user to whom the favourite belongs
ordering | BIGINT | 19 | √ |  | null |  |  | Optional ordering of the favourite within its context area. For example, this allows things like sorting favourite message conversations.
timecreated | BIGINT | 19 |  |  | null |  |  | Creation time
timemodified | BIGINT | 19 |  |  | null |  |  | Last modification time

### Indexes

Constraint Name | Type | Sort | Column(s)
--- | --- | --- | ---
PRIMARY | Primary key | Asc | id
favo_comiteiteconuse_uix | Must be unique | Asc/Asc/Asc/Asc/Asc | component + itemtype + itemid + contextid + userid
favo_con_ix | Performance | Asc | contextid
favo_use_ix | Performance | Asc | userid

### Relationships