for constraint in t.constraints:
if not isinstance(constraint, sa_schema.PrimaryKeyConstraint):
self.impl.add_constraint(constraint)
+ for index in t.indexes:
+ self.impl._exec(sa_schema.CreateIndex(index))
def drop_column(self, table_name, column_name, **kw):
"""Issue a "drop column" instruction using the current
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',