Table of Contents

"Meta" data model

Media-iBox was modeled to use a flexible, expandable data model. As such, we use a set of “Meta-Tables” that describe how the CMS will expose and manipulate the data model.

There’s a few core tables for this meta data model:

  • MEDIA_TYPES
  • ADM_FIELDS
  • ADM_RELATEDS
  • ADM_ENUMTYPES
  • ADM_ENUMVALUES
  • ADM_FILEEXTENSIONS

All tables above are also Media Types, and therefore contain the basic fields described in the section above (ID, DATEINS, NAME, OWNER).

MEDIA_TYPES

This table lists the Media Types present in the system. Its basic structure is:

  • ID (int, not null)
    • Unique registration identification number.
  • DATEINS (datetime, not null)
    • Record creation date and time.
  • NAME (varchar, nullable)
    • Name of the physical table to be mapped in the database.
  • OWNER (int, not null)
    • Numerical identifier of the creator user (referring to table [ADM_USERS].[ID]).
  • MIBINDEX (int, not null)
    • Numeric identifier for this Media Type. Examples of references:
      • ADM_FIELDS with MEDIATYPE
      • ADM_FILEEXTENSIONS with SOURCETABLE
      • ADM_RELATEDS with LOCALTABLE or REMOTETABLE
      • LINKOBJECTS with VLOCAL or TLOCAL or VREMOTE or TREMOTE
      • DMM_JOBS with CONTENT_MEDIATYPE
      • DMM_JOBS_ACTIONS with MIB_TYPE
  • TITLE (varchar, not null)
    • Visible (user-friendly) name for the Media Type.
  • BLOCK_WRITE (int, nullable)
    • Write permission. This permission is superior to user permissions, so a user with write permission for a media type whose "BLOCK_WRITE" value is true cannot perform writing.
  • BLOCK_DELETE (int, nullable)
    • Deletion permission. This permission is higher than user permissions, so that a user with delete permission for a media type whose value of "BLOCK_DELETE" is true cannot perform the deletion.
  • BLOCK_CREATE (int, nullable)
    • Creation permission. This permission is superior to the user's permissions, so that a user with permission to create on a media type whose value of "BLOCK_CREATE" is true cannot perform the creation of a new record.
  • MIB_LAST_UPDATE (datetime, not null)
    • Date and time of the last modification performed.
  • PARENT_MEDIA_TYPE (int, nullable)
    • Generate content based on [MIB3UX_PAGE_COMPONENT_CONFIGURATIONS] table according to [COMPONENT_KEY]. Through this option it is possible to extend this table without the need to include of new columns, informing only which will be the extension table with the additional fields.
  • HISTORY_TABLE (varchar(max), nullable)
    • Discontinued (legacy use only).
  • BLOCK_DEFAULT_LIST (bit, nullable)
    • Discontinued (legacy use only).
  • BLOCK_DEFAULT_EDIT (bit, nullable)
    • Discontinued (legacy use only).
  • FILE_HASH_COLUMN (varchar(max), nullable)
    • Discontinued (legacy use only).
  • LIST_DOWNLOAD_ENABLED (bit, nullable)
    • Discontinued (legacy use only).

Due to historical reasons, while this table also contains an “ID” field, media types are referred to in the system using the manually-assigned MIBINDEX field.

This is the ONLY table that uses this convention. Everything else on the system is referred to using the ID field. In most installations, this is not an issue as typically ID and MIBINDEX contain the same values, but there are exceptions.

All Media Types used in the system, even those not exposed to the end-users and only accessed with the .NET library must be present in this table. Again, this is an exception, and other Meta tables in the system only need to include data that needs to be exposed to end-users through the CMS.

ADM_FIELDS

