From the database meta-schema file, you can graphically model a database by adding tables
and constraints and generate a database creation script.
The database meta-schema file will contain the information about the tables, columns, and
relations of the relational database that is needed by your app. By default, the database
meta-schema file mydatabase.4dbx has been provided for you.
In the Project group, expand the Database node,
and double-click on the 4dbx to open it. The Meta-Schema Manager is launched
for viewing and modifying the schema.
Note: The meta-schema diagram includes a seqreg table. For this quick start, you do not need to
worry about this table. For more information about what this table does,
see Managing SERIALs in a generated application
Right-click and select Add Table. Set the table's name
property to account. Right-click on the table to add the columns as shown.
Make the id column SERIAL and not
null. Make the id column the primary key for the table. With the table
selected, right-click to see the menu option for adding a constraint.
Save your file.
Right-click on the 4dbx file in your project and select Generate Database Creation Script. Select the option to populate database with sample data and then
Generate.
Save the file to the databaseMaintenance directory of your project
($ProjectDir) to overwrite the default file with your file.
Uncheck the Insert the file in the project option as the file is already
in the project; you are just saving the file to disk.
In the project, expand the DatabaseMaintenance group. Right-click on the
CreateDatabase program and select Execute. This will
compile and run your script, creating and populating the database.