mark ALTER TABLE ADD FOREIGN KEY as unsupported by SQLite
update corresponding test case
This commit is contained in:
parent
d7027d17a5
commit
5ecec7c680
@ -77,6 +77,17 @@ class SQLiteConstraintGenerator(ansisql.ANSIConstraintGenerator):
|
||||
self.execute()
|
||||
|
||||
|
||||
class SQLiteFKGenerator(SQLiteSchemaChanger, ansisql.ANSIFKGenerator):
|
||||
def visit_column(self, column):
|
||||
"""Create foreign keys for a column (table already exists); #32"""
|
||||
|
||||
if self.fk:
|
||||
self._not_supported("ALTER TABLE ADD FOREIGN KEY")
|
||||
|
||||
if self.buffer.getvalue() !='':
|
||||
self.execute()
|
||||
|
||||
|
||||
class SQLiteConstraintDropper(ansisql.ANSIColumnDropper):
|
||||
|
||||
def visit_migrate_primary_key_constraint(self, constraint):
|
||||
@ -93,3 +104,4 @@ class SQLiteDialect(ansisql.ANSIDialect):
|
||||
schemachanger = SQLiteSchemaChanger
|
||||
constraintgenerator = SQLiteConstraintGenerator
|
||||
constraintdropper = SQLiteConstraintDropper
|
||||
columnfkgenerator = SQLiteFKGenerator
|
||||
|
@ -168,20 +168,14 @@ class TestAddDropColumn(fixture.DB):
|
||||
if self.engine.has_table(reftable.name):
|
||||
reftable.drop()
|
||||
return ret
|
||||
return self.run_(add_func,drop_func,Integer,
|
||||
ForeignKey(reftable.c.id))
|
||||
if self.url.startswith('sqlite'):
|
||||
self.assertRaises(changeset.exceptions.NotSupportedError,
|
||||
self.run_, add_func, drop_func, Integer,
|
||||
ForeignKey(reftable.c.id))
|
||||
else:
|
||||
return self.run_(add_func,drop_func,Integer,
|
||||
ForeignKey(reftable.c.id))
|
||||
|
||||
#@fixture.usedb()
|
||||
#def xtest_pk(self):
|
||||
# """Can create/drop primary key columns
|
||||
# Not supported
|
||||
# """
|
||||
# def add_func(col):
|
||||
# create_column(col,self.table)
|
||||
# def drop_func(col):
|
||||
# drop_column(col,self.table)
|
||||
# # Primary key length is checked in run_
|
||||
# return self.run_(add_func,drop_func,Integer,primary_key=True)
|
||||
|
||||
class TestRename(fixture.DB):
|
||||
level=fixture.DB.CONNECT
|
||||
|
Loading…
x
Reference in New Issue
Block a user