On Mon, Sep 7, 2015 at 2:53 PM, lebouquetin <[email protected]> wrote:
> Alessandro, > > I understand what you tell me. What is strange is that my model also > includes models that are related to my migration script. > So, if the database is setup using the last version of the model, I can't > understand why the new tables are not created. > > So my question move to : why the new models are not taken into account > when setting up the data model ?! > Is it because my setup_schema() function (in websetup/schema.py) is > executing only the following command ? : > > result = model.DBSession.execute(DDL(get_initial_schema())) > Well, yes, usually on tg projects initial schema is created by model.metadata.create_all command, as you replaced it with a custom ddl only the CREATE TABLE statements you issue in your get_initial_schema are actually performed. A quick solution would probably be to also run model.metadata.create_all(bind=config['tg.app_globals'].sa_engine) right after your model.DBSession.execute(DDL(get_initial_schema())) that should run your DDL and then create the missing tables through create_all ignoring those that already exist. -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/turbogears. For more options, visit https://groups.google.com/d/optout.

