Convert an existing database into a Project

As of 4D v17 R5, you can create a database project. One of the greatest benefits of projects is how easy it makes collaborative work for distributed teams … by storing the source in a source control system in plain text files. Whether you’re a single developer or part of a team, this opens a new world of possibilities

But what about existing databases? Can they be converted to projects? Yes! This blog post is all about showing you how to do this and making you aware of a few things to know before proceeding.

Convert your database

Conversion does not change the.4DB file (the binary database structure file). A new “Project” folder is created next to your .4DB. This allows you to convert your binary database multiple times (could be useful for testing). Keep in mind that conversion is one-way only. This means that once you convert to a project and start making changes, you cannot automatically reintegrate these changes into your .4DB.

Conversion is very simple, just click the  “File > Export > Structure to project” menu item:

 

 

You can choose to open the project via a “Open project” button (displayed in the conversion dialog) or using the traditional method for opening a database.

So what really happens during conversion?

Next to the .4DB, a new .4DProject folder is created. It contains all of your code, forms, structure, methods, triggers, menus, tips, lists, etc.:

blank

In the .4DProject folder, the project uses the same Resources and Web folders as the .4DB. This makes testing your project easier. Open your .4DB database, make some changes, then export it again and test the results. You can repeat this operation until you are satisfied with the conversion. 

Compatibility notes

In projects, we have removed some obsolete features and plan to update others:

  • The Picture Library no longer exists in projects. During conversion, 4D exports all of your images to the Resources folder.
  • A new and more modern implementation to expand the possibilities for style sheets will be provided in a future version.
  • In response to your comments, a new user management system for users and groups is in the works.
  • Changes have been made to form objects and their properties. In fact, they use the same grammar as Dynamic forms.
  • Compatibility settings are reset (as for a new binary database). If you want to verify that your code is up to date, please check out Thomas Maul’s blog post series on compatibility settings.

Check your conversion

There’s no need to worry about converting your database. The conversion doesn’t change your structure (.4DB) or your data (.4DD). A log file is created during the conversion, with messages classified into three categories: info, warning, and error.

For example, if you have images in the Picture Library, 4D exports them to the Resources folder of your project. In the log file, the correspondence between the ID of the picture and the name of the file is recorded:

{
   "message": "Exporting picture id:1, name:logo.png, types:.png to <...>:Resources:Images:library:logo.png",
   "severity": "info"
}

Some errors may require your intervention (e.g., your database used old form objects that are no longer supported, such as highlight buttons). In this case, you must manually convert the button to a 3D button.

{
   "table": 3,
   "tableName": "Name",
   "form": "Form",
   "object": "button",
   "message": "Highlight buttons are unsupported. Please convert them to 3D buttons.",
   "severity": "error"
}

Either way, 4D informs you of everything it does. All you have to do is read the log for a better understanding of what happened during the conversion (or just to have useful information).

What to expect?

This is the very first (Beta) version of the Project. The related features will soon be rolling out to our partners starting with 4D v17 R5 Beta. In contrast to other features, which are included in R-Releases only (after being fully tested and deemed production-ready), Projects is still in development and for testing purposes only. It should not be used in production yet, as it is not 100% complete and bug-free. That being said, your feedback is needed now more than ever.

The tests will continue with 4D v17 R6 Beta. With the upcoming 6 months of tests and your help, 4D v18 will be a landmark in the history of 4D.

Join the discussion in our “beta version” forum (accessible for all 4D Partners).

Vanessa Talbot
• Product Owner •Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.