This is an old revision of the document!
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:
lib/srdb1/schema/
Each table is defined in the file tablename.xml. For example, the definition of table domain is in file:
lib/srdb1/schema/domain.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 running the next command inside the root folder of the source tree:
make dbschema
This command generates the SQL or control files to be used by kamdbctl tool when creating the database structure. It requires the tool xsltproc to process the XML files, tool which is also needed for generation of the readme files.
Changing the structure of an existing database table requires only the above steps. Adding a new table requires as well:
For example, the group of the tables used by module domain is specified in file:
lib/srdb1/schema/kamailio-domain.xml
It includes references to two tables: domain and domain_attrs.
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: