User Tools

Site Tools


devel:update-database-schema

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
devel:update-database-schema [2012/09/14 12:56]
miconda created
devel:update-database-schema [2012/09/14 13:11]
miconda
Line 9: Line 9:
 </code> </code>
  
-Each table is defined in the file tablename.xml.+Each table is defined in the file tablename.xml. For example, the definition of table domain is in file: 
 + 
 +<code> 
 +lib/srdb1/schema/domain.xml 
 +</code>
  
 Changing the database schema (adding new tables, adding/removing/updating columns) must be done creating or updating the XML files. 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:+Regeneration of the database creation scripts is done running the next command inside the root folder of the source tree:
  
 <code> <code>
Line 19: Line 23:
 </code> </code>
  
-This command generates the SQL or control files to be used by kamdbctl tool when creating the database structure.+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: 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 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   * adding the table to kamctl and kamdbctl tools for creation
 +
 +For example, the group of the tables used by module domain is specified in file:
 +
 +<code>
 +lib/srdb1/schema/kamailio-domain.xml
 +</code>
 +
 +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. If you add a new table, you must add the new files related to it to GIT repository, before committing the changes.
devel/update-database-schema.txt · Last modified: 2015/12/04 09:18 by smititelu