/*
 * DataModel.java
 *
 * Created on January 19, 2003, 5:46 AM
 */

package Demos.DatabaseDefinitions;

import ca.mb.armchair.DBAppBuilder.Beans.*;
import ca.mb.armchair.DBAppBuilder.Beans.Query.*;

/**
 * Sample database definition.
 *
 * @author  Dave Voorhis
 */
public class DataModel extends Database {
        
    public static Employees employees = new Employees();
    public static Test1 test1 = new Test1();
    public static Test2 test2 = new Test2();
    public static Test test = new Test();
    
    // Only we can create an instance, because only with an instance can
    // we have the power to drop or define a database.
    private DataModel() {
    }
    
    public static void run() {
        DataModel dm = new DataModel();
        System.out.println("Dropping tables.");
        if (dm.drop())
            System.out.println("Tables sucessfully dropped.");
        else
            System.out.println("Unable to drop tables, or no tables were found.");
        System.out.println("Creating tables.");
        if (dm.create())
            System.out.println("Tables successfully created.");
        else
            System.out.println("Tables not created.");
    }
    
    public static String getDescription() {
        return "Run this <b>second</b> to create the demonstration tables in the database pointed to by the default database connection.";
    }
        
    /**
     * Drop existing tables and create new ones.
     *
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        run();
        System.exit(0);
    }
}
