Skip to content

Releases: sqlalchemy/alembic

0.6.3

17 Sep 22:10
Compare
Choose a tag to compare

0.6.3

Released: February 2, 2014

  • [bug] 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.

    References: #172

  • [feature] Added new argument
    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 EnvironmentContext.configure.sqlalchemy_module_prefix
    is used, thus preserving the current behavior.

    References: #171

  • [bug] Added support for autogenerate covering the use case where 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.

    References: #170

  • [bug] The compare_metadata() public API function now takes into
    account the settings for
    EnvironmentContext.configure.include_object,
    EnvironmentContext.configure.include_symbol,
    and EnvironmentContext.configure.include_schemas, in the
    same way that the --autogenerate command does. Pull
    request courtesy Roman Podoliaka.

  • [bug] Calling 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.

    References: #168

  • [bug] Enabled schema support for index and unique constraint autodetection;
    previously these were non-functional and could in some cases lead to
    attribute errors. Pull request courtesy Dimitris Theodorou.

  • [bug] 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.

    References: #164

  • [feature] The 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.

    References: #163

0.6.2

17 Sep 22:11
Compare
Choose a tag to compare

0.6.2

Released: Fri Dec 27 2013

  • [bug] Autogenerate for op.create_table() will not include a
    PrimaryKeyConstraint() that has no columns.

  • [bug] Fixed bug in the not-internally-used ScriptDirectory.get_base()
    method which would fail if called on an empty versions directory.

  • [bug] An almost-rewrite of the new unique constraint/index autogenerate
    detection, to accommodate a variety of issues. The emphasis is on
    not generating false positives for those cases where no net change
    is present, as these errors are the ones that impact all autogenerate
    runs:

    -   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.
    
    -   Corrected for MySQL's apparent addition of an implicit index
        for a foreign key column, so that it doesn't show up as "removed".
        This required that the index/constraint autogen system query the
        dialect-specific implementation for special exceptions.
    
    -   reworked the "dedupe" logic to accommodate MySQL's bi-directional
        duplication of unique indexes as unique constraints, and unique
        constraints as unique indexes.  Postgresql's slightly different
        logic of duplicating unique constraints into unique indexes
        continues to be accommodated as well.  Note that a unique index
        or unique constraint removal on a backend that duplicates these may
        show up as a distinct "remove_constraint()" / "remove_index()" pair,
        which may need to be corrected in the post-autogenerate if multiple
        backends are being supported.
    
    -   added another dialect-specific exception to the SQLite backend
        when dealing with unnamed unique constraints, as the backend can't
        currently report on constraints that were made with this technique,
        hence they'd come out as "added" on every run.
    
    -   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.
    

    References: #157

  • [feature] [mssql] Added new argument mssql_drop_foreign_key to
    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 Operations.drop_constraint() given the name,
    even though only MSSQL has this limitation in the first place.

  • [bug] [mssql] The MSSQL backend will add the batch separator (e.g. "GO")
    in --sql mode after the final COMMIT statement, to ensure
    that statement is also processed in batch mode. Courtesy
    Derek Harland.

0.6.1

17 Sep 22:11
Compare
Choose a tag to compare

0.6.1

Released: Wed Nov 27 2013

  • [bug] [mysql] Fixed bug where op.alter_column() in the MySQL dialect
    would fail to apply quotes to column names that had mixed casing
    or spaces.

    References: #152

  • [feature] Expanded the size of the "slug" generated by "revision" to 40
    characters, which is also configurable by new field
    truncate_slug_length; and also split on the word rather than the
    character; courtesy Frozenball.

  • [bug] 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.

    References: #135

  • [bug] 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.

  • [bug] Fixed py3k bug where the wrong form of next() was being called
    when using the list_templates command. Courtesy Chris Wilkes.

    References: #145

  • [feature] Support for autogeneration detection and rendering of indexes and
    unique constraints has been added. The logic goes through some effort
    in order to differentiate between true unique constraints and
    unique indexes, where there are some quirks on backends like Postgresql.
    The effort here in producing the feature and tests is courtesy of IJL.

    References: #107

  • [bug] Fixed bug introduced by new include_object argument where the
    inspected column would be misinterpreted when using a user-defined
    type comparison function, causing a KeyError or similar expression-related
    error. Fix courtesy Maarten van Schaik.

  • [bug] Added the "deferrable" keyword argument to op.create_foreign_key()
    so that DEFERRABLE constraint generation is supported; courtesy
    Pedro Romano.

  • [bug] 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.

    References: #137

0.6.0

17 Sep 22:11
Compare
Choose a tag to compare

0.6.0

