User Tools

Site Tools


This is an old revision of the document!

Update Database Schema

Kamailio's database schema is specified in an XML format, which allows generation of creation scripts for many database types at once.

The XML files with the database table definitions are located in the source tree, inside subdirectory:


Each table is defined in the file tablename.xml.

Changing the database schema (adding new tables, adding/removing/updating columns) must be done creating or updating the XML files.

Regeneration of the database creation scripts is done with the command:

make dbschema

This command generates the SQL or control files to be used by kamdbctl tool when creating the database structure.

Changing the structure of an existing database table requires only the above steps. Adding a new table requires as well:

  • adding the table to be part of a specific group of tables. If the table is used by a module that uses other tables, all of them have to be in the same group. Tables group definitions are stored in the files kamailio-groupname.xml . It is common to use the module name as the group name.
  • adding the table to kamctl and kamdbctl tools for creation

If you add a new table, you must add the new files related to it to GIT repository, before committing the changes.

It is recommended to split the commit in two parts, because they affect different components:

  • one for the XML files (they are part of internal library srdb1)
  • one for DB creation scripts (they are part of kamctl tool)
devel/update-database-schema.1347620162.txt.gz · Last modified: 2012/09/14 12:56 by miconda