rattail-manual/docs/data/batch/schema.rst
Lance Edgar e5e642ad8b Add initial/basic docs for batches
that still needs a lot yet i'm sure, but is a start
2021-01-16 16:13:52 -06:00

29 lines
1.2 KiB
ReStructuredText

==================
Batch Table Schema
==================
From a schema standpoint there are 2 types of batches generally speaking:
static and dynamic.
Static batch types have 2 "dedicated" tables within the ``default`` schema of
the DB: one table for the batch "headers" and another for its "data". For
instance the basic inventory batch uses these tables:
* ``batch_inventory``
* ``batch_inventory_row``
When a new inventory batch is created, 1 new ``batch_inventory`` record is
created but multiple new ``batch_inventory_row`` records may be created. The
latter table contains all rows for all inventory batches.
Dynamic batch types however are just that, and do not have a dedicated "data"
table, although they still do have a dedicated "header" table. For instance
this approach is used for "importer batches" - when running an importer creates
a batch, it will create 1 new ``batch_importer`` record but then will create a
brand new table with custom schema based on the importer, to hold the data.
To avoid cluttering the ``default`` schema within the DB, dynamic batch data
tables are not stored there. Instead they are kept within the ``batch``
schema, which must be manually created if you need it.