aishee / sqlalchemy-migrate

Automatically exported from code.google.com/p/sqlalchemy-migrate
MIT License
0 stars 0 forks source link

test command fails #41

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. use version 1 file: http://paste.pocoo.org/show/97348/
2. use version 2 file: http://paste.pocoo.org/show/97350/
3. version_control your db
4. don't upgrade yet
5. run test

What is the expected output? What do you see instead?
Expected:
Upgrading... done
Downgrading... done
Success
I see:
Upgrading... ERROR
Traceback (most recent call last):
  File "manage-mysql.py", line 4, in <module>
    main(url='mysql://root@127.0.0.1/test',repository='my_repository')
  File
"/home/florian/.virtualenvs/sa-migrate/sqlalchemy-migrate/migrate/versioning/she
ll.py",
line 140, in main
    ret = command(**kwargs)
  File
"/home/florian/.virtualenvs/sa-migrate/sqlalchemy-migrate/migrate/versioning/api
.py",
line 103, in test
    script.run(engine,1)
  File
"/home/florian/.virtualenvs/sa-migrate/sqlalchemy-migrate/migrate/versioning/scr
ipt/py.py",
line 87, in run
    func()
  File "my_repository/versions/002_Change_column.py", line 8, in upgrade
    table = Table('account', meta, autoload=True)
  File
"/home/florian/.virtualenvs/sa-migrate/lib/python2.5/site-packages/SQLAlchemy-0.
5.0rc4-py2.5.egg/sqlalchemy/schema.py",
line 112, in __call__
    return type.__call__(self, name, metadata, *args, **kwargs)
  File
"/home/florian/.virtualenvs/sa-migrate/lib/python2.5/site-packages/SQLAlchemy-0.
5.0rc4-py2.5.egg/sqlalchemy/schema.py",
line 241, in __init__
    _bind_or_error(metadata).reflecttable(self,
include_columns=include_columns)
  File
"/home/florian/.virtualenvs/sa-migrate/lib/python2.5/site-packages/SQLAlchemy-0.
5.0rc4-py2.5.egg/sqlalchemy/engine/base.py",
line 1237, in reflecttable
    self.dialect.reflecttable(conn, table, include_columns)
  File
"/home/florian/.virtualenvs/sa-migrate/lib/python2.5/site-packages/SQLAlchemy-0.
5.0rc4-py2.5.egg/sqlalchemy/databases/mysql.py",
line 1696, in reflecttable
    sql = self._show_create_table(connection, table, charset)
  File
"/home/florian/.virtualenvs/sa-migrate/lib/python2.5/site-packages/SQLAlchemy-0.
5.0rc4-py2.5.egg/sqlalchemy/databases/mysql.py",
line 1867, in _show_create_table
    raise exc.NoSuchTableError(full_name)
sqlalchemy.exc.NoSuchTableError: account

What version of the product are you using? On what operating system?
trunk, sa0.5

Please provide any additional information below.
The problem is that test only tests the latest version (in
migrate/versioning/api.py line 99) instead of testing from db_version +1
onwards. Or should I use an other approach to do my stuff? (I plan to use
the table for Column.alter statements and have no idea, how I could achieve
that in another way)

Anyway the test behaviour should get documented and the docstrings suggests
that there is an optional Version argument, which isn't True either.

Original issue reported on code.google.com by f.apollo...@gmail.com on 30 Dec 2008 at 3:55

GoogleCodeExporter commented 9 years ago
That would be a working version 2 script: http://paste.pocoo.org/show/97351/

Original comment by f.apollo...@gmail.com on 30 Dec 2008 at 4:03

GoogleCodeExporter commented 9 years ago
Testing is really limited at the moment. As the documentation says testing 
should not
be done on production databases but on copies of them.

Original comment by jan.ditt...@gmail.com on 18 Feb 2009 at 8:15

GoogleCodeExporter commented 9 years ago
If possible, could test also run 'version_control 0' if it is supplied an 
uncontrolled database? 

Original comment by Letharg...@gmail.com on 29 Mar 2012 at 8:34