diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-11-28 22:28:28 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-11-28 22:28:28 -0500 |
commit | b854074c6dd93cfeb4c5335a4469c700c4d47f04 (patch) | |
tree | 195a330efb22180b60656146bd18ed895007b378 /test/dialect/test_postgresql.py | |
parent | beef2b5aa811efd42a111c87a4308d6584c78b97 (diff) | |
download | sqlalchemy-b854074c6dd93cfeb4c5335a4469c700c4d47f04.tar.gz |
- [feature] Added create_type constructor argument
to pg.ENUM. When False, no CREATE/DROP or
checking for the type will be performed as part
of a table create/drop event; only the
create()/drop)() methods called directly
will do this. Helps with Alembic "offline"
scripts.
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r-- | test/dialect/test_postgresql.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index b4b7e818c..7279508ba 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -451,6 +451,24 @@ class EnumTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL): metadata.drop_all(testing.db) @testing.provide_metadata + def test_disable_create(self): + metadata = self.metadata + + e1 = postgresql.ENUM('one', 'two', 'three', + name="myenum", + create_type=False) + + t1 = Table('e1', metadata, + Column('c1', e1) + ) + # table can be created separately + # without conflict + e1.create(bind=testing.db) + t1.create(testing.db) + t1.drop(testing.db) + e1.drop(bind=testing.db) + + @testing.provide_metadata def test_generate_multiple(self): """Test that the same enum twice only generates once for the create_all() call, without using checkfirst. |