Block Instances Table Schema (block_instances)


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 10 null
block_positions.blockinstanceid blocposi_blo2_fk R
block_zoola_reports.blockinstanceid bloczoolrepo_blo2_fk R
block_zoola_reports_cohort.blockinstanceid bloczoolrepocoho_blo2_fk R
block_zoola_reports_user.blockinstanceid bloczoolrepouser_blo2_fk R
blockname varchar 40

The type of block this is. Foreign key, references

parentcontextid bigint 10 null blocinst_par2_fk R

The context within which this block appears. Foreign key, references

showinsubcontexts smallint 4 null

If 1, this block appears on all matching pages in subcontexts of parentcontextid, as well in pages belonging to parentcontextid.

requiredbytheme smallint 4 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 10 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.

Table contained -1 rows

block_instances table indexes

Constraint Name Type Sort Column(s)
PRIMARY Primary key Asc id
blocinst_par_ix Performance Asc parentcontextid
blocinst_parshopagsub_ix Performance Asc/Asc/Asc/Asc parentcontextid + showinsubcontexts + pagetypepattern + subpagepattern

block_instances table relationships