summaryrefslogtreecommitdiff
path: root/tests/test_op.py
diff options
context:
space:
mode:
authorDavid Szotten <davidszotten@gmail.com>2014-10-16 17:25:34 +0100
committerDavid Szotten <davidszotten@gmail.com>2014-10-16 17:25:34 +0100
commit5d9ea4bb754f8792a897b2092b6b9e469197610c (patch)
treeec70ff9f1d4cb0949cd3542e8ffec637f1db0202 /tests/test_op.py
parentac95bad85cc6267e3ce013319ee590a084565666 (diff)
downloadalembic-5d9ea4bb754f8792a897b2092b6b9e469197610c.tar.gz
Create index in add_column if requested
Fixes #174
Diffstat (limited to 'tests/test_op.py')
-rw-r--r--tests/test_op.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_op.py b/tests/test_op.py
index 835183e..c157030 100644
--- a/tests/test_op.py
+++ b/tests/test_op.py
@@ -147,6 +147,15 @@ class OpTest(TestBase):
context.assert_(
"ALTER TABLE t1 ADD COLUMN c1 INTEGER DEFAULT '12' NOT NULL")
+ def test_add_column_with_index(self):
+ context = op_fixture()
+ op.add_column(
+ 't1', Column('c1', Integer, nullable=False, index=True))
+ context.assert_(
+ "ALTER TABLE t1 ADD COLUMN c1 INTEGER NOT NULL",
+ "CREATE INDEX ix_t1_c1 ON t1 (c1)",
+ )
+
def test_add_column_schema_with_default(self):
context = op_fixture()
op.add_column('t1',