3. Editing structure
OrmFactory is a database model editor. This means you can modify the data model independently of the actual database structure. If you have an active connection, OrmFactory will prompt you to duplicate the changes to the database structure.
As a result, the database structure may differ from the model. This can be useful when you have multiple instances of the same database, such as prod, dev, local and test.
You can make changes locally and later synchronize them with other environments.
Project structure
OrmFactory works with a single model file at a time, referred to as a "Project". Visually, the project structure can be seen in the project explorer.
OrmFactory saves project files in XML format. This allows you to merge changes in version control systems such as git, and also edit the project file in notepad if necessary.
Let's see what a project file consists of.
<?xml version="1.0" encoding="utf-8"?>
<Project Software="OrmFactory.com">
<Database Name="Schemas" Type="MySql">
<Schema Name="...">
<Table Name="...">
...
</Table>
</Schema>
</Database>
<Layout Name="Main">
...
</Layout>
<Connection DataBaseType="MySql" Name="..." />
<Generator Type="Python" Name="...">
...
</Generator>
</Project>
At the top level, a project file consists of databases, layouts, connections, and generators.
A database consists of schemas that share a single connection. There can only be one connection to a database at a time. Foreign keys are scoped within the same database.
Schema is a DBMS term. As in any DBMS, a schema contains tables.
Tables contains columns, indexes, primary keys, foreign key as well as information that is stored only in the model, but not in the DBMS.
At the top level, after the databases, the project contains connections. A project file contains only project connections, not local connections. Local connections stored in a separate location beside of settings.
After the connections come the generators. For more information see the article about generators.
Undo/redo
Since OrmFactory is a model editor, it can use such a powerful tool as maintaining a history of local changes. Just like in traditional desktop applications, change history management is done through the undo/redo buttons.
You can undo any change to the model at any time. Moving a table in a layout, deleting a diagram, synchronizing with a database and any other changes.
Warning: OrmFactory cannot undo changes sent to the database. This mechanism works exclusively with the data model.
Hint: you can undo a change to the model and synchronize with the database. Perhaps this will undo the changes if they were not irreversible.