summaryrefslogtreecommitdiff
path: root/alembic/context.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-04-21 17:15:48 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-04-21 17:15:48 -0400
commit177b7de4ee0952dde61636c4a8c00b6568a576b4 (patch)
treed28265b33c73321c83aae76d08977939c22d1657 /alembic/context.py
parentd1789f440552c4f2900a2a8799769a18f4035624 (diff)
downloadalembic-177b7de4ee0952dde61636c4a8c00b6568a576b4.tar.gz
- implement add_column, drop_column, start thinking about scaling up how we do the tests
Diffstat (limited to 'alembic/context.py')
-rw-r--r--alembic/context.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/alembic/context.py b/alembic/context.py
index 6ea301b..e11f4d6 100644
--- a/alembic/context.py
+++ b/alembic/context.py
@@ -2,8 +2,10 @@ from alembic import util
from sqlalchemy import MetaData, Table, Column, String, literal_column, \
text
from sqlalchemy import schema, create_engine
-import logging
+from sqlalchemy.util import importlater
+import logging
+base = importlater("alembic.ddl", "base")
log = logging.getLogger(__name__)
class ContextMeta(type):
@@ -120,18 +122,26 @@ class DefaultContext(object):
nullable=util.NO_VALUE,
server_default=util.NO_VALUE,
name=util.NO_VALUE,
- type=util.NO_VALUE
+ type=util.NO_VALUE,
+ schema=None,
):
if nullable is not util.NO_VALUE:
- self._exec(base.ColumnNullable(table_name, column_name, nullable))
+ self._exec(base.ColumnNullable(table_name, column_name, nullable, schema=schema))
if server_default is not util.NO_VALUE:
self._exec(base.ColumnDefault(
- table_name, column_name, server_default
+ table_name, column_name, server_default,
+ schema=schema
))
# ... etc
+ def add_column(self, table_name, column):
+ self._exec(base.AddColumn(table_name, column))
+
+ def drop_column(self, table_name, column):
+ self._exec(base.DropColumn(table_name, column))
+
def add_constraint(self, const):
self._exec(schema.AddConstraint(const))