Generate a database script from meta-schema
Generate a 4gl source file to be used to create or update a database that is described in the meta-schema file.
- Right-click on the meta-schema file in the project.
-
Select an option:
- Generate Database Creation Script to generate a source 4gl file that can be used to create a new database and tables according to the meta-schema file.
- Generate Database Update Script
to generate a source 4gl file that can be used to update an existing
database based on the meta-schema file. Note: The database update script will first drop the existing tables including their data, and then recreate the structure of the database based on the modified schema. Previous versions of the tables will be backed up and the data will be migrated to the new tables when applicable. It is recommended to perform a backup of the database prior to running the update script.
-
Complete the Generate Database Script dialog.
- Database schema
- Name of selected meta-schema file.
- Target database
- Specify the database to use in the script.
- Generate primary keys, secondary keys, indexes
- Specify whether to include primary keys, secondary keys, and indexes in the script.
- Use national char types
- By default, the database creation / update scripts will generate column using standard char
types. If this option is set, the scripts will produce columns using
national char types. For example, with an Oracle® database, the column types will be
CHAR
orVARCHAR2
when the option is not selected, andNCHAR
,NVARCHAR2
when the option is selected. - Populate database with sample data
- Add statements in the script to add sample data to the database. Note: This sample data comes from the Studio Libraries. If populating the database does not work (for example, you might have changed to an older version of FGL), try recompiling the Studio Libraries.
- Select Generate.