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()))

(you can have the file on github : 
https://github.com/tracim/tracim/blob/master/tracim/tracim/websetup/schema.py 
)

Thanks for your help

Damien

Le dimanche 6 septembre 2015 09:17:05 UTC+2, Alessandro Molina a écrit :
>
> That will set your DB as being at the last version but won't apply any 
> migration
> That is because your schema is supposed to be already at the latest 
> version when you run setup-app, and that should be the case as the db is 
> created from the models and the models should reflect the last schema 
> version.
>
> If you need any bootstrap data which is inserted by migrations you should 
> also add it from your websetup.bootstrap module which is in charge of 
> creating the initial data for your app.
>
> Also keep in mind that during tests the db is created and destroyed on 
> each test unit, as they should all start from a reset starting point, so 
> you are in charge of creating the proper data on each test fixture.
>
> If you want your db to be upgraded to latest migration you need to use 
> alembic.command.upgrade but that will usually break everything as is 
> usually impossible to apply migrations on the newly created schema which is 
> already the the final state.
>
> On Thu, Sep 3, 2015 at 7:11 PM, lebouquetin <[email protected] 
> <javascript:>> wrote:
>
>> Hi all,
>>
>> I uses Travis-CI pour automatic tests of my Turbogears Application. The 
>> build fails because tests fail, because Alembic migration is not applied.
>>
>> On local development box, running *gearbox migrate upgrade* is ok.
>> But running with test.ini configuration - *gearbox migrate -c test.ini 
>> upgrade* returns the following output :
>>
>> (venv)root@ulysse:/tmp/tracim_repo/tracim# gearbox migrate -c test.ini 
>> upgrade
>> 18:25:21,451 INFO  [alembic.migration] Context impl PostgresqlImpl.
>> 18:25:21,451 INFO  [alembic.migration] Will assume transactional DDL.
>>
>> The patch is not applied.
>>
>> What is the way to apply alambic upgrade for test environment ?
>>
>> Note : according to the documentation - 
>> http://turbogears.readthedocs.org/en/latest/turbogears/migrations.html, 
>> I added to setup-app the following lines at the end of the setup_schema() 
>> function (the code is executed - I tested it with some debug printing) : 
>>
>>
>> import alembic.config, alembic.command
>> alembic_cfg = alembic.config.Config()
>> alembic_cfg.set_main_option("script_location", "migration")
>> alembic_cfg.set_main_option("sqlalchemy.url", config['sqlalchemy.url'])
>> alembic.command.stamp(alembic_cfg, "head")
>>
>> Note : I'm working with turbogears 2.4
>>
>> Thanks for your help
>>
>> Damien
>>
>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/turbogears.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.

Reply via email to