percious17 c7cbde7fea added hook functions which allow the dialects to specify how to indicate identifiers, as this is different in postgres.
Also, this fix includes a fix for modification of columns which have tables definied within a schema.  This was also broken in postgres.
2008-11-26 22:05:19 +00:00

33 lines
979 B
Python

from migrate.changeset import ansisql
from sqlalchemy.databases import postgres as sa_base
#import sqlalchemy as sa
PGSchemaGenerator = sa_base.PGSchemaGenerator
class PGColumnGenerator(PGSchemaGenerator,ansisql.ANSIColumnGenerator):
def _do_quote_table_identifier(self, identifier):
return identifier
class PGColumnDropper(ansisql.ANSIColumnDropper):
pass
class PGSchemaChanger(ansisql.ANSISchemaChanger):
def _do_quote_table_identifier(self, identifier):
return identifier
def _do_quote_column_identifier(self, identifier):
return '"%s"'%identifier
class PGConstraintGenerator(ansisql.ANSIConstraintGenerator):
pass
class PGConstraintDropper(ansisql.ANSIConstraintDropper):
pass
class PGDialect(ansisql.ANSIDialect):
columngenerator = PGColumnGenerator
columndropper = PGColumnDropper
schemachanger = PGSchemaChanger
constraintgenerator = PGConstraintGenerator
constraintdropper = PGConstraintDropper