Schema API

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

Documentation for Schema API in Drupal 7.

Introduction to Schema API

The Schema API allows modules to declare their database tables in a structured array (similar to the Form API) and provides API functions

Schema API quick start guide

A sample schema data structure

Schema Reference

A Drupal schema definition is an array structure representing one or more tables and their related keys and indexes. A schema is defined by

Schema API functions

The Schema API defines a number of functions for manipulating the database schema. These functions all operate directly on the database at

Updating tables: hook_update_N() functions

As in previous versions of Drupal, you can update database tables for new versions using a hook_update_N() function. Note that when you

Data types

Detailed documentation on all the data types supported by Drupal's Schema API.

Guide maintainers

lolandese's picture
drupalastic's picture