Project

General

Profile

Bug #4473

Wt::Dbo::Session::createTables may fail to create a table if another table already exists

Added by Fran├žois Legendre about 7 years ago. Updated about 7 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
09/13/2015
Due date:
% Done:

0%

Estimated time:

Description

The following does not create "table1" if "table2" already exists.

Wt::Dbo::backend::MySQL mysql(...) ;

Wt::Dbo::Session session ;

session.setConnection(mysql) ;

session.mapClass("table1") ;

session.mapClass("table2") ;

session.createTables() ;

#1

Updated by Koen Deforche about 7 years ago

  • Status changed from New to Feedback

Hey,

That's indeed the intended behavior. createTables() cannot handle migrations of an existing database. So as soon as it detects that it cannot simply create the whole schema it will rollback, assuming that the current schema is correct. Typically you need a migration script for migrating older versions of your database schema if you've made changes to it.

Koen

Also available in: Atom PDF