Skip to content

Asset Table Reference

mikert edited this page Feb 15, 2011 · 1 revision

Asset Table

Associated Perl objects

  • MT::Asset
  • MT::Asset::Audio
  • MT::Asset::Image
  • MT::Asset::Video

Basic Facts

  • Table name: mt_asset.
  • Assets can have parent-child relationship via asset_parent field.
    • Used for thumbnails

Fields

  • asset_id - Type: integer (and primary key).
  • asset_blog_id - Type: integer. Points to the blog which "owns" the asset.
  • asset_class - Type: varchar. Describes the asset type. Possible values include:
    • audio
    • image
    • video
  • asset_created_by - Type: integer. Points to the user who created the asset.
  • asset_created_on - Type: datetime. Date and time for when the object was entered into Melody's asset manager.
  • asset_description - Type: mediumtext. Long string which describes the asset.
  • asset_file_ext - Type: varchar(20). Short string with the file extension (just file extension, no period).
  • asset_file_name - Type: varchar(255). String with the full file name (no path informaion).
  • asset_file_path - Type: varchar(255). String with the path of the file.
  • asset_label - Type: varchar(255). String that holds the label of the asset.
  • asset_mime_type - Type: varchar(255). String that holds the mime type of the asset.
  • asset_modified_by - Type: integer. Points to the user who last modified the asset.
  • asset_modified_on - Type: datetime. Date and time for the last modification.
  • asset_parent - Type: integer. Parent asset id. This is used primarily to describe a parent-child relationship between thumbnails and the image for which they are a preview.
  • asset_url - Type: varchar(255). The URL of the asset.

Developer Advice

The following fields have a "relative path syntax" option available to them that serves to simultaneously conserve space in the database and make asset transitions more flexible:

  • asset_file_path
  • asset_url

For an image asset named "testimg.jpeg," there are two ways of storing the file path. They are:

  • /full/path/to/testimg.jpeg
  • %r/path/to/testimg.jpeg

The second one uses %r to say "relative to this blog." This is almost always a superior choice to the first option because it means that the file path (and url, if asset_url is treated the same way) will not break when moving the blog from one hosting service to another if the assets are moved to the new host into the same relative path they were in before.

Clone this wiki locally