This table describes which fields from a particular table will be editable in the CMS/API, and also how they’ll be exposed.

  • MEDIATYPE (int, not null, relation to MEDIA_TYPES.MIBINDEX)
    • MibIndex of the Media Type this field belongs to.
  • COLUMNNAME (varchar, not null)
    • Name of the column.
  • TYPE (int, not null, enumeration)
    • Display type of the field, values are listed below.
  • READONLY (bit, null)
    • Informs if this field is read-only.
  • ENUMTYPE_ID (int, null, relation to ADM_ENUMTYPES.ID)
    • Only needed if type is Enum (8).
    • Refers to the enumeration values used in this field.
  • RELATEDTABLE (int, null, relation to MEDIA_TYPES.MIBINDEX)
    • Only needed if type is Related (9) or DropRelated (14), which means this column contains a reference to another table.
    • Informs the table this column refers to.
  • RELATEDCOLUMN (varchar, null)
    • Only used if type is Related (9) or DropRelated (14), which means this column contains a reference to another table.
    • Informs the column on the related table the value stored refers to, defaults to “ID”.
  • RELATEDCOLUMNNAME
    • Only used if type is Related (9) or DropRelated (14)
    • Informs the column on the related table used for display in the CMS, defaults to “NAME” .
  • DEFAULT_VALUE
    • Initial value of a new record only: the BFF prefills a new form with it, and mib.api stores it when an insert does not send the field. No update, read or bulk edit applies it, and an Enum default is the value NAME. See What fills an empty field.
  • DROPRELATEDNULLLABEL
    • Stored, but no 6.0/7.x BFF nor the React shell reads it: it does not change what an empty DropRelated shows.
  • ORDEREDIT
    • Order in edition pages.
  • ORDERLIST
    • Order in listing pages, and default visibility: on a top-level list a field with no ORDERLIST (or a negative one) is hidden until the user shows it. See List → Column layout.
  • REGEX
    • Regex for validation of values.
  • FIELD_DESCRIPTION
    • Longer description for this field, will be displayed as a tooltip near the field name.

