2008-02-06 18:39:07 +00:00
|
|
|
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):
|
2008-11-26 22:05:19 +00:00
|
|
|
def _do_quote_table_identifier(self, identifier):
|
|
|
|
return identifier
|
|
|
|
|
2008-02-06 18:39:07 +00:00
|
|
|
class PGColumnDropper(ansisql.ANSIColumnDropper):
|
2008-11-27 00:17:55 +00:00
|
|
|
def _do_quote_table_identifier(self, identifier):
|
|
|
|
return identifier
|
2008-11-26 22:05:19 +00:00
|
|
|
|
2008-02-06 18:39:07 +00:00
|
|
|
class PGSchemaChanger(ansisql.ANSISchemaChanger):
|
2008-11-26 22:05:19 +00:00
|
|
|
def _do_quote_table_identifier(self, identifier):
|
|
|
|
return identifier
|
|
|
|
def _do_quote_column_identifier(self, identifier):
|
|
|
|
return '"%s"'%identifier
|
|
|
|
|
|
|
|
|
2008-02-06 18:39:07 +00:00
|
|
|
class PGConstraintGenerator(ansisql.ANSIConstraintGenerator):
|
2008-12-02 05:11:36 +00:00
|
|
|
def _do_quote_table_identifier(self, identifier):
|
|
|
|
return identifier
|
2008-11-26 22:05:19 +00:00
|
|
|
|
2008-02-06 18:39:07 +00:00
|
|
|
class PGConstraintDropper(ansisql.ANSIConstraintDropper):
|
|
|
|
pass
|
|
|
|
|
|
|
|
class PGDialect(ansisql.ANSIDialect):
|
|
|
|
columngenerator = PGColumnGenerator
|
|
|
|
columndropper = PGColumnDropper
|
|
|
|
schemachanger = PGSchemaChanger
|
|
|
|
constraintgenerator = PGConstraintGenerator
|
|
|
|
constraintdropper = PGConstraintDropper
|