Schema Update
Information
- Certain information in the data dictionary must be reflected in the database schema. This means, for example, that
- all real and activated DIs or activated data tables also exist in the database in the form of data tables or views.
- the column types (data types) must coincide.
- Exception: Data tables or DIs (columns) that are not contained in the data dictionary can exist in the database. They cannot be accessed via modules but only via SQL statements.
- When making various changes to the DT412 Data item data table (which defines columns of data tables), it is necessary to make these changes to the database as well.
- If a new DI is created in a data table, it has to exist in the DT412 Data item as well as in the database.
- In order to simplify this, changes to DT412 Data item which cause changes to be made to the database are automatically written in a text file. It can subsequently be run in the SqlDeveloper in order to update the schema in the database.
Details
- The changes mentioned above apply to the following operations:
- A new DI (activated= , virtual = ) is created.
- An existing DI (activated= , virtual = ) is deleted.
- An existing DI is (de)activated.
- Since it is also necessary to migrate the data here, all further changes that require changes to be made to the database, e.g. changing the column type, have to be removed with the help of a migration packet.
- If the first change is saved, the following dialog message is displayed: Due to your changes to DT412, your database must be adjusted. Please select the appropriate ./28_*.sql file (depending on the database system) and run the content on your database.
- When further changes are made in the same session, the dialog message is not displayed again. All changes made in one session are written into the same file.
- The name of such files is composed of the tread number and the current date (e.g.
20_Oracle10g_25.07.2012_changes.sql
).
- By running this file on the database, the schema is updated with the changes made to PLANTA project.
- If a data item is deactivated, the SchemaUpdate generates a drop statement for the data item and writes it in the text file. If you first want to check whether this DI is no longer required, this statement should not be run on the database to begin with since this causes the data item including its content to be deleted.
Text file
- Regardless of the format of the actually used database, two text files will be created: one for Oracle and one for MSSQL.
- Hence, you have to make sure that only the correct version is run.
- The directory in which the text files are created is the same as that to which the schemas are exported.
- This directory can be set in the Global Settings in the export_path_databasescheme parameter in the Template code data field. If this data field is empty or if export_path_databasescheme does not exist, it is written in the PLANTA home directory by default.