Strapi develop --no-build-models

Hello,

So, I’m planning to add an argument for “strapi develop”, called “–no-build-models”, or something similar, in that case I want strapi to skip all the verifications on database (all these checks: if table exists, if column exists and etc). As 90% of my time I write code that is not related to contentType changes, so I don’t want strapi to make these checks on every restart, as I make modifications to db structure maybe once a day, but it takes long to restart when you have a big project, for example just to add a console.log output costs me about 20-30seconds.
Any idea where to start? Or even better the url from git, to the file that verifies if table/columns exist.
@DMehaffy

Thank you.

I think this is probably something we need to add in natively, so the best place to start with something like this is an RFC especially as we start getting into the Knex Migrations topic.

I remember a convo like this coming up on GitHub but for some reason I can’t find the related issue. There are a few parts to the cold boot validation:

  • Connection pool initialization
  • Validation of table/column structure (constraints, indexes, and keys)
  • Users-Permissions validation (Checking for roles, permissions)
  • Strapi-Admin validation (checking there is at least one registered admin user)
  • Core_Store initialization (dumping of the model structure into the core_store and init the views)

I’ll want to see the feedback from our engineering team before I suggest too much (though I am 100% on board with this as I feel your pain on the cold boot times).

The command itself would be part of the strapi package: strapi/packages/strapi/lib/commands at master · strapi/strapi · GitHub

From there we would pass something into the strapi-database package: strapi/packages/strapi-database at master · strapi/strapi · GitHub which would relay that into the connectors (mongoose/bookshelf)

IIRC the cold boot initialization for the bookshelf connector is handled here:

And probably something to do with:
https://github.com/strapi/strapi/blob/master/packages/strapi-connector-bookshelf/lib/database-migration.js