Released: Fri July 19 2013

  • [feature] Added new kw argument to 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.

    References: #101

  • [feature] 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.

  • [feature] Added alembic.config.Config.cmd_opts attribute,
    allows access to the argparse options passed to the
    alembic runner.

  • [feature] 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, or more simply a new
    method EnvironmentContext.get_x_argument().

    References: #120

  • [bug] Added support for options like "name" etc. to be rendered
    within CHECK constraints in autogenerate. Courtesy
    Sok Ann Yap.

    References: #125

  • [misc] Source repository has been moved from Mercurial to Git.

  • [bug] Repaired autogenerate rendering of ForeignKeyConstraint
    to include use_alter argument, if present.

  • [feature] Added -r argument to alembic history command,
    allows specification of [start]:[end] to view
    a slice of history. Accepts revision numbers, symbols
    "base", "head", a new symbol "current" representing the
    current migration, as well as relative ranges for one
    side at a time (i.e. -r-5:head, -rcurrent:+3).
    Courtesy Atsushi Odagiri for this feature.

  • [feature] Source base is now in-place for Python 2.6 through
    3.3, without the need for 2to3. Support for Python 2.5
    and below has been dropped. Huge thanks to
    Hong Minhee for all the effort on this!

    References: #55

0.5.0

17 Sep 22:11
Compare
Choose a tag to compare

0.5.0

Released: Thu Apr 4 2013Alembic 0.5.0 now requires at least
version 0.7.3 of SQLAlchemy to run properly.
Support for 0.6 has been dropped.

  • [feature] Added version_table_schema argument
    to EnvironmentContext.configure(),
    complements the version_table argument to
    set an optional remote schema for the version
    table. Courtesy Christian Blume.

    References: #76

  • [bug] [postgresql] Fixed format of RENAME for table that includes
    schema with Postgresql; the schema name shouldn't
    be in the "TO" field.

    References: #32

  • [feature] Added output_encoding option to
    EnvironmentContext.configure(),
    used with --sql mode to apply an encoding
    to the output stream.

    References: #90

  • [feature] Added Operations.create_primary_key()
    operation, will genenerate an ADD CONSTRAINT
    for a primary key.

    References: #93

  • [bug] [mssql] Fixed bug whereby double quoting would be applied
    to target column name during an sp_rename
    operation.

    References: #109

  • [bug] [mysql] [sqlite] transactional_ddl flag for SQLite, MySQL dialects
    set to False. MySQL doesn't support it,
    SQLite does but current pysqlite driver does not.

    References: #112

  • [feature] upgrade and downgrade commands will list the
    first line of the docstring out next to the
    version number. Courtesy Hong Minhee.

    References: #115

  • [feature] Added --head-only option to "alembic current",
    will print current version plus the symbol
    "(head)" if this version is the head or not.
    Courtesy Charles-Axel Dein.

  • [bug] Autogenerate will render additional table keyword
    arguments like "mysql_engine" and others within
    op.create_table().

    References: #110

  • [feature] The rendering of any construct during autogenerate
    can be customized, in particular to allow special rendering
    for user-defined column, constraint subclasses, using new
    render_item argument to
    EnvironmentContext.configure().

    References: #108

  • [bug] Fixed bug whereby create_index()
    would include in the constraint columns that
    are added to all Table objects using events,
    externally to the generation of the constraint.
    This is the same issue that was fixed for unique
    constraints in version 0.3.2.

  • [bug] Worked around a backwards-incompatible regression in Python3.3
    regarding argparse; running "alembic" with no arguments
    now yields an informative error in py3.3 as with all previous versions.
    Courtesy Andrey Antukh.

  • [change] SQLAlchemy 0.6 is no longer supported by Alembic - minimum version is 0.7.3,
    full support is as of 0.7.9.

  • [bug] A host of argument name changes within migration
    operations for consistency. Keyword arguments
    will continue to work on the old name for backwards compatibility,
    however required positional arguments will not:

    Operations.alter_column() - name -> new_column_name - old
    name will work for backwards compatibility.

    Operations.create_index() - tablename -> table_name -
    argument is positional.

    Operations.drop_index() - tablename -> table_name - old
    name will work for backwards compatibility.

    Operations.drop_constraint() - tablename -> table_name -
    argument is positional.

    Operations.drop_constraint() - type -> type_ - old
    name will work for backwards compatibility

    References: #104

0.4.2

17 Sep 22:11
Compare
Choose a tag to compare

0.4.2

Released: Fri Jan 11 2013

  • [autogenerate] [bug] Fixed bug where autogenerate would fail if a Column
    to be added to a table made use of the ".key" paramter.

    References: #99

  • [bug] [sqlite] The "implicit" constraint generated by a
    type such as Boolean or Enum will not generate an
    ALTER statement when run on SQlite, which does not
    support ALTER for the purpose of adding/removing
    constraints separate from the column def itself.
    While SQLite supports adding a CHECK constraint
    at the column level, SQLAlchemy would need modification
    to support this.
    A warning is emitted indicating this
    constraint cannot be added in this scenario.

    References: #98

  • [bug] Added a workaround to setup.py to prevent
    "NoneType" error from occuring when
    "setup.py test" is run.

    References: #96

  • [bug] Added an append_constraint() step to each
    condition within
    test_autogenerate:AutogenRenderTest.test_render_fk_constraint_kwarg
    if the SQLAlchemy version is less than 0.8, as ForeignKeyConstraint
    does not auto-append prior to 0.8.

    References: #96

  • [feature] Added a README.unittests with instructions for running the test
    suite fully.

    References: #96

