Block Instances Table Schema (block_instances)


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.

block_instances table columns

Column Type Size Nulls Auto Default Children Parents Comments
id BIGINT 19 null
block_positions.blockinstanceid blocposi_blo2_fk R
block_totara_featured_links_tiles.blockid bloctotafeatlinktile_blo2_fk R
block_zoola_reports.blockinstanceid bloczoolrepo_blo2_fk R
block_zoola_reports_cohort.blockinstanceid bloczoolrepocoho_blo2_fk R
block_zoola_reports_schreps.blockinstanceid bloczoolreposchr_blo2_fk R
block_zoola_reports_user.blockinstanceid bloczoolrepouser_blo2_fk R
blockname VARCHAR 40
block.name blocinst_blo2_fk R

The type of block this is. Foreign key, references block.name.

parentcontextid BIGINT 19 null
context.id blocinst_par2_fk R

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.

common_config LONGTEXT 2147483647 null

Json encoded common block configuration data

Table contained -1 rows

block_instances table 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

block_instances table relationships