Project

General

Profile

Actions

Bug #4473

open

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

Added by François Legendre over 8 years ago. Updated over 8 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() ;

Actions #1

Updated by Koen Deforche over 8 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

Actions

Also available in: Atom PDF