Mike Bayer [Wed, 19 Feb 2014 01:44:16 +0000 (20:44 -0500)]
- Fixed a failure of the system that allows "legacy keyword arguments"
to be understood, which arose as of a change in Python 3.4 regarding
decorators. A workaround is applied that allows the code to work
across Python 3 versions. #175
Mike Bayer [Sun, 2 Feb 2014 21:42:29 +0000 (16:42 -0500)]
- Added a workaround for when we call ``fcntl.ioctl()`` to get at
``TERMWIDTH``; if the function returns zero, as is reported to occur
in some pseudo-ttys, the message wrapping system is disabled in the
same way as if ``ioctl()`` failed. #172
Mike Bayer [Sat, 1 Feb 2014 17:29:03 +0000 (12:29 -0500)]
- Added new argument
:paramref:`.EnvironmentContext.configure.user_module_prefix`.
This prefix is applied when autogenerate renders a user-defined type,
which here is defined as any type that is from a module outside of the
``sqlalchemy.`` hierarchy. This prefix defaults to ``None``, in
which case the :paramref:`.EnvironmentContext.configure.sqlalchemy_module_prefix`
is used, thus preserving the current behavior. #171
- added new documentation sections regarding rendering of types
- improved CSS so that deprecations/version changes are highlighted
- cleanup of some configure paramter docs
Mike Bayer [Fri, 31 Jan 2014 01:29:29 +0000 (20:29 -0500)]
- Added support for autogenerate covering the use case where :class:`.Table`
objects specified in the metadata have an explicit ``schema`` attribute
whose name matches that of the connection's default schema
(e.g. "public" for Postgresql). Previously, it was assumed that "schema"
was ``None`` when it matched the "default" schema, now the comparison
adjusts for this. #170
Roman Podoliaka [Tue, 28 Jan 2014 07:08:58 +0000 (09:08 +0200)]
Handle include_* arguments in compare_metadata()
include_object, include_symbol and include_schemas are very useful,
when you need to specify what objects you want to be compared.
Modify compare_metadata() public API function, so that it takes those
arguments into account and pass them to _produce_net_changes().
Mike Bayer [Fri, 24 Jan 2014 15:43:43 +0000 (10:43 -0500)]
- Calling :func:`.bulk_insert` with an empty list will not emit any
commands on the current connection. This was already the case with
``--sql`` mode, so is now the case with "online" mode.
Autogenerate index and unique's comparison takes schema into account
The inspector now will recover the indexes and unique constraints of
the table in the correct schema. Previously it was not taking schema
into account, resulting in always re-creating the existing uniques
and indexes.
Mike Bayer [Sun, 12 Jan 2014 02:55:17 +0000 (21:55 -0500)]
- More fixes to index autodetection; indexes created with expressions
like DESC or functional indexes will no longer cause AttributeError
exceptions when attempting to compare the columns. #164
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