Start page
Start page

Start page / Advanced topics / Media galleries / Database schema

Chapter “Table templates” >>

Creating a database schema

A database schema for galleries must first be created in the template store with the following tables:

Gallery table

The general data for the gallery (for the entry page) is managed in the gallery table. The corresponding table name in the sample project is “Gallery”.

Columns must be considered for saving the following:

  • the gallery name (“name” column name)
  • a descriptive text associated with the gallery (“description” column name)
  • teaser pictures (“teaser_media” column name)

Foreign key relation galery table to media table

The media to be used for the gallery are selected via an aggregated 1:N relationship to the media table (source: gallery table; target: name of link from the gallery table to the media table: “gallery_MediaList”).

Media table

The descriptive text for the media is managed in the media table (for the gallery page). The corresponding table name in the sample project is “Gallery_Media”.

Columns must be considered for saving the following:

  • a medium (“media_ref” column name)
  • a descriptive text associated with this medium (“media_description” column name)

The order of the selected media is saved in an additional column (“order_index” column name).

Category table (optional)

The category names are managed in the category table. The corresponding table name in the sample project is “Gallery_Category”.

For this purpose, a column for saving

  • the category name (“name” column name)

is required.

Foreign relation ship galery table to categories table

In addition, a foreign key must be added for the gallery table (1:N relationship; source: category table; target: gallery table) that is used to select the category in the gallery table (name of the link from the gallery table to the category table: “gallery_Categories”).

Database schema example

The complete database schema the gallery may appear as follows:

Beispiel Datenbank-Schema

Database schema example

Important For more information on creating database schemata, refer to the FirstSpirit Handbook for Developers (Basics).

Chapter “Table templates” >>

© 2005 - 2014 e-Spirit AG | All rights reserved. | Last change: 2013-07-01