Generate Model from Existing Database

Can you please direct me the documentation how to use an existing database of legacy system to (1) migrate to CUBA-Platform (2) use the database shared between CUBA and non-CUBA-application?


I’ve used this feature and it seems to be working. What i did was run the scripts to create my existing tables into the CUBA table. Then from CUBA studio, I clicked on “Generate Model”. It will start a wizard where you can choose your tables. Follow the wizard and at the end your tables will show up as entity for your app.

1 Like

Thank you. Can you little more explain which script did you run and where?

When I say “script”, I meant that I used a script to generate the tables but you don’t have to do. You can create the tables manually in the CUBA database and then follow the steps above.

I was trying to understand how can I get the tables from legacy database in the studio instead of creating them.

I think that’s what “Generate Model from Database” does. Right now, if you have an existing legacy database and would like to have the tables show up in Cuba Studio as entities, you have to use the “Generate Model…”.

In my case, I had an existing MS SQL database with some tables that I wanted to incorporate into CUBA. So here’s what I did:
step 1: Open SQL Server Management Studio
Step 2: select the tables I wanted to recreate, right-click and select “Script tables as CREATE…”. This will generate a SQL script to recreate the table.
Step 3: change the script so that it will create the tables in your CUBA application.
Step 4: run the script.
Step 5: now the tables are in your CUBA application but they don’t yet show up in CUBA studio. To make them show up in CUBA studio so that those tables are represented as Entities, run the “Generate Model from database…”

1 Like

Hi guys,

@Francis Nzeutem: when you say “Step 3: change the script so that it will create the tables in your CUBA application.” do you mean that i have to include in the script all field of CUBA framework like “VERSION”, “CREATE_TS” etc.?

A post was split to a new topic: Trying to migrate legacy application into CUBA platform