How to downgrade database version of an existing Cuba Studio project?

Let me tell you the problem context for understanding the situation.
My project is replace a legacy application with the development new application modules in Cuba Platform, coexisting with the other modules of the legacy system.

The legacy application database is MS-SQL Server 2005, but the customer had the intention to migrate the database to a newer version along with a renewal of the TI infraestructure.

Under these premises I began to develop an application module with Cuba Platform, setting the dabase type propertie of my Cuba Studio projects to Microsoft SQL Server 2012+ in the Staging environment, having restored a database backup of the production environment of the legacy application in Sql Server 2005 into a Sql Server 2016 database.

In order to avoid modifying the tables structure in the legacy database, I created a new database for the modules created with Cuba Studio that acces to the master tables of the legacy application trough views. There are two Cuba Studio projects:

  • Legacy master tables project: Only contains entities mapped to views of the legacy master tables and browser screens. The main goal of this Cuba Studio project is to be distributed like an install application component to the Maven repository.

  • The new module application project: This project uses the application component of the legacy master tables project and it has new entities and business logic for the new module application.

But now, the customer informed me that the final version of database production environment would be Sql Server 2008 R2, because there are some dependencies with legacy application that hinders to upgrade to a SQL Server 2016 version.

Which is the best method to proceed for downgrading the database version of my existing projects? It’s so easy as change the database type property to “Microsoft Sql Server” and rebuild the project? Or it’s necessary to create a projecte from scratch with the database property acording to the correct version of Sql Server and create again all the entities of the legacy master tables mapped to the database views?

I’b be very grateful if someone with more experience in Cuba Studio projects could give me some advices in this respect.

Hi Xavier,

From the framework perspective, the only difference between MS SQL Server 2008 and 2012+ is in generating sequences: on the former it uses tables, on the latter is uses native DB sequences. The sequences are used in the UniqueNumbers feature and for generation of Long/Integer entity identifiers (not IDENTITY or UUID). Corresponding database objects (tables or sequences) are created dynamically at runtime.

Also, when Studio generates DDL by data model, it uses datetime2 type for date/time attributes on SQL Server 2012+.

So you definitely don’t need to recreate entities in the project, just change the DB type and fix DDL scripts by replacing datetime2 with datetime.

Regards,
Konstantin

1 Like

Thank you, Konstantin

I’m very grateful for your detailed explanation.

I’m going to try the solution that you propose.

Regards,
Xavier