Mike Bayer [Tue, 31 Dec 2013 20:01:50 +0000 (15:01 -0500)]
- The :class:`.ScriptDirectory` system that loads migration files
from a ``versions/`` directory now supports so-called
"sourceless" operation, where the ``.py`` files are not present
and instead ``.pyc`` or ``.pyo`` files are directly present where
the ``.py`` files should be. Note that while Python 3.3 has a
new system of locating ``.pyc``/``.pyo`` files within a directory
called ``__pycache__`` (e.g. PEP-3147), PEP-3147 maintains
support for the "source-less imports" use case, where the
``.pyc``/``.pyo`` are in present in the "old" location, e.g. next
to the ``.py`` file; this is the usage that's supported even when
running Python3.3. #163
Mike Bayer [Fri, 27 Dec 2013 17:37:07 +0000 (12:37 -0500)]
- clean out test_autogenerate
- start pinning some tests to 0.9, don't need to pin to 0.7 anymore
- Autogenerate for ``op.create_table()`` will not include a
``PrimaryKeyConstraint()`` that has no columns.
- don't need a full string test for boolean/check constraint autogen
Mike Bayer [Fri, 27 Dec 2013 06:51:43 +0000 (01:51 -0500)]
- more for #157:
- the ``op.create_table()`` directive will be auto-generated with
the ``UniqueConstraint`` objects inline, but will not double them
up with a separate ``create_unique_constraint()`` call, which may
have been occurring. Indexes still get rendered as distinct
``op.create_index()`` calls even when the corresponding table was
created in the same script.
- the inline ``UniqueConstraint`` within ``op.create_table()`` includes
all the options like ``deferrable``, ``initially``, etc. Previously
these weren't rendering.
- fixed the index tests to make sure the connection closes after each test
- _render_unique_constraint() and _add_unique_constraint() both call into
a common function now
- call _alembic_autogenerate_prefix within the add_index/drop_index renders
Mike Bayer [Fri, 20 Dec 2013 20:29:57 +0000 (15:29 -0500)]
- repair the autogen index test which apparently wasn't running for Postgresql
due to a hardcoded sqlite_db()
- get autogen index test cleaned up, working on Postgresql and MySQL
- rework the autogen index/unique constraint logic to consider both sets of
objects together, and work up all new rules for deduping, comparison.
Add new rules specific to MySQL and SQLite and expand the flexibility surrounding
the "dupe unique index/unique constraint" thing to work around MySQL doing it
in both directions, handles #157
- add a lot more tests and try to emphasize no false positives
Mike Bayer [Wed, 11 Dec 2013 22:00:06 +0000 (17:00 -0500)]
- Fixed an issue with unique constraint autogenerate detection where
a named ``UniqueConstraint`` on both sides with column changes would
render with the "add" operation before the "drop", requiring the
user to reverse the order manually.
- reorganize the index/unique autogenerate test into individual test cases;
ideally the whole test suite would be broken out like this for those big
tests
Mike Bayer [Sat, 7 Dec 2013 00:05:53 +0000 (19:05 -0500)]
- Added new argument ``mssql_drop_foreign_key`` to
:meth:`.Operations.drop_column`. Like ``mssql_drop_default``
and ``mssql_drop_check``, will do an inline lookup for a
single foreign key which applies to this column, and drop it.
For a column with more than one FK, you'd still need to explicitly
use :meth:`.Operations.drop_constraint` given the name,
even though only MSSQL has this limitation in the first place.
Mike Bayer [Wed, 27 Nov 2013 00:05:03 +0000 (19:05 -0500)]
- rework mysql tests to have suites
- add a test to verify pullreq #5 - check if a TIMESTAMP column with
CURRENT_TIMESTAMP as default successfully compares for equality/inequality.
test passes without the pullreq, so no failure case has been demonstrated.
Mike Bayer [Thu, 21 Nov 2013 23:46:35 +0000 (18:46 -0500)]
Fixes to Py3k in-place compatibity regarding output encoding and related;
the use of the new io.* package introduced some incompatibilities on Py2k.
These should be resolved, due to the introduction of new adapter types
for translating from io.* to Py2k file types, StringIO types.
Thanks to Javier Santacruz for help with this.
Mike Bayer [Thu, 21 Nov 2013 22:47:24 +0000 (17:47 -0500)]
Fixed the output wrapping for Alembic message output, so that
we either get the terminal width for "pretty printing" with
indentation, or if not we just output the text as is; in any
case the text won't be wrapped too short. #135
Javier Santacruz [Thu, 17 Oct 2013 15:24:28 +0000 (17:24 +0200)]
Fixes stdout --sql output in python2
When output_encoding is set, wraps the output buffer into a io.TextIOWrapper class
This means that the output_buffer has to be a io.IOBase instance
in order to work along with the TextIOWrapper
Handles wrapping when the buffer is Python2 stdtout, which has 'file' type
Adds test for this situation
Mike Bayer [Fri, 11 Oct 2013 21:14:28 +0000 (17:14 -0400)]
- fix the change we did in 56a178d2181c84ab8bf2edbe6fdf8439f4 so that the unique constraint/index thing
on PG still works
- replicate the index test for PG
Mike Bayer [Sun, 8 Sep 2013 21:04:17 +0000 (17:04 -0400)]
- refactor autogeneration into its own package
- remove any implicit naming of unique constraints - only explcitly named constraints
are supported by autogenerate
- ensure we correctly handle the case where unique reflection raises not implemented
- fix some naming conventions, changes to expressions for readability
Mike Bayer [Fri, 23 Aug 2013 17:25:31 +0000 (13:25 -0400)]
- Ensured that strings going to stdout go through an encode/decode phase,
so that any non-ASCII characters get to the output stream correctly
in both Py2k and Py3k. Also added source encoding detection using
Mako's parse_encoding() routine in Py2k so that the __doc__ of a
non-ascii revision file can be treated as unicode in Py2k.
Mike Bayer [Thu, 11 Jul 2013 23:07:14 +0000 (19:07 -0400)]
Added new kw argument to :meth:`.EnvironmentContext.configure`
``include_object``. This is a more flexible version of the
``include_symbol`` argument which allows filtering of columns as well as tables
from the autogenerate process,
and in the future will also work for types, constraints and
other constructs. The fully constructed schema object is passed,
including its name and type as well as a flag indicating if the object
is from the local application metadata or is reflected.
Mike Bayer [Wed, 26 Jun 2013 21:08:32 +0000 (17:08 -0400)]
The output of the ``alembic history`` command is now
expanded to show information about each change on multiple
lines, including the full top message,
resembling the formatting of git log.
Mike Bayer [Sun, 2 Jun 2013 05:45:20 +0000 (01:45 -0400)]
- Added :attr:`alembic.config.Config.cmd_opts` attribute,
allows access to the `argparse` options passed to the
`alembic` runner.
- Added new command line argument ``-x``, allows extra arguments
to be appended to the command line which can be consumed
within an ``env.py`` script by looking at
``context.config.cmd_opts.x``.