This task will locate any schema versions above your current one, and will install them to the database configured in the
config.tdsl
file.
Note
To use this utility, you must have Tigase XMPP server fully setup with a configured configuration file.
./scripts/tigase.sh upgrade-schema etc/tigase.conf
Windows users will need to run the command using the following command:
java -cp "jars/*" tigase.db.util.SchemaManager "upgrade-schema" --config-file=etc/config.tdsl
This task will install a schema using the parameters provided.
If you are setting up a server manually, we HIGHLY recommend using this method
./scripts/tigase.sh install-schema [Options]
This command will install tigase using a Derby database on one named tigasedb
hosted on localhost
. The username and password editing the database is tigase_pass
and root
. Note that -J
explicitly adds the administrator, this is highly recommended with the -N
passing the password.
If you are using a windows system, you need to call the program directly:
java -cp "jars/*" tigase.db.util.SchemaManager "install-schema" [options]
Options for schema installation are as follows, required options are in bold
--help
, Outputs the help.-I
,--interactive
- enables interactive mode, which will result in prompting for any missing parameters.-C
,--components=
- list of enabled components identifiers (+/-), possible values: [amp
,bosh
,c2s
,eventbus
,ext-disco
,http
,mdns
,message-archive
,monitor
,muc
,pubsub
,push
,s2s
,socks5
,test
,unified-archive
,upload
,ws2s
] (default: amp,bosh,c2s,eventbus,http,message-archive,monitor,muc,pubsub,s2s,ws2s). This is required for certain components like socks5.-T
,--dbType=
- database server type, possible values are: [derby
,mongodb
,mysql
,postgresql
,sqlserver
] (required)-D
,--dbName=
- name of the database that will be created (by default it istigasedb
). (required)-H
,--dbHostname=
- address of the database instance (by default it islocalhost
). (required)-U
,--dbUser=
- name of the user that will be created specifically to access Tigase XMPP Server database (default istigase_user
). (required)-P
,--dbPass=
- password of the user that will be created specifically to access Tigase XMPP Server database (default istigase_pass
). (required)-R
,--rootUser=
- database root account username used to create user and database (default isroot
). (required)-A
,--rootPass=
- database root account password used to create user and database (default isroot
). (required)-S
,--useSSL
- enable SSL support for database connection (if the database supports it) (default is false).-F
,--file=
- comma separated list of SQL files that will be processed.-Q
,--query=
- custom queries to be executed, see the section called “Query function” for details.-L
,--logLevel=
- logger level used during loading process (default isCONFIG
).-J
,--adminJID=
- comma separated list of administrator JID(s).-N
,--adminJIDpass=
- password that will be used for the entered JID(s) - one password for all configured JIDs.--getURI=
- generate database URI (default isfalse
).--ignoreMissingFiles=
- force ignoring missing files errors (default isfalse
).
Should you decide to customize your own functions, or have specific information you want to put into the database, you can use the -query function to perform a single query step.
./scripts/tigase.sh install-schema -T mysql -D tigasedb -R root -A root -Q "CREATE TABLE tigasedb.EXTRA_TABLE (id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, name VARCHAR(10) NOT NULL)"
Of course this would break the schema for tigasedb by adding an unexpected table, you will receive the following message:
tigase.db.util.DBSchemaLoader printInfo WARNING Database schema is invalid
But this is a demonstration how you may run a query through the database without the need to use another tool. Note that you will need to select the specific database for each query.
This will destroy the database specified in the configuration file.
Warning
THIS ACTION IS NOT REVERSIBLE
./scripts/tigase.sh destroy-schema etc/config.tdsl
Only use this if you wish to destroy a database and not have the information recoverable.
Windows users will need to call the method directly:
java -cp "jars/*" tigase.db.util.SchemaManager "destroy-schema" etc/config.tdsl
If you are using these commands, you may result in the following error:
tigase.util.DBSchemaLoader validateDBConnection WARNING Table 'performance_schema.session_variables' does not exist
If this occurs, you will need to upgrade your version of MySQL using the following command:
mysql_upgrade -u root -p --force
After entering the password and upgrading MySQL the schema error should no longer show when working with Tigase databases.