summaryrefslogtreecommitdiff
path: root/alembic/context.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-04-24 23:51:21 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-04-24 23:51:21 -0400
commit72bf3a5417fd968496e01c48a8c7d1bfa6b40676 (patch)
treebe767f8b2d56b7e39af80f431787ef7dc222799e /alembic/context.py
parentcf93eeab9943d1d567e172a9a6a1f5f649c368e3 (diff)
downloadalembic-72bf3a5417fd968496e01c48a8c7d1bfa6b40676.tar.gz
- figuring out script format
- figuring out operation system
Diffstat (limited to 'alembic/context.py')
-rw-r--r--alembic/context.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/alembic/context.py b/alembic/context.py
new file mode 100644
index 0000000..27771da
--- /dev/null
+++ b/alembic/context.py
@@ -0,0 +1,31 @@
+from alembic.ddl import base
+
+class ContextMeta(type):
+ def __init__(cls, classname, bases, dict_):
+ newtype = type.__init__(cls, classname, bases, dict_)
+ if '__dialect__' in dict_:
+ _context_impls[dict_['__dialect__']] = newtype
+ return newtype
+
+_context_impls = {}
+
+class DefaultContext(object):
+ __metaclass__ = ContextMeta
+
+ def __init__(self, options, connection):
+ self.options = options
+ self.connection = connection
+
+ def alter_column(self, table_name, column_name,
+ nullable=NO_VALUE,
+ server_default=NO_VALUE,
+ name=NO_VALUE,
+ type=NO_VALUE
+ ):
+
+ if nullable is not NO_VALUE:
+ base.ColumnNullable(table_name, column_name, nullable)
+ if server_default is not NO_VALUE:
+ base.ColumnDefault(table_name, column_name, server_default)
+
+ # ... etc \ No newline at end of file