Database Import

There are situations when it is useful to import ORM models based on database structure directly from a database. For example, when you want to connect to a foreign database without any existing schema files (read data from Wordpress site). Or when you want to import an existing project but your ORM framework doesn’t support structured schema files (Laravel, CakePHP, etc. ) and you don’t want to write all definitions from the scratch.

For all of these circumstances, it is handy to use Database import tool. Although database usually doesn’t contain all information as ORM definitions (aliases between objects, entity names, etc.) a lot of settings can be derived from existing tables and columns.

It’s always better to prefer direct schema import if files are available. But when there are no schema files, database import is a good start.

Import new project

The most common scenario is the creation of a new project from existing database structures. To do that choose Create or Import New from the main application menu and select Import from external models.

Skipper import new project function

Import to the existing project

The second scenario is an import of the database to the existing project. This usually happens when you want to access a new foreign database from an existing project. In such situations use Import to Project and select Import from external models.

Skipper Import to existing project function

Once the import process is done, Skipper creates new module and places all imported elements into this module.

Note: In situations when the imported module (or other model elements, e.g. entity) have the same names as an existing object, these objects will be merged.

Example of project import

By the next few steps, we show you how simple and fast is to visualize your existing projects in Skipper. For this example we chose Doctrine2 open-source project CMS Newscoop. Specific steps may vary depending on ORM framework you are using. For more details on how to import a project in your framework check Frameworks tutorials.

Choose Database importer
In Skipper wizard select ORM framework you are using
Next in Skipper wizard select your MVC framework

Select database type for import
Configure database connection
Setup project path and name
Configure import settings
Wait for Skipper to import database structures
Skipper completed the schema files import
Completed database import

All the described steps are very simple. They consist of Database as the external importer, choosing your ORM and MVC framework, selecting Database engine you want to connect and entering database connection params.

Next steps are to enter your project path and name, configure project and run automatic scan of the target database. After a short time, you see imported database as prepared entities in your Skipper project.

Skipper visual representation uses standard notation of the extended ER diagram. You can see an example in the following image.

Imported project ER diagram generated as a Skipper visual model

Imported model is automatically positioned and centered. It is a good starting point to enhance and arrange your model in a more elegant and organized way.

Note: Check also Project export tutorial where is shown how to export ORM schema definition files.