# block_instances

View table data

0 rows

### Description

This table stores block instances. The type of block this is is given by the blockname column. The places this block instance appears is controlled by the parentcontexid, showinsubcontexts, pagetypepattern and subpagepattern fields. Where the block appears on the page (by default) is controlled by the defaultposition and defaultweight columns. The block’s own configuration is stored serialized in configdata.

### Columns

Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments
--- | --- | --- | --- | --- | --- | --- | --- | ---
id | BIGINT | 19 |  | √ | null |
block_positions.blockinstanceid | blocposi_blo2_fkR
blockname | VARCHAR | 40 |  |  |  |  |
block.name | block_instances_erd_block_nameR
| The type of block this is. Foreign key, references block.name.
parentcontextid | BIGINT | 19 |  |  | null |  |
context.id | blocinst_par2_fkR
| The context within which this block appears. Foreign key, references context.id.
showinsubcontexts | SMALLINT | 5 |  |  | null |  |  | If 1, this block appears on all matching pages in subcontexts of parentcontextid, as well in pages belonging to parentcontextid.
requiredbytheme | SMALLINT | 5 |  |  | 0 |  |  | If 1, this block was created because it was required by the theme and did not exist.
pagetypepattern | VARCHAR | 64 |  |  |  |  |  | The types of page this block appears on. Either an exact page type like mod-quiz-view, or a pattern like mod-quiz-* or course-view-. Note that course-view- will match course-view.
subpagepattern | VARCHAR | 16 | √ |  | null |  |  | Further restrictions on where this block appears. In some places, e.g. during a quiz or lesson attempt, different pages have different subpage ids. If this field is not null, the block only appears on that particular subpage.
defaultregion | VARCHAR | 16 |  |  |  |  |  | Which block region this block should appear in on each page, in the absence of a specific position in the block_positions table.
defaultweight | BIGINT | 19 |  |  | null |  |  | Used to order the blocks within a block region. Again, may be overridden by the block_positions table for a specific page where this block appears.
configdata | LONGTEXT | 2147483647 | √ |  | null |  |  | A serialized blob of configuration data for this block instance.
timecreated | BIGINT | 19 |  |  | null |  |  | Time at which this block instance was originally created
timemodified | BIGINT | 19 |  |  | null |  |  | Time at which block instance was last modified.

### Indexes

Constraint Name | Type | Sort | Column(s)
--- | --- | --- | ---
PRIMARY | Primary key | Asc | id
blocinst_blo_ix | Performance | Asc | blockname
blocinst_par_ix | Performance | Asc | parentcontextid
blocinst_parshopagsub_ix | Performance | Asc/Asc/Asc/Asc | parentcontextid + showinsubcontexts + pagetypepattern + subpagepattern
blocinst_tim_ix | Performance | Asc | timemodified

### Relationships