Open Source Content Management System

Command line tools midgard-schema

  1. Basic tasks
  2. Debugging

Midgard's command line tool midgard-schema is a very simple application which reads the configuration file, analyzes MgdSchema files and performs modifications to the database as requested.

midgard-schema has only one command-line argument, Filename. If application' configuration is defined in /etc/midgard/conf.d/my_midgard file, then my_midgard filename should be used as argument.

 midgard-schema my_midgard

There are no special rules for file's extension. It's up to the developers or administrators' convention if extension is defined as ini, conf or cnf.

Basic tasks

  • connect to database
  • parse schema
  • register classes
  • connect to database using midgard person credentials
  • create tables in database
  • update tables in database
  • create, update and delete records ( objects )

when object's table is already created and TableCreate is set to true then midgard-schema will silently ignore errors returned from database server.

You can change application's schema before calling midgard-schema as many times as you need when you perform full table update task. For example, if you made a mistake and defined some property's type as integer, you can edit schema file , change property's type to string and run midgard-schema again. Column type will be altered again.

[warning: you should always perform such tasks on development server before running it in production environment. Altering table with incorrect column type for tables where records already exist may cause data loss.]

Debugging

You can set different log levels for midgard-schema. By default only warnings will be logged. With log level message you can log every type name registered in schema and with debug log level you may log almost all performed tasks including database queries.

Designed by Nemein, hosted by Anykey