diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-01-09 11:18:02 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-01-09 11:18:02 -0500 |
| commit | 2a840c147e49d833f8a11de3964a0a8588d72508 (patch) | |
| tree | f0d43df0e39ad07e962a46d1e0831c043a59464b /lib/sqlalchemy/testing | |
| parent | 86f243a8747c28f87dce5d34fb42501ddfb5d387 (diff) | |
| download | sqlalchemy-2a840c147e49d833f8a11de3964a0a8588d72508.tar.gz | |
Render correct DDL for unsetting table comments
Fixed issue where the DDL emitted for :class:`.DropTableComment`, which
will be used by an upcoming version of Alembic, was incorrect for the MySQL
and Oracle databases.
Fixes: #4436
Change-Id: I196de09495a37adface4caa9dcbc29a6d0ad159a
Diffstat (limited to 'lib/sqlalchemy/testing')
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_ddl.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_ddl.py b/lib/sqlalchemy/testing/suite/test_ddl.py index 8317590c8..fe6911c40 100644 --- a/lib/sqlalchemy/testing/suite/test_ddl.py +++ b/lib/sqlalchemy/testing/suite/test_ddl.py @@ -4,7 +4,9 @@ from .. import util from ..assertions import eq_ from ..config import requirements from ... import Column +from ... import inspect from ... import Integer +from ... import schema from ... import String from ... import Table @@ -55,5 +57,27 @@ class TableDDLTest(fixtures.TestBase): table.create(config.db, checkfirst=False) self._simple_roundtrip(table) + @requirements.comment_reflection + @util.provide_metadata + def test_add_table_comment(self): + table = self._simple_fixture() + table.create(config.db, checkfirst=False) + table.comment = "a comment" + config.db.execute(schema.SetTableComment(table)) + eq_( + inspect(config.db).get_table_comment("test_table"), + {"text": "a comment"}, + ) + + @requirements.comment_reflection + @util.provide_metadata + def test_drop_table_comment(self): + table = self._simple_fixture() + table.create(config.db, checkfirst=False) + table.comment = "a comment" + config.db.execute(schema.SetTableComment(table)) + config.db.execute(schema.DropTableComment(table)) + eq_(inspect(config.db).get_table_comment("test_table"), {"text": None}) + __all__ = ("TableDDLTest",) |
