| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- getting at attributes of FKs varies a bit on SQLA versions,
so implement an _fk_spec() called for all FK inspection
- to enable include_object() filters and allow the FK constraint
code to flow like that of indexes/uniques, change the approach
so that we deal with an _fk_constraint_sig() object again which
contains the real ForeignKeyConstraint() within; we need this
anyway for include_object, but also allows us to use the standard
"drop_constraint" call for rendering.
- enhance tests in test_autogen_fks to support real FK databases like
Postgresql, MySQL, add in InnoDB flags and ensure that FKs refer
to real primary key constraints for PG support
- implement and test include_object() support for FKs
- inspectors all have get_foreign_keys(), no need to check
- repair the drop_constraint call to quote the "type" and table
name correctly, run all constraint drops through drop_constraint()
for rendering
- fix up schema identifiers for foreign key autogens
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
into pr32
- complete merge, get all tests passing
- use 'foreignkey' literal
Conflicts:
alembic/autogenerate/compare.py
tests/test_autogenerate.py
|
| | |
|
| |
| |
| |
| | |
fixes issue #178
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
autogenerate will now place the "drop constraint" calls *before*
the "drop column" calls, so that columns involved in those constraints
still exist when the constraint is dropped.
fixes #247
|
| | |
|
|/ |
|
|
|
|
|
|
|
| |
:paramref:`.EnvironmentContext.configure.include_object` hook.
Indexes are sent with type ``"index"`` and unique constraints with
type ``"unique_constraint"``.
fixes #203
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
- 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'.
|
| |
|
| |
|
|
|
|
| |
than line length
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
detection, has even more fixes, this time to accommodate database dialects
that both don't yet report on unique constraints, but the backend
does report unique constraints as indexes. The logic
Alembic uses to distinguish between "this is an index!" vs.
"this is a unique constraint that is also reported as an index!" has now
been further enhanced to not produce unwanted migrations when the dialect
is observed to not yet implement get_unique_constraints() (e.g. mssql).
Note that such a backend will no longer report index drops for unique
indexes, as these cannot be distinguished from an unreported unique
index. fixes #185
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
- reorg tests a bit
- add test coverage for "include_schemas" 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().
|
|
|
|
|
| |
- unit tests for schema-level unique/index detection
- cleanup a bit for the get indexes/uniques if only table present
|
|
|
|
|
| |
like DESC or functional indexes will no longer cause AttributeError
exceptions when attempting to compare the columns. #164
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
| |
- fix the SQLA 0.7 case a bit
|
| |
|
|
|
|
|
|
| |
rendered
(at least in indexes for now) using literal_binds=True, resolve #155
|
|
|
|
|
|
|
| |
unique constraint/index thing
on PG still works
- replicate the index test for PG
|
|
|
|
| |
non-named unique constraints, e.g. those made by the unique=True flag
|
|
|
|
| |
index.unique flag,
|
|
|
|
|
| |
so that we get those table's indexes added as separate create index
steps.
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
| |
courtesy ijl. #107
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
``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.
|
|
|
|
|
| |
within CHECK constraints in autogenerate. Courtesy
Sok Ann Yap. #125
|
|\ |
|
| | |
|