How to "reset" DB scripts and regenerate totally fresh ones from the current model?

So in development of this large, complex application, whilst also learning CUBA itself (as well as Java), I’ve tried lots of ways to accomplish things, which included quite a number of entities and such, which are now gone. There’s a lot of DB drop and update scripts and such out there that are screwing up test deployments (because for example they’re trying to rename and drop tables that don’t exist) - is there a way I can just completely nuke all the DB scripts and regenerate new, fresh ones from the current model only?

Hi Jon Craig, I see that you’re posting a lot of issues on the forum and this is great. The more people are using and testing the CUBA platform, the better for not only us community users, but also for the company.
I’m responding to your question because I too, was in the same boat as you were. I downloaded the CUBA platform and tried my first application. Mind you, that was about 4 years ago. Just like you, even though my application was progressing well, I kept running into some minor and not so many issues and subsequently turned to the forum to get some answers. So that was great because this forum is pretty responsive and especially because a lot of the responses are coming from the developers themselves.
After about 3-5 months of turning to the forum, I realized that it might just be better to invest in purchasing some consulting hours in order to not only speed up the development process but also to get some best practices out of it. To make a long story short, I think I bought around 40-50 hours. The good news was that by just purchasing those hours, I was able to not only deploy my application but I was able to sell it to one of my clients. My client was blown away and within 2 weeks, they moved my application to production. (I work in the financial services industry). I may be wrong but I think I have the first CUBA application deployed in production in the US. :slight_smile:
There’s a lot more to this story, but I just wanted to point out that you’re doing the right thing by turning to the forum for your answers, but if you feel that at some point, you would want to speed up your development process, or even adhere to some best practices (i.e. you mentioned that you’re learning Java as well), it might be well worth it to invest in some services or support hours.

Hi Francis,

I’m employed as the lead programmer for a software company - our application began development in the late 80s, and has grown since then into what is now known as an ERP application. It handles everything needed to run a medical office in a niche medical industry. We have installations in all 50 states.

It’s written in an ancient development environment (DataFlex) and we needed to convert it a decade+ ago but couldn’t find the “right” platform until we found CUBA. So now we’ve begun the conversion.

The CUBA team is amazing; I’ve talked with @stukalov several times now and fairly often get answers from various other team members too.

We’re a tiny company, and can’t afford consulting. We’ll manage. :slight_smile:

Hi @jon.craig,
CUBA generates 2 types of scripts: create and update.

Create scripts will always reflect your current model (entities). Update scripts will be created when your database already existis and is not reflecting your current model (and in development it happens a lot while you update your model).

I’ll share what we are doing. We do have different databases per environemnt (development, quality, production). When we finish the development (and want to deploy the app to quality environment, for example), we delete the update scripts (it doesn’t matter if you delete them all or only the unapplied in the next database environment), change DB configuration to quality database (where the database will be reflecting the previous model used in the last deployment) and generate database scripts again. Then, your update scripts will contain only the needed scripts to the next deployment.

Hope it helps you somehow.

Regards,
Peterson.

1 Like

Hi,

Just delete all scripts from the project/modules/core/db folder and generate them from scratch if you want a complete reset.

JFYI, you have all scripts for the database creation in the project/modules/core/db/init/{db_type}/ folder, so you can use them to recreate the db. All update scripts are in project/modules/core/db/update/{db_type}/ folder, you can delete them if you don’t need to patch your database in production and you’re just playing around with CUBA.

You can find more information in the documentation: Database Migration Scripts - CUBA Platform. Developer’s Manual