0.4.1

17 Sep 22:11
Compare
Choose a tag to compare

0.4.1

Released: Sun Dec 9 2012

  • [bug] Added support for autogenerate render of
    ForeignKeyConstraint options onupdate,
    ondelete, initially, and deferred.

    References: #92

  • [bug] Autogenerate will include "autoincrement=False"
    in the rendered table metadata
    if this flag was set to false on the source
    Column object.

    References: #94

  • [feature] Explicit error message describing the case
    when downgrade --sql is used without specifying
    specific start/end versions.

    References: #66

  • [bug] Removed erroneous "emit_events" attribute
    from operations.create_table() documentation.

    References: #81

  • [bug] Fixed the minute component in file_template
    which returned the month part of the create date.

0.4.0

17 Sep 22:11
Compare
Choose a tag to compare

0.4.0

Released: Mon Oct 01 2012

  • [feature] Support for tables in alternate schemas
    has been added fully to all operations, as well as to
    the autogenerate feature. When using autogenerate,
    specifying the flag include_schemas=True to
    Environment.configure() will also cause autogenerate
    to scan all schemas located by Inspector.get_schema_names(),
    which is supported by some (but not all)
    SQLAlchemy dialects including Postgresql.
    Enormous thanks to Bruno Binet for a huge effort
    in implementing as well as writing tests. .

    References: #33

  • [feature] The command line runner has been organized
    into a reusable CommandLine object, so that other
    front-ends can re-use the argument parsing built
    in.

    References: #70

  • [feature] Added "stdout" option to Config, provides
    control over where the "print" output of commands like
    "history", "init", "current" etc. are sent.

    References: #43

  • [bug] Fixed the "multidb" template which was badly out
    of date. It now generates revision files using
    the configuration to determine the different
    upgrade_() methods needed as well, instead of
    needing to hardcode these. Huge thanks to
    BryceLohr for doing the heavy lifting here.

    References: #71

  • [bug] Fixed the regexp that was checking for .py files
    in the version directory to allow any .py file through.
    Previously it was doing some kind of defensive checking,
    probably from some early notions of how this directory
    works, that was prohibiting various filename patterns
    such as those which begin with numbers.

    References: #72

  • [bug] Fixed MySQL rendering for server_default which
    didn't work if the server_default was a generated
    SQL expression. Courtesy Moriyoshi Koizumi.

  • [feature] Added support for alteration of MySQL
    columns that have AUTO_INCREMENT, as well as enabling
    this flag. Courtesy Moriyoshi Koizumi.

0.3.6

17 Sep 22:11
Compare
Choose a tag to compare

0.3.6

Released: Wed Aug 15 2012

  • [feature] Added include_symbol option to
    EnvironmentContext.configure(),
    specifies a callable which will include/exclude tables
    in their entirety from the autogeneration process
    based on name.

    References: #27

  • [feature] Added year, month, day, hour, minute, second
    variables to file_template.

    References: #59

  • [feature] Added 'primary' to the list of constraint types
    recognized for MySQL drop_constraint().

  • [feature] Added --sql argument to the "revision" command,
    for the use case where the "revision_environment"
    config option is being used but SQL access isn't
    desired.

  • [bug] Repaired create_foreign_key() for
    self-referential foreign keys, which weren't working
    at all.

  • [bug] 'alembic' command reports an informative
    error message when the configuration is missing
    the 'script_directory' key.

    References: #63

  • [bug] Fixes made to the constraints created/dropped
    alongside so-called "schema" types such as
    Boolean and Enum. The create/drop constraint logic
    does not kick in when using a dialect that doesn't
    use constraints for these types, such as postgresql,
    even when existing_type is specified to
    alter_column(). Additionally, the constraints
    are not affected if existing_type is passed but
    type_ is not, i.e. there's no net change
    in type.

    References: #62

  • [bug] Improved error message when specifiying
    non-ordered revision identifiers to cover
    the case when the "higher" rev is None,
    improved message overall.

    References: #66

0.3.5

17 Sep 22:11
Compare
Choose a tag to compare

0.3.5

Released: Sun Jul 08 2012

  • [bug] Fixed issue whereby reflected server defaults
    wouldn't be quoted correctly; uses repr() now.

    References: #31

  • [bug] Fixed issue whereby when autogenerate would
    render create_table() on the upgrade side for a
    table that has a Boolean type, an unnecessary
    CheckConstraint() would be generated.

    References: #58

  • [feature] Implemented SQL rendering for
    CheckConstraint() within autogenerate upgrade,
    including for literal SQL as well as SQL Expression
    Language expressions.