Creating database tables

Use the Database Schema Tool's create command to generate an SQL script for creating your database tables. This command allows you to choose a set of parameters with initial values to load into your database.
To generate code for creating the database tables:
  1. In NexJ Studio, click the arrow next to the Run Tool button and select Database Schema Tool.
    The Database Schema Tool dialog opens.
  2. From the Model section, choose the model that you want to create database tables for:
    • For the currently loaded model, shown in the label, select Current.
    • For a base model in your Model Library, select Base Model and select one of the available models from the drop-down list.
    • For a previously published model in your file system, select Published Model JAR and click the Browse button to locate the published model. You might be prompted to specify the directory where the published model's mixins are located.
  3. If you want to use a test environment, select the Test check box.
  4. Specify the server and connections that you want the application to support when running with this database.
    1. In the Server field, specify either the server or environment file that contains the server configuration information you want to use when setting up the database. If you specify an environment file, then it will also include the connections information.
    2. In the Connections field, specify the connections file that you want to use when setting up the database. If you previously selected an environment file in the Server field, then it already has the connections information, and this field becomes inactive.
    Note: If you are creating the database for the current model, then the fields allow you to select from among the environment, server, and connection files within the model. If you are creating a schema for a base or published model, then your choice is limited to only those server and connection files contained in your global environment folder.
  5. In the Command field, select create.
  6. In the Data Source field, select the model data source that you want to use. Selections are limited to the relational data sources described in the model.
  7. In the Output Directory field, click the Browse button , specify where you want to save the resulting SQL file, and click OK.
  8. Optional: In the Owner field, specify an owner prefix for your tables.
    This field refers to the metadata table owner value. If you leave the field blank, a default value of dbo is used.
  9. Click Run.
The tool outputs a script file name modelname_datasourcename_create.sql to the output directory where modelname is the name of the chosen model and datasourcename is the name of the chosen data source.
You can now provide your database administrator with this file to create the database schema, or you can run it yourself if you have database administrator privileges.