Schema#
Drupal\analytic\Storage\MonthlyTable::schema() is the only column
list. Month tables and the analytic workspace share it. Runtime code
passes it to Schema::createTable(). The logical month name is
analytic_ plus the four-digit year and two-digit month of start.
| Column | Drupal type | Notes |
|---|---|---|
| id | serial | Primary key |
| plugin | varchar 128 | Collector id |
| label | varchar 255 | Copied at write time |
| value | numeric 20,6 | The sample |
| start | varchar 20 | Y-m-d |
| end | varchar 20 | Y-m-d |
| sequence | tiny unsigned int | 1 day, 2 week, 3 month, 4 year |
| timestamp | unsigned int | Unix time written |
Unique key sample is (plugin, sequence, start, end). Index
sequence_start is (sequence, start).
hook_schema() declares analytic and does not declare future months.
SampleStorage::write() merges on that unique key in the month table.
stage() merges the same key in the workspace. add() inserts the
value, or adds it to the existing workspace row. promote() copies
closed workspace rows into the month of start and deletes them.
$endBefore keeps rows whose end is that date or later.
readRange() reads the workspace and every month table from the start
month through the end month, and keeps rows whose start is inside the
range. sourceQuery() is the UNION ALL used by the Views query plugin.
It includes the workspace. When no sample table exists, that query
returns no rows.
findTables() treats _ as a single-character wildcard. Drop and list
code keep names that match ^analytic_\d{6}$, and uninstall also drops
the workspace named exactly analytic.
Update analytic_update_10001() drops a dev analytic table left by
the stub schema. Update analytic_update_10004() creates the workspace
when that update removed it.