Mike Bayer [Sun, 2 Nov 2014 23:33:51 +0000 (18:33 -0500)]
- Indexes and unique constraints are now included in the
:paramref:`.EnvironmentContext.configure.include_object` hook.
Indexes are sent with type ``"index"`` and unique constraints with
type ``"unique_constraint"``.
fixes #203
Mike Bayer [Sun, 2 Nov 2014 17:46:20 +0000 (12:46 -0500)]
- Bound parameters are now resolved as "literal" values within the
SQL expression inside of a CheckConstraint(), when rendering the SQL
as a text string; supported for SQLAlchemy 0.8.0 and forward.
fixes #219
Mike Bayer [Sun, 2 Nov 2014 17:35:47 +0000 (12:35 -0500)]
- Added a workaround for SQLAlchemy issue #3023 (fixed in 0.9.5) where
a column that's part of an explicit PrimaryKeyConstraint would not
have its "nullable" flag set to False, thus producing a false
autogenerate. Also added a related correction to MySQL which will
correct for MySQL's implicit server default of '0' when a NULL integer
column is turned into a primary key column. fixes #199
Mike Bayer [Sun, 2 Nov 2014 15:34:58 +0000 (10:34 -0500)]
- Repaired issue related to the fix for #208 and others; a composite
foreign key reported by MySQL would cause a KeyError as Alembic
attempted to remove MySQL's implicitly generated indexes from the
autogenerate list.
fixes #240
Mike Bayer [Thu, 30 Oct 2014 01:01:31 +0000 (21:01 -0400)]
- If the "alembic_version" table is present in the target metadata,
autogenerate will skip this also. Pull request courtesy
Dj Gilcrease. fixes #28
- The :paramref:`.EnvironmentContext.configure.version_table`
and :paramref:`.EnvironmentContext.configure.version_table_schema`
arguments are now honored during the autogenerate process, such that
these names will be used as the "skip" names on both the database
reflection and target metadata sides. fixes #77
Mike Bayer [Tue, 21 Oct 2014 17:14:06 +0000 (13:14 -0400)]
- the original rationale for defaulting the user-defined namespace
to "sa." was to force users to deal with making sure their custom
types came from a fixed module somewhere. However, it's not worth
defending this rationale.
The default value of the
:paramref:`.EnvironmentContext.configure.user_module_prefix`
parameter is **no longer the same as the SQLAlchemy prefix**.
When omitted, user-defined types will now use the ``__module__``
attribute of the type class itself when rendering in an
autogenerated module.
Revision files are now written out using the ``'wb'`` modifier to
``open()``, since Mako reads the templates with ``'rb'``, thus preventing
CRs from being doubled up as has been observed on windows. The encoding
of the output now defaults to 'utf-8', which can be configured using
a newly added config file parameter ``output_encoding``.
fixes #234
Mike Bayer [Mon, 20 Oct 2014 17:02:32 +0000 (13:02 -0400)]
- Revision files are now written out using the ``'wb'`` modifier to
``open()``, since Mako reads the templates with ``'rb'``, thus preventing
CRs from being doubled up as has been observed on windows.
fixes #234
Mike Bayer [Fri, 3 Oct 2014 15:12:19 +0000 (11:12 -0400)]
- Added support for use of the :class:`~sqlalchemy.sql.elements.quoted_name`
construct when using the ``schema`` argument within operations. This
allows a name containing a dot to be fully quoted, as well as to
provide configurable quoting on a per-name basis.
fixes #230
Mike Bayer [Sat, 20 Sep 2014 21:00:21 +0000 (17:00 -0400)]
- Added a routine by which the Postgresql Alembic dialect inspects
the server default of INTEGER/BIGINT columns as they are reflected
during autogenerate for the pattern ``nextval(<name>...)`` containing
a potential sequence name, then queries ``pg_catalog`` to see if this
sequence is "owned" by the column being reflected; if so, it assumes
this is a SERIAL or BIGSERIAL column and the server default is
omitted from the column reflection as well as any kind of
server_default comparison or rendering, along with an INFO message
in the logs indicating this has taken place. This allows SERIAL/BIGSERIAL
columns to keep the SEQUENCE from being unnecessarily present within
the autogenerate operation.
fixes #73
Mike Bayer [Sat, 20 Sep 2014 18:30:00 +0000 (14:30 -0400)]
- more tweaks for server defaults re: comparison, test results
- in particular we've changed the server_default for order.amount
to text('0'); SQlite and Postgresql now both report the server
default as '0', whereas previously, when we were emitting '0'
with the quotes in the CREATE TABLE, SQlite reported it as
"'0'" and PG as '0::numeric'.
Mike Bayer [Sat, 20 Sep 2014 17:53:11 +0000 (13:53 -0400)]
- restore _render_server_default_for_compare() to compare.py using
the method previously used in _render_server_default() in render;
these two functions become more specific to compare vs. render now
so are separated out
Mike Bayer [Sun, 14 Sep 2014 19:49:04 +0000 (15:49 -0400)]
- coverage was not working (and needs to be fixed in SQLAlchemy too),
go back to using a "bootstrap" system where we load in pytestplugin/
noseplugin via file importing, plugin/ is not used as a package.
- identify the pytest_sessionstart hook as the best place to do
plugin_base.post_begin() and actually begin importing main modules;
this is where coverage has actually started.
- we're now targeting 1.0.0 as this has to be ported to SQLAlchemy.
- start using .coveragerc
Mike Bayer [Sun, 14 Sep 2014 15:37:50 +0000 (11:37 -0400)]
- move pretty much all of sqlalchemy.testing over for now, as we'd
like to run tests against 0.8 and even late 0.7 versions with the same
capabilities, as well as run parallel testing against all of them.
we need a consistent system to get that all to work, so for now
we have the whole SQLA system shoved into here, not ideal but we have
a very good testing situation for now. Once we target 0.9.4 at the lowest
we should be able to move all this out.
- re-support 0.7, starting at 0.7.6 which is where things mostly work.
All tests, taking into account known skips and fails which are
added here for 0.7, early 0.8s, pass on 0.7.9.
Mike Bayer [Wed, 27 Aug 2014 23:22:42 +0000 (19:22 -0400)]
- Added support for functional indexes when using the
:meth:`.Operations.create_index` directive. Within the list of columns,
the SQLAlchemy ``text()`` construct can be sent, embedding a literal
SQL expression; the :meth:`.Operations.create_index` will perform some hackery
behind the scenes to get the :class:`.Index` construct to cooperate.
This works around some current limitations in :class:`.Index`
which should be resolved on the SQLAlchemy side at some point.
fixes #222
Mike Bayer [Wed, 27 Aug 2014 23:22:42 +0000 (19:22 -0400)]
- Added support for functional indexes when using the
:meth:`.Operations.create_index` directive. Within the list of columns,
the SQLAlchemy ``text()`` construct can be sent, embedding a literal
SQL expression; the :meth:`.Operations.create_index` will perform some hackery
behind the scenes to get the :class:`.Index` construct to cooperate.
This works around some current limitations in :class:`.Index`
which should be resolved on the SQLAlchemy side at some point.
fixes #222
Mike Bayer [Mon, 23 Jun 2014 17:49:44 +0000 (13:49 -0400)]
- Some deep-in-the-weeds fixes to try to get "server default" comparison
working better across platforms and expressions, in particular on
the Postgresql backend, mostly dealing with quoting/not quoting of various
expressions at the appropriate time and on a per-backend basis.
Repaired and tested support for such defaults as Postgresql interval
and array defaults.
fixes #212
Mike Bayer [Thu, 12 Jun 2014 14:30:14 +0000 (10:30 -0400)]
- When a run of Alembic command line fails due to ``CommandError``,
the output now prefixes the string with ``"FAILED:"``, and the error
is also written to the log output using ``log.error()``.
fixes #209
Mike Bayer [Thu, 5 Jun 2014 20:22:14 +0000 (16:22 -0400)]
- Liberalized even more the check for MySQL indexes that shouldn't be
counted in autogenerate as "drops"; this time it's been reported
that an implicitly created index might be named the same as a composite
foreign key constraint, and not the actual columns, so we now skip those
when detected as well. fixes #208
Marc Abramowitz [Wed, 28 May 2014 15:54:28 +0000 (08:54 -0700)]
Eliminate {} (dict) default arg value for `opts`
to MigrationContext.configure
Using a mutable type as a default value is a common source of obscure
problems.
See
http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments
Mike Bayer [Fri, 2 May 2014 20:04:43 +0000 (16:04 -0400)]
- This releases' "autogenerate index detection" bug, when a MySQL table
includes an Index with the same name as a column, autogenerate reported
it as an "add" even though its not; this is because we ignore reflected
indexes of this nature due to MySQL creating them implicitly. Indexes
that are named the same as a column are now ignored on
MySQL if we see that the backend is reporting that it already exists;
this indicates that we can still detect additions of these indexes
but not drops, as we cannot distinguish a backend index same-named
as the column as one that is user generated or mysql-generated.
fixes #202
Mike Bayer [Fri, 2 May 2014 19:46:00 +0000 (15:46 -0400)]
- Added new feature :paramref:`.EnvironmentContext.configure.transaction_per_migration`,
which when True causes the BEGIN/COMMIT pair to incur for each migration
individually, rather than for the whole series of migrations. This is
to assist with some database directives that need to be within individual
transactions, without the need to disable transactional DDL entirely.
fixes #201
Mike Bayer [Wed, 30 Apr 2014 22:28:49 +0000 (18:28 -0400)]
- Fixed bug where the ``include_object()`` filter would not receive
the original :class:`.Column` object when evaluating a database-only
column to be dropped; the object would not include the parent
:class:`.Table` nor other aspects of the column that are important
for generating the "downgrade" case where the column is recreated.
fixes #200