Commit Graph

960 Commits

Author SHA1 Message Date
Tony Breeds 8e081c03d2 Retire Packaging Deb project repos
This commit is part of a series to retire the Packaging Deb
project. Step 2 is to remove all content from the project
repos, replacing it with a README notification where to find
ongoing work, and how to recover the repo if needed at some
future point (as in
https://docs.openstack.org/infra/manual/drivers.html#retiring-a-project).

Change-Id: I17ea6db0c1cd6373a2978adc466e5533d5b35aaa
2017-09-12 15:22:54 -06:00
jpassaro e88131f2c0 address stamp issues in on_version_apply callback
* add callback tests with stamp present
* fix bug in stamp MigrationInfo construction
* adjust MigrationInfo API to reflect existence of stamps with multiple
  up revisions

Change-Id: I308d1de7854542d4d12bcc743bb5ed7e8e2fbefc
Pull-request: https://bitbucket.org/zzzeek/alembic/pull-requests/68
2017-07-18 15:09:46 -04:00
Mike Bayer 11b0e8a5b6 - 0.9.4 setup
Change-Id: Id951f3ff26b34a03a519b634d1cd7cbf0223f849
2017-07-17 10:33:25 -04:00
Mike Bayer bea341e2a2 - 0.9.3 2017-07-06 11:59:21 -04:00
Mike Bayer 3b71acca23 - fix some sphinx link stuff 2017-07-06 11:59:04 -04:00
John Passaro 6a043d10d8 expose on_version_apply callback to context users
Change-Id: I694e26f7d161dcaf4f035277c8317ff6ffe41680
Pull-request: https://bitbucket.org/zzzeek/alembic/pull-requests/67
2017-07-03 14:56:39 -04:00
Mike Bayer 54c5abb15c Adjust for Variant returning itself as impl
Fixed bug where autogen comparison of a :class:`.Variant` datatype
would not compare to the dialect level type for the "default"
implementation of the :class:`.Variant`, returning the type as changed
between database and table metadata.

Change-Id: Ie94779ece9f1c768375cdbdc4124c98f9c11bb86
Fixes: #433
2017-06-02 10:32:08 -04:00
Mike Bayer c320b4c9b9 - add dateutil to docs requirements so that all autodoc
modules can import

Change-Id: I9f9943bfa99ac2581cd1579549a533eddefdc191
2017-06-01 10:59:33 -04:00
Mike Bayer b526a115e7 - Fixed unit tests to run correctly under the SQLAlchemy 1.0.x series
prior to version 1.0.10 where a particular bug involving Postgresql
exclude constraints was fixed.

Change-Id: Ief64b19b75e4c2c3661ac95d5b03d0c8e0fe5619
Fixes: #431
2017-05-31 17:12:41 -04:00
Mike Bayer d9dbfc4060 - 0.9.3 setup
Change-Id: I151d45645826badad0d398d5178a468f50fb8234
2017-05-31 17:11:09 -04:00
Mike Bayer a5a5266b8d - 0.9.2 2017-05-18 11:04:28 -04:00
Mike Bayer c7da7f2d08 Don't use schema with second argument, SQL Server sp_rename
Repaired :meth:`.Operations.rename_table` for SQL Server when the
target table is in a remote schema, the schema name is omitted from
the "new name" argument.

Also added some extra tests for sp_rename w/ quoting / case sensitive
names.

Change-Id: I411b32d0c5bba5a466c0b5d6a412c1b7541fdc95
Fixes: #429
2017-05-18 10:36:13 -04:00
Mike Bayer fbbb669b8c Add timezone option to config
Using dateutil.tz to link string names to tzinfo objects,
the create_date can now generate using a named timezone
rather than datetime.now().

Change-Id: I9f151cb9e11da3d68be63d7141f60e7eccb9812c
Fixes: #425
2017-04-06 14:35:41 -04:00
Mike Bayer 4cdb25bf5d Apply DDLCompiler name rules to Index for autogenerate
The autogenerate compare scheme now takes into account the name truncation
rules applied by SQLAlchemy's DDL compiler to the names of the
:class:`.Index` object, when these names are dynamically truncated
due to a too-long identifier name.   As the identifier truncation is
deterministic, applying the same rule to the metadata name allows
correct comparison to the database-derived name.

Change-Id: I270fbde4430a41f4bcc7857f1932347d86f07675
Fixes: #421
2017-03-15 17:36:01 -04:00
Mike Bayer 50469dc261 - fix the import here
Change-Id: I63fa57218fcc8f3d15c213c8adf61c9761cb9764
2017-03-15 17:09:24 -04:00
Mike Bayer 781d90012a - add custom css also
Change-Id: I163f3f644e88460cdb5203e8a55944436c06d00b
2017-03-15 12:06:15 -04:00
Mike Bayer d4ac63194a - add custom sidebar file
Change-Id: I03078ee419882942a5891c90cef18851b53f905b
2017-03-15 11:59:46 -04:00
Mike Bayer adf0a7d1ea Warn on non-Connection present and accommodate for Engine
A warning is emitted when an object that's not a
:class:`~sqlalchemy.engine.Connection` is passed to
:meth:`.EnvironmentContext.configure`.  For the case of a
:class:`~sqlalchemy.engine.Engine` passed, the check for "in transaction"
introduced in version 0.9.0 has been relaxed to work in the case of an
attribute error, as some users appear to be passing an
:class:`~sqlalchemy.engine.Engine` and not a
:class:`~sqlalchemy.engine.Connection`.

Change-Id: I95ef38955c00511d3055362a03284fb91677595f
Fixes: #419
2017-03-04 17:12:03 -05:00
Mike Bayer 5191bc1e65 - 0.9.2 setup
Change-Id: I4459aeef0028c89ac1c30e79cbceefe3b0c27f64
2017-03-04 16:43:10 -05:00
Mike Bayer 543783bca5 - 0.9.1 2017-03-01 11:51:34 -05:00
Mike Bayer cfb9d348c4 Don't raise on open transaction if we already started in one
An adjustment to the bug fix for 🎫`369` to accommodate for
env.py scripts that use an enclosing transaction distinct from the
one that the context provides, so that the check for "didn't commit
the transaction" doesn't trigger in this scenario.

Change-Id: I3c1fa614495b61532999a84b2af3773e4d33c30b
Fixes: #417
2017-03-01 01:14:50 -05:00
Mike Bayer 910fc22f88 - setup for 0.9.1
Change-Id: I84fa995b7c029404988f04df4fa1460c4409c7da
2017-03-01 01:03:12 -05:00
Mike Bayer d39c0ae72b - 0.9.0 2017-02-28 10:58:48 -05:00
Mike Bayer 364808a760 - provide param docstrings for all of command
- add cross-linking for process_revision_directives

Change-Id: I88914df056d720207c781501934893ec8e030610
2017-02-27 15:57:33 -05:00
Mike Bayer 7d5f6eabec Allow target_metadata to be a sequence
The :paramref:`.EnvironmentContext.configure.target_metadata` parameter
may now be optionally specified as a sequence of :class:`.MetaData`
objects instead of a single :class:`.MetaData` object.  The
autogenerate process will process the sequence of :class:`.MetaData`
objects in order.

Change-Id: I6485c05d68219ff7af1611b34550487d316e0242
Fixes: #38
2017-02-23 13:37:56 -05:00
Mike Bayer 3f070ea17f Detect open transaction at end of migration w/ transactional_ddl=False
A :class:`.CommandError` is now raised when a migration file opens
a database transaction and does not close/commit/rollback, when
the backend database or environment options also specify transactional_ddl
is False.   When transactional_ddl is not in use, Alembic doesn't
close any transaction so a transaction opened by a migration file
will cause the following migrations to fail to apply.

Change-Id: I7a9baf18837deb193d9ddc6813955909484d4945
Fixes: #369
2017-02-23 11:18:57 -05:00
Mike Bayer 9fab143a9b Apply subtype repr logic to JSON/JSONB
Fixed bug where Postgresql JSON/JSONB types rendered on SQLAlchemy
1.1 would render the "astext_type" argument which defaults to
the ``Text()`` type without the module prefix, similarly to the
issue with ARRAY fixed in 🎫`85`.

Also modifies the ARRAY approach from 🎫`85` to be
regular expression based for safer targeting of the inner
repr() type.

Change-Id: I66d51301f4bf5b747b5e8da26a83cbff075d71b2
Fixes: #411
2017-02-22 17:37:12 -05:00
mike bayer 3e5e3a8d3f Merge "Add ExcludeConstraint support for Postgresql" 2017-02-22 17:35:37 -05:00
Mike Bayer 01db038118 Add ExcludeConstraint support for Postgresql
Add full support for Postgresql add_exclude_constraint().
This opens up more of the operations API and serves as a
model for other dialect-specific constraints.

Additionally, gracefully degrade if a given constraint
class is not supported with a warning.

Fixes: #412
Change-Id: I0fb89c840518aaeae97929919356f944479bc756
2017-02-22 17:07:15 -05:00
Mike Bayer f99eb38ceb Detect and render autoincrement for alter_column()
The ``autoincrement=True`` flag is now rendered within the
:meth:`.Operations.alter_column` operation if the source column indicates
that this flag should be set to True.  The behavior is sensitive to
the SQLAlchemy version in place, as the "auto" default option is new
in SQLAlchemy 1.1.  When the source column indicates autoincrement
as True or "auto", the flag will render as True if the original column
contextually indicates that it should have "autoincrement" keywords,
and when the source column explcitly sets it to False, this is also
rendered.  The behavior is intended to preserve the AUTO_INCREMENT flag
on MySQL as the column is fully recreated on this backend.  Note that this
flag does **not** support alteration of a column's "autoincrement" status,
as this is not portable across backends.

Change-Id: I746c4841752adf9342bfdca7c9255aae5110b2ef
Fixes: #413
2017-02-22 16:09:44 -05:00
Mike Bayer 62f2739e82 Add process_revision_directives param to command.revision()
This allows programmatic use of command.revision() to
specify an ad-hoc process_revision_directives callable,
rather than having it placed via the env.py script.

Co-authored-by: Tyson Holub
Change-Id: Ief1c11fd2a6f10e712851145d6d190a3b167817c
Pull-request: https://github.com/zzzeek/alembic/pull/35
2017-02-22 10:00:39 -05:00
Paul f1cf86ea6a Fix postgresql automigration for ARRAY types
Adds a new codepath into render._repr_type() that will consult
the dialect impl for specific types.  On the postgresql side,
the exisiting repr() is combined with a replace featuring
the full autogen render of the nested type.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #85
Change-Id: I8796bfeea27d48e6f8bb5ea4562bdc04961ba0d5
Pull-request: https://github.com/zzzeek/alembic/pull/38
2017-02-21 16:28:51 -05:00
Mike Bayer 44d028f42b - import adjusted for older SQLA
Change-Id: I998c65f8c9b2901adf02cf6796e9940fae630309
2017-02-21 14:54:18 -05:00
Mike Bayer 1d747ef267 - fix
Change-Id: I477ecc68baea7997c00904f0647f50cf15bfe50f
2017-02-21 11:54:23 -05:00
Mike Bayer 70bda92f86 - call this 0.9.0, as there are some slight architectural changes
coming

Change-Id: I98d8edf6b05281bfbc4f3a4338f02084a759a9f8
2017-02-21 11:45:07 -05:00
Mike Bayer 9d1c8132b3 - move Postgresql-related render tests to the test_postgresql suite
Change-Id: I5e5659739269284c41bc9a7ae3127fb5d72d108f
2017-02-21 11:44:20 -05:00
Konstantin Lebedev 93eb6ccbe1 Ensure schema names also compared in foreign_key_constraint()
Fixed bug in :func:`.ops.create_foreign_key` where the internal table
representation would not be created properly if the foriegn key referred
to a table in a different schema of the same name.  Pull request
courtesy Konstantin Lebedev.

Change-Id: I494c95d02aedbfec3b6318d069322b544cf018fb
Pull-request: https://github.com/zzzeek/alembic/pull/36
2017-02-20 11:41:58 -05:00
Mike Bayer 084c541765 - 0.8.11 bump changelog also
Change-Id: I3a1b149a8b04097d0f3eb56d94add322f87903a7
2017-02-20 09:10:35 -05:00
Hemanth Makkapati 377198f274 Fix link in batch alter_column doc
Refer to Operations.alter_column instead of Operations.add_column
2017-02-13 12:51:40 -06:00
Mike Bayer 2f675a4d59 - 0.8.11 dev bump
Change-Id: I2fdac1caaef103919e373537f9db297b058a7543
2017-01-25 14:45:16 -05:00
Mike Bayer e52106e91c - add a note that alter_column->postgresql_using is raw SQL,
fixes #408

Change-Id: Ia569191d43d49178f78a7bcef458b671f750583e
2017-01-25 09:34:41 -05:00
Mike Bayer a4302416a6 - add a new section "Run Multiple Alembic Environments from one .ini file",
clarify what the --name flag does and how this differs from
"multiple bases".

Change-Id: If65a8a11802db18bc2f42ffea360c70cbc9113bb
2017-01-23 14:24:31 -05:00
Mike Bayer 376837484a - 0.8.10 2017-01-17 13:53:12 -05:00
Mike Bayer a1546c19a1 Update pytest section in setup.cfg
Uses new [tool:pytest] directive.
Also removes tox minversion as we are well ahead of that version.

Change-Id: I32c767b8daa64c9e8d71a68c4f568d275719c7d7
2017-01-17 12:18:43 -05:00
Mike Bayer b57b164177 Add primary key constraint to alembic_version
The alembic_version table, when initially created, now establishes a
primary key constraint on the "version_num" column, to suit database
engines that don't support tables without primary keys.   This behavior
can be controlled using the parameter
:paramref:`.EnvironmentContext.configure.version_table_pk`.  Note that
this change only applies to the initial creation of the alembic_version
table; it does not impact any existing alembic_version table already
present.

Change-Id: Ic947f0f97373b2e6695e06c9b2ad6c8a9789fcb2
Fixes: #406
2017-01-13 15:49:14 -05:00
mike bayer 3f995ffdff Merge "- test py36 - Current mysqlclient does not accept "bytes" on py3k, SQLAlchemy 0.9 still lists this client (the original mysqldb version) as "supports_unicode_statements=False" so is no longer functional on py3k. - Rollback transaction after table drop; it seems py3.6 sqlite3 suddenly turned on transactional DDL for SQLite" 2017-01-12 13:47:55 -05:00
Mike Bayer a0d6ab0385 - test py36
- Current mysqlclient does not accept "bytes" on py3k, SQLAlchemy 0.9
still lists this client (the original mysqldb version) as
"supports_unicode_statements=False" so is no longer functional on py3k.
- Rollback transaction after table drop; it seems py3.6 sqlite3
suddenly turned on transactional DDL for SQLite

Change-Id: Ic3b7881583bde5602e54811cf6a149761038b9fd
2017-01-12 13:25:02 -05:00
Mike Bayer 8e2af237ab Generalize uq -> uix dedupe logic
Adjusted the logic originally added for 🎫`276` that detects MySQL
unique constraints which are actually unique indexes to be generalized
for any dialect that has this behavior, for SQLAlchemy version 1.0 and
greater.  This is to allow for upcoming SQLAlchemy support for unique
constraint reflection for Oracle, which also has no dedicated concept of
"unique constraint" and instead establishes a unique index.

Change-Id: Ie5770aba36005ec8618bdc18bc4633413d37fc16
2017-01-09 14:26:53 -05:00
mike bayer c5ac1cddd6 Merge "Get test compat for oracle" 2017-01-09 14:23:22 -05:00
Mike Bayer 61a5512349 Get test compat for oracle
Start getting all the exclusions and conventions in place
to get the autogen suites to pass against the oracle dialect

Change-Id: I63b8c46311af4fc77da6baf17b628a64e9748f85
2017-01-09 13:36:15 -05:00