Skip to content
Aleksey Stukalov edited this page Dec 7, 2016 · 20 revisions

Migration of a Legacy Application to CUBA Platform

We used an official MS LightSwitch sample application in order to show how your legacy application can be migrated to CUBA Platform. This project contains a CUBA application, which:

  • replicates the UI and business logic of the original MS Lightswitch application
  • uses its database
  • has been produced with the help of the CUBA Studio migration tool

The migration tool doesn't change the structure of existing tables, so CUBA and LS applications will have the ability to work simultaneously, using the same instance of the database.

##LightSwitch Application

You can find the development guide for the Vision Clinic sample and create it yourself or simply download it.

The Vision Clinic example stores data in two different databases, linking data between them. In order to simplify the example, we merge the two databases into one and create a foreign key between Product and InvoiceDetails tables, so the DB schema looks as follows:

db-schema

In fact, for our purposes we don’t need the whole Lightswitch application, it is sufficient to have only its database. You can find instructions on how to create it in the Database section.

Database

To make your application up and running on MS SQL Server:

  1. Download and install MS SQL Server 2012+ from the official website.
  2. Run create-db.sql script; then run insert-data.sql script; finally apply the create-cuba-related-tables.sql script to create all CUBA-related tables and data.
  3. Enable SQL Server and Windows Authentication mode and sa user to login as it is shown here. Remember password for the sa, it will be used for connecting the database from our CUBA application.

Run CUBA application

Follow the steps below to run the application:

  1. Download and install the latest version of the CUBA Studio.
  2. Download or clone the project to your local PC.
  3. Run the CUBA Studio server and open it in a browser (default URL is http://localhost:8111/studio/).
  4. Import the project by selecting its folder. import project
  5. By default, the application uses in-memory relational database management system HSQL, so you already can start the application and the Studio will create a new empty database. You can navigate through the application, create products, invoices and so on. Proceed to the next step to see how it works with the original database of our legacy application.
  6. Follow the instructions in the Database section.
  7. Specify connection parameters to the database in project properties (note that if you use SQLEXPRESS or named instance you should specify your instance name in Connection Params, e.g. ;instance=SQLEXPRESS). project properties
  8. Press test connection and if shows success, invoke Run -> Start Application Server from the menu.