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:
'use strict';
const _ = require('lodash');
const { singular } = require('pluralize');
const { contentTypes: contentTypesUtils } = require('strapi-utils');
const {
getDefinitionFromStore,
storeDefinition,
getColumnsWhereDefinitionChanged,
} = require('./utils/store-definition');
const { getManyRelations } = require('./utils/associations');
const migrateSchemas = async ({ ORM, loadedModel, definition, connection, model }, context) => {
// Add created_at and updated_at field if timestamp option is true
if (loadedModel.hasTimestamps) {
definition.attributes[loadedModel.hasTimestamps[0]] = { type: 'currentTimestamp' };
definition.attributes[loadedModel.hasTimestamps[1]] = { type: 'currentTimestamp' };
}
This file has been truncated. show original
And probably something to do with:
https://github.com/strapi/strapi/blob/master/packages/strapi-connector-bookshelf/lib/database-migration.js