@@ -94,6 +94,7 @@ func (c *RuntimeController) Start() (*M2EEResponse, error) {
9494 if err != nil {
9595 return nil , err
9696 }
97+ schemaAttempted := false
9798 if needsDBUpdate (resp ) {
9899 ddl , err := CallM2EE (c .opts , "execute_ddl_commands" , nil )
99100 if err != nil {
@@ -102,12 +103,16 @@ func (c *RuntimeController) Start() (*M2EEResponse, error) {
102103 if msg := ddl .M2EEError (); msg != "" {
103104 return nil , fmt .Errorf ("execute_ddl_commands failed: %s" , msg )
104105 }
106+ schemaAttempted = true
105107 resp , err = CallM2EE (c .opts , "start" , nil )
106108 if err != nil {
107109 return nil , err
108110 }
109111 }
110112 if msg := resp .M2EEError (); msg != "" {
113+ if schemaAttempted {
114+ return resp , fmt .Errorf ("start failed after creating or updating the database schema: %s" , msg )
115+ }
111116 return resp , fmt .Errorf ("start failed: %s" , msg )
112117 }
113118 // The runtime is up; wire the application log to a file (best-effort — a
@@ -214,6 +219,9 @@ func (c *RuntimeController) ApplyBuild(build *BuildResult, restart func() error)
214219// all. This is the normal first boot of the built-in HSQLDB database, whose
215220// JDBC URL carries ifexists=true and therefore never creates the file.
216221//
222+ // Measured on Mendix 11.12.2: a fresh built-in HSQLDB project answers start
223+ // with Result 2 and Message "The database to be used does not exist.".
224+ //
217225// The synchronizationreason feedback is a third signal the runtime sometimes
218226// sends instead of the message.
219227func needsDBUpdate (resp * M2EEResponse ) bool {
0 commit comments