The TYPE field corresponds to a value from this enumeration.

  • Varchar = 1
    • Rendered a single-line text field.
  • Text = 2
    • Rendered as a multi-line text field.
  • Html = 3
    • Rendered as a multi-line text field with an HTML editor.
  • Integer = 4
    • Rendered as a short single-line text field with an input mask.
  • Date = 5
    • Rendered as a short single-line text field with a Date picker plugin.
  • DateTime = 6
    • Rendered as a short single-line text field with a Date and Time picker plugin.
  • Source = 7
    • Rendered as a treeview for Source selection, more details in later in the document.
  • Enum = 8
    • Rendered as a dropdown.
  • Related = 9
    • Rendered as a button to select a record from the related table.
  • Boolean = 11
    • Rendered as a dropdown.
  • Long = 12
    • Rendered as a short single-line text field with an input mask.
  • Float = 13
    • Rendered as a short single-line text field with an input mask.
  • DropRelated = 14
    • Rendered as a dropdown containing all records from the related table.
  • PasswordPlain = 15
    • Rendered as a hidden field, data will be stored to the database in plain text, however password security rules will be enforced.
  • Link = 16
    • Rendered identical to varchar in the edition pages, but rendered as a link in the list pages.
  • Time = 17
    • Rendered as a short single-line text field with a Time picker plugin.
  • Hidden = 18
    • Rendered as a hidden field, data will be stored to the database in plain text.
  • Ipv4 = 19
    • Rendered as a short single-line text field with an input mask.
  • UtcDateTime = 20
    • Rendered as a short single-line text field with a Date and Time picker plugin.
  • Keyword = 23
    • Rendered as a tag-style setup with each value saved to the text field with a separator
  • Json = 28
    • Rendered as a Json editor (React) or as a multi-line text field (Legacy).
  • Cron = 29
    • Rendered as an interactive Cron expression builder with a natural‑language preview.
  • ColorPicker = 30
    • Rendered as a color picker field. The selected value is stored as a string (for example, #624141). From MIB 6.0.98 and 7.0.0.
  • Money = 31
    • Rendered as a monetary input (React money variant). Semantically a numeric decimal value; the MibApi resolves its CLR type as decimal, so the consumer's column should be DECIMAL/NUMERIC. Not included in the free-text search ([IsText(false)]). Currency/precision are driven by the field schema (see CUSTOM_FIELD_SCHEMA in the Form Component reference). From MIB 6.0.108 and 7.0.0.
  • AutoComplete = 32
    • Rendered as a text input that suggests values while the user types (React auto-complete variant). The value is stored as a string and free text is always accepted, which means a value that is not among the suggestions is persisted as it was typed. Included in the free-text search ([IsText(true)]), and the MibApi resolves its CLR type as string. The suggestions are driven by the field schema (see CUSTOM_FIELD_SCHEMA in the Form Component reference). Only on the 6.0 line, from the next 6.0 release; MIB 7.0 and 7.1 do not support it yet.

The following field types are for internal use and should not be used when declaring a Media Type.

  • Password = 10
    • Used in ADM_USERS for the user password, stores a hashed and salted password.
  • OsTimezone = 22
    • Used in ADM_USERS for the user timezone, stores a Windows timezone ID.
  • RowVersion = 21
    • Used to expose rowversion columns from MS-SQL as binary data in the API.

What fills an empty field — DEFAULT_VALUE, the column default and NULL

Three things decide what a field holds when nobody typed a value, and each acts at a different moment:

Where it lives Applies on Never on
ADM DEFAULT_VALUE ADM_FIELDS.DEFAULT_VALUE a new record: the BFF prefills the form (id = 0, not a bulk edit), and mib.api stores it for a field the insert does not send an update, a read, a bulk edit, or a field the save sends as null
The column DEFAULT the table's DEFAULT constraint (defaultValue: / defaultValueSql: in the DDL) an INSERT that leaves the column out the form: it never prefills a field and never makes one optional
NULL a column that takes NULL everything else —

So an existing row that holds NULL keeps it until someone writes it. Filling old rows is a backfill (a data migration), not a default. Before treating a NULL as a missing value, look at how the column is filled today: mib db profile <TYPE> <FIELD> counts NULL, 0 and every value.

mib datamodel <TYPE>            # per field: NULL / NOT NULL · adm= · db= · req / req:new, and what a NEW record gets
mib datamodel <TYPE> <FIELD>    # one field in full, with the commits and issue keys that touched its column
mib db profile <TYPE> <FIELD>   # the stored values: NULL, empty, 0, each value with its count

Where DEFAULT_VALUE is read

  • The form (BFF). FieldFormatterTemplate.GetRawValueCondition (MibServer3 releases/7.0 and main, MediaiBox.Cms.FrontEnd.Workflow.Mvc/Form/FieldViewDataFormatter/FieldFormatterTemplate.cs) is ItemInformation.Id == 0 && !string.IsNullOrWhiteSpace(DefaultValue) && !IsBulkEdit: on a new record the field starts with the default. An existing record shows what is stored, NULL included.
  • The insert (mib.api). MibObjectWorkflow.Insert → SetMibFieldsOnInsert (MibServerApi releases/7.0 and main) first drops the read-only fields from the payload, then gives every field the payload does not carry its non-blank DEFAULT_VALUE. A field sent as null or "" is not defaulted: it is left out of the INSERT, so the column default, or NULL, applies. A read-only field can therefore get a value only from DEFAULT_VALUE or the column default.
  • A new item's related field (mib.api). Reading id 0 with includes, a Related field's DEFAULT_VALUE (a row id) loads that related row, so the new form can show its name (MibObjectWorkflow.cs).

No other path reads it. A list, an update, a bulk edit and the read of an existing row ignore it.

The text DEFAULT_VALUE must hold

The form and mib.api parse the same string:

Field type Write Why
Enum the value NAME (Preparation Area) the form's select options are the NAMEs (BaseSelectFormFieldProps), and the insert matches the NAME (ApiRequestFilterExtensions.GetEnumValuesAsync): a number fails with EntityEnumValueNotFoundException unless a value is named that way
Boolean true / false MibParser.ToBoolean: 1 and true (any case) are true; anything else, 0 and yes included, is false
DropRelated / NullableDropRelated / Related the related row's id the options' value is the id
Date / DateTime / UtcDateTime avoid the form parses the text with DateTime.Parse, while the insert reads a date as Unix seconds: no single text satisfies both. Use a column default (defaultValueSql: "GETUTCDATE()") or a seam
text and numbers the value

When the form marks a field required

This is the edit page's main form (FormComponent). A related list's Add-New drawer builds its row on another path and has its own Boolean trap (mib get recipe.required-boolean-in-related-child).

FieldViewData.IsFieldRequired (MibServer3 releases/7.0 and main, MediaiBox.Cms.FrontEnd.Model/UI/List/FieldViewData.cs) is !IsNullable && !IsReadOnly, except for a Boolean that already has a value. IsNullable is the column's nullability (mib.api FieldChecker → _nullable), not a setting in ADM_FIELDS. In practice:

  • A NOT NULL field is required on a new and on an existing record. A DEFAULT_VALUE prefills it; it stays required.
  • A NOT NULL Boolean is required only on a new record without a DEFAULT_VALUE. An existing record always has a value, and on a new record only the ADM default gives it one; the column default does not count.
  • A field the page makes read-only (READONLY_FIELDS, CREATE_ONLY_FIELDS on an existing record) is not required.
  • The upload drawer shows only the NOT NULL fields (IncludeOnlyRequiredFields → !IsNullable).

Setting DEFAULT_VALUE in a migration

WithAdmField(...) has no parameter for it. The defaultValue: named optional of a column factory such as t.Int(...) is the column's SQL DEFAULT, not the ADM one. Seed the ADM row the way the Core does (MibServerApi Mib_FixImagesNotNullFieldsWithDefaultValues), in the data-model repo's migrations, since ADM_FIELDS lives in the datamodel DB:

public override void UpSeed(IMibSeed seed)
{
    seed.AddOrUpdate(x => x.MibObject("ADM_FIELDS",
        new { COLUMNNAME = "IS_KIDS", MEDIATYPE = x.FindMibIndex("MOVIES"), DEFAULT_VALUE = "false" }),
        new[] { "COLUMNNAME", "MEDIATYPE" });
}

public override void DownSeed(IMibSeed seed)
{
    seed.AddOrUpdate(x => x.MibObject("ADM_FIELDS",
        new { COLUMNNAME = "IS_KIDS", MEDIATYPE = x.FindMibIndex("MOVIES"), DEFAULT_VALUE = DBNull.Value }),
        new[] { "COLUMNNAME", "MEDIATYPE" });
}

A later AddOrUpdateMediaType / WithAdmField run does not reset it: the ADM row it upserts lists its own columns, and DEFAULT_VALUE is not one of them (MibMigrator MibSeed.MibObjectFromAdmFieldMetadata). Seed it after the migration that creates the field, and refresh mib export --datamodel afterwards.

Load skills: mib-datamodel.

ADM_RELATEDS

This table describes relationships between Media Types.

  • LOCALTABLE (varchar, not null)
    • Left table of the relationship.
  • REMOTETABLE (varchar, not null)
    • Right table of the relationship.
  • ISLINKOBJECT (bit, null)
    • Informs this is a N:N relationship using the LINKOBJECTS table.
  • IS_RELATIONSHIP_TABLE (bit, null)
    • Informs this is a N:N relationship using a custom N:N mapping table.
  • LINKUNIDIRECTIONAL (bit, null)
    • On a LINKOBJECTS-based N:N relation, informs if the relation is treated as unidirectional or bidirectional.
  • REMOTECOLUMN (varchar, null)
    • If the relationship is 1:N, informs the column in the right table used for the relationship.
  • LOCAL_COLUMN (varchar, null)
    • Local column used as key in the relation, defaults to “ID”.
  • RELATIONSHIP_TABLE (varchar, null)
    • Custom relation table for N:N relations.
  • FOREIGNKEY_RELATIONSHIP_TYPE (int, null)
    • On a 1:N relation, informs the type of FK present.
  • REMOVE_BUTTON_BEHAVIOR_TYPE (int, null)
    • On a 1:N relation, informs how the CMS will act when removing the related object.
  • MIB_COPY_TYPE (int, null)
    • Informs how objects from this relationship will be copied when using the Clone functionality of the CMS.
  • ORDERCOLUMN (varchar, null)
    • Determines by which field the values ​​of the relationship table will be ordered. For linked objects you must inform the default value: ID.

The FOREIGNKEY_RELATIONSHIP_TYPE field corresponds to values from this enumeration:

  • NoForeignKey = 0
  • RegularForeignKey = 1
  • CascadeDeleteForeignKey = 2

The REMOVE_BUTTON_BEHAVIOR_TYPE field corresponds to values from this enumeration:

  • SetNull = 0,
  • DoNotAllowRemoval = 1
  • DeleteChildObject = 2

The MIB_COPY_TYPE field corresponds to values from this enumeration:

  • Undefined = 0 (Disables Clone functionality)
  • DoNotCopy = 1
  • UseSameIDs = 2
  • CopyObjects = 3
Note

In the case of a relationship via RELATIONSHIP_TABLE, it is possible to turn the relationship table into a MEDIA TYPE. This allows applying Read, Write, and Delete permissions on the related records in a segmented way for users. If the RELATIONSHIP_TABLE is not a MEDIA TYPE, MIB will apply the permissions of the MEDIA TYPE configured in the view for the end user.

LINKOBJECTS

The LINKOBJECTS table is a “general use” table for N:N relations. It’s a legacy table, we currently recommend usage of custom N:N tables for each particular relation, but it’s still supported on both the API and the .NET library.

  • VLOCAL (int, not null)
    • ID of the record in the left side of the relation
  • TLOCAL (int, not null)
    • MibIndex of the Media Type in the left side of the relation
  • VREMOTE (int, not null)
    • ID of the record in the right side of the relation
  • TREMOTE (int, not null)
    • MibIndex of the Media Type in the right side of the relation

When querying this table, simply filter by TLOCAL and TREMOTE according to the tables in the relation and select the VLOCAL and TLOCAL values. This will give you the N:N mapping table for this particular relation.

ADM_ENUMTYPES

Describes enumerations used in the CMS interface. This table only contains the default fields for a Media Type.

ADM_ENUMVALUES

Describes the values for a particular enumeration.

  • ENUMTYPE_ID (int, not null, reference to ADM_ENUMTYPES.ID)
    • Reference to the enumeration.
  • VALUE (varchar, not null)
    • Value for this enumeration.
    • On very old MIB2 installations, this field will be integer. This was changed a few years ago to varchar for more flexibility.
  • MIB_ORDER (int, null)
    • If set, allows ordering how the enumeration values will be displayed in the CMS dropdown.

ADM_FILEEXTENSIONS

Describes extensions that we allow uploading to Media-iBox.

  • SOURCETABLE (int, not null)
    • MibIndex for the Media Type this extension will be uploaded to.
  • TYPE (int, not null, enumeration)
    • Type of file, may trigger additional behavior from MIB.
  • TITLE (varchar, not null)
    • User-friendly name for this record.

For this particular table, it’s required that the NAME column be the file extension, including the “dot”. An example record for this table would be.

NAME = ‘.jpg’ 
SOURCETABLE = MibIndex for “IMAGES” 
TYPE = 1 
TITLE = ‘JPEG Image’ 

The TYPE field corresponds to values from this enumeration:

  • Document = 0
  • Image = 1
  • Video = 2

If Type = Image, MIB will attempt to extract Width and Height from the file and save them to the column.

If Type = Movie, MIB will attempt to extract Width, Height and Duration from file and save them to the column. Notice that this is dependant on the Directshow video codecs installed on the server, and also that this only applies to single-file medias (MP4, MOV, WMV). This behavior is skipped for mutil-file medias such as Smooth Streaming, DASH and HLS packages.