I have started using metabase for a project and was considering using the manager and schema, but there is a design decision which I don't understand. The name of the database if hard-coded into the schema definition. This may not accomidate all the user's setups, where they may have only a single database with a set name assigned to them. Shouldn't the database name be passed in the arguments parameter?
Also, it isn't clear from the documentation if I am allowed to have multiple <was> elemenats, for example if upgrading from more than one version.
Also, I'm not sure I understand the <create> element. What happens if I try to update a database and the new schema contains the <create> element? Will it fail because the database is already created?
Manuel Lemos - 2007-01-12 20:36:37 - In reply to message 1 from Devin
You use variable tags to turn schema definition parameters configurable from the schema setup script. For instance to make the database name a parameters you can have it this way:
Then you should set the database_name parameter to define the database name when the schema is installed.
You can install different databases schemata under the same database. Just set the database name to be the same.
If you only have a single database available, you can create the database separately, and then set the <create> parameter to 0 in the schema definitions.
The <create> parameter is only considered in the first time that a database schema is installed. So it does not affect database schema upgrades.
Keep in mind that Metabase schema manager determines whether a schema is being installed for the first time or it is being upgraded, by looking whether the previously installed schema file already exists.
If you are running in safe mode or for some other reason PHP scripts cannot write files, you may need to copy the installed schema file manually, as Metabase manager may not be allowed to do it.
In each element you can only have one was definition. What matters is that the value in the was element matches the name of that element in the environment where the schema was installed. Otherwise, the manager will not be able to correctly determine which schema table or field is to be renamed.