Dbcreate=yes
Posted on 2005-08-31 19:23:28 EEST.
Quite new configuration option for new Midgard configuration files.
Command line tool midgard-schema is now more "clever" if such option is set to "yes". MgdSchema itself is also "clever" as new attribute "dbtype" is now recognized. Such attribute is used only when columns in table are created or modified. Typical MgdSchema types just ignore this attribute, or better , do not use it. Thanks to Torben for such proposal.
I created today new database ( this can not be done with midgard-core yet ) and used midgard-schema to create tables and columns. dbtype attribute was indeed needed and perfectly helped to modify columns.
Host type's table ( for example ) looks bad with default values used in schema.
We should have another type. Absolutely no varchar. What is to be done is to edit schema file and add correct dbtype if default type is not correct.
This database has also new openpsa2 and new midcom tables created.
Command line tool midgard-schema is now more "clever" if such option is set to "yes". MgdSchema itself is also "clever" as new attribute "dbtype" is now recognized. Such attribute is used only when columns in table are created or modified. Typical MgdSchema types just ignore this attribute, or better , do not use it. Thanks to Torben for such proposal.
I created today new database ( this can not be done with midgard-core yet ) and used midgard-schema to create tables and columns. dbtype attribute was indeed needed and perfectly helped to modify columns.
Host type's table ( for example ) looks bad with default values used in schema.
describe host info;
+-------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| info | varchar(255) | | | | |
+-------+--------------+------+-----+---------+-------+
We should have another type. Absolutely no varchar. What is to be done is to edit schema file and add correct dbtype if default type is not correct.
<type name="midgard_host" table="host">Run midgard-schema again ( empty db without records should be created or modified in less then 10 seconds ).
[...]
<property name="info" type="string" dbtype="set('auth')"/>
describe host info;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| info | set('auth') | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
This database has also new openpsa2 and new midcom tables created.
describe midcom_group_virtual;PRIMARY KEY is created , and guid and sitegroup columns too. All is done automagically :)
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| id | int(11) | | PRI | NULL | auto_increment |
| component | varchar(200) | YES | | NULL | |
| identifier | varchar(200) | YES | | NULL | |
| name | varchar(255) | | | | |
| guid | varchar(80) | | MUL | | |
| sitegroup | int(11) | | MUL | 0 | |
+------------+--------------+------+-----+---------+----------------+