Change the last row of schema.py from websetup in:

from migrate.exceptions import DatabaseAlreadyControlledError
from migrate.versioning.shell import main
try:
    main(argv=['version_control'], url=config['sqlalchemy.url'],
repository='migration', name='migration')
except DatabaseAlreadyControlledError:
   pass

2011/7/16 Timuçin Kızılay <[email protected]>:
> I have run setup-app in an existing project after I add another table to
> database models.
>
> in the old TG 2.1, adding tables was working, but now I had to delete the
> database.
>
> What is the best way to use this new TG behaviour?
>
>
> 15-07-2011 19:36, Alessandro Molina yazmış:
>>
>> Have you started a new project or are you running setup-app in an
>> already existing project?
>> This error is related to the facts that your database has already
>> migrations initialized.
>>
>> Most common cause is running setup-app without having deleted
>> devdata.db from a previous run
>>
>> 2011/7/15 Timuçin Kızılay<[email protected]>:
>>>
>>> Hello,
>>>
>>> I hope anybody can help me about this.
>>>
>>> I'm using TG 2.1 (latest stable version) with SA 0.7 (This is from tg
>>> downlad site too)
>>>
>>> When I use the command
>>> paster setup-app development.ini
>>>
>>> to create my tables, I'm getting errors.
>>>
>>> When I comment out the last two lines from the schema.py it looks ok but
>>> I'm
>>> confused about this error.
>>> The lines I've commented out in schema.py:
>>>    from migrate.versioning.shell import main
>>>    main(argv=['version_control'], url=config['sqlalchemy.url'],
>>> repository='migration', name='migration')
>>>
>>> Here is the output error lines of paster setup-app command:
>>>
>>> 10:51:12,334 INFO  [sqlalchemy.engine.base.Engine] PRAGMA
>>> table_info("migrate_version")
>>> PRAGMA table_info("migrate_version")
>>> 10:51:12,334 INFO  [sqlalchemy.engine.base.Engine] ()
>>> ()
>>> 10:51:12,340 DEBUG [sqlalchemy.engine.base.Engine] Col ('cid', 'name',
>>> 'type', 'notnull', 'dflt_value', 'pk')
>>> Col ('cid', 'name', 'type', 'notnull', 'dflt_value', 'pk')
>>> 10:51:12,341 DEBUG [sqlalchemy.engine.base.Engine] Row (0,
>>> u'repository_id',
>>> u'VARCHAR(250)', 1, None, 1)
>>> Row (0, u'repository_id', u'VARCHAR(250)', 1, None, 1)
>>> 10:51:12,341 DEBUG [sqlalchemy.engine.base.Engine] Row (1,
>>> u'repository_path', u'TEXT', 0, None, 0)
>>> Row (1, u'repository_path', u'TEXT', 0, None, 0)
>>> 10:51:12,342 DEBUG [sqlalchemy.engine.base.Engine] Row (2, u'version',
>>> u'INTEGER', 0, None, 0)
>>> Row (2, u'version', u'INTEGER', 0, None, 0)
>>> 10:51:12,350 INFO  [sqlalchemy.engine.base.Engine] SELECT
>>> migrate_version.repository_id, migrate_version.repository_path,
>>> migrate_version.version
>>> FROM migrate_version
>>> WHERE migrate_version.repository_id = ?
>>> SELECT migrate_version.repository_id, migrate_version.repository_path,
>>> migrate_version.version
>>> FROM migrate_version
>>> WHERE migrate_version.repository_id = ?
>>> 10:51:12,350 INFO  [sqlalchemy.engine.base.Engine] ('migration',)
>>> ('migration',)
>>> 10:51:12,362 DEBUG [sqlalchemy.engine.base.Engine] Col ('repository_id',
>>> 'repository_path', 'version')
>>> Col ('repository_id', 'repository_path', 'version')
>>> 10:51:12,363 DEBUG [sqlalchemy.engine.base.Engine] Row (u'migration',
>>> u'migration', 0)
>>> Row (u'migration', u'migration', 0)
>>> Traceback (most recent call last):
>>>  File "/home/tim/tg2env/bin/paster", line 9, in<module>
>>>    load_entry_point('PasteScript==1.7.3', 'console_scripts', 'paster')()
>>>  File
>>>
>>> "/home/tim/tg2env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py",
>>> line 84, in run
>>>    invoke(command, command_name, options, args[1:])
>>>  File
>>>
>>> "/home/tim/tg2env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py",
>>> line 123, in invoke
>>>    exit_code = runner.run(args)
>>>  File
>>>
>>> "/home/tim/tg2env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py",
>>> line 68, in run
>>>    return super(AbstractInstallCommand, self).run(new_args)
>>>  File
>>>
>>> "/home/tim/tg2env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py",
>>> line 218, in run
>>>    result = self.command()
>>>  File
>>>
>>> "/home/tim/tg2env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py",
>>> line 456, in command
>>>    self, config_file, section, self.sysconfig_install_vars(installer))
>>>  File
>>>
>>> "/home/tim/tg2env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py",
>>> line 598, in setup_config
>>>    mod.setup_app, command, filename, section, vars)
>>>  File
>>>
>>> "/home/tim/tg2env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py",
>>> line 612, in _call_setup_app
>>>    func(command, conf, vars)
>>>  File "/home/tim/tg2env/om/om/websetup/__init__.py", line 18, in
>>> setup_app
>>>    setup_schema(command, conf, vars)
>>>  File "/home/tim/tg2env/om/om/websetup/schema.py", line 23, in
>>> setup_schema
>>>    main(argv=['version_control'], url=config['sqlalchemy.url'],
>>> repository='migration', name='migration')
>>>  File
>>>
>>> "/home/tim/tg2env/lib/python2.6/site-packages/sqlalchemy_migrate-0.7.1-py2.6.egg/migrate/versioning/shell.py",
>>> line 207, in main
>>>    ret = command_func(**kwargs)
>>>  File "<string>", line 2, in version_control
>>>  File
>>>
>>> "/home/tim/tg2env/lib/python2.6/site-packages/sqlalchemy_migrate-0.7.1-py2.6.egg/migrate/versioning/util/__init__.py",
>>> line 159, in with_engine
>>>    return f(*a, **kw)
>>>  File
>>>
>>> "/home/tim/tg2env/lib/python2.6/site-packages/sqlalchemy_migrate-0.7.1-py2.6.egg/migrate/versioning/api.py",
>>> line 249, in version_control
>>>    ControlledSchema.create(engine, repository, version)
>>>  File
>>>
>>> "/home/tim/tg2env/lib/python2.6/site-packages/sqlalchemy_migrate-0.7.1-py2.6.egg/migrate/versioning/schema.py",
>>> line 139, in create
>>>    table = cls._create_table_version(engine, repository, version)
>>>  File
>>>
>>> "/home/tim/tg2env/lib/python2.6/site-packages/sqlalchemy_migrate-0.7.1-py2.6.egg/migrate/versioning/schema.py",
>>> line 187, in _create_table_version
>>>    raise exceptions.DatabaseAlreadyControlledError
>>> migrate.exceptions.DatabaseAlreadyControlledError
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "TurboGears" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/turbogears?hl=en.
>>>
>>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to