diff --git a/docs/api.rst b/docs/api.rst index fb03040..02462dc 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -18,6 +18,7 @@ Module :mod:`constraint ` -- Constraint schema mig .. automodule:: migrate.changeset.constraint :members: + :inherited-members: :show-inheritance: :member-order: groupwise :synopsis: Standalone schema constraint objects diff --git a/docs/changelog.rst b/docs/changelog.rst index 229c65f..62f37b5 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,5 +1,5 @@ -0.6.0 ------ +0.6 (11.07.2010) +--------------------------- .. _backwards-06: diff --git a/docs/changeset.rst b/docs/changeset.rst index f466c82..ab5993b 100644 --- a/docs/changeset.rst +++ b/docs/changeset.rst @@ -21,6 +21,26 @@ Changeset operations can be used independently of SQLAlchemy Migrate's For more information, see the generated documentation for :mod:`migrate.changeset`. +.. _summary-changeset-api: + +Summary of supported actions: + + +* :meth:`Create a column ` +* :meth:`Drop a column ` +* :meth:`Alter a column ` (name, nullabe, type, server_default) +* :meth:`Rename a table ` +* :meth:`Rename an index ` +* :meth:`Create primary key constraint ` +* :meth:`Drop primary key constraint ` +* :meth:`Create foreign key contraint ` +* :meth:`Drop foreign key constraint ` +* :meth:`Create unique key contraint ` +* :meth:`Drop unique key constraint ` +* :meth:`Create check key contraint ` +* :meth:`Drop check key constraint ` + + .. note:: alter_metadata keyword defaults to True. @@ -45,6 +65,8 @@ Given a standard SQLAlchemy table:: # Column is added to table based on its name assert col is table.c.col1 + # col1 is populated with 'foobar' because of `populate_default` + .. _column-drop: :meth:`Drop a column `:: diff --git a/migrate/changeset/schema.py b/migrate/changeset/schema.py index 349b497..f64e595 100644 --- a/migrate/changeset/schema.py +++ b/migrate/changeset/schema.py @@ -465,20 +465,15 @@ class ChangesetColumn(object): def alter(self, *p, **k): """Alter a column's definition: ``ALTER TABLE ALTER COLUMN``. - May supply a new column object, or a list of properties to - change. - - For example; the following are equivalent:: - - col.alter(Column('myint', Integer, DefaultClause('foobar'))) - col.alter('myint', Integer, server_default='foobar', nullable=False) - col.alter(DefaultClause('foobar'), name='myint', type=Integer,\ - nullable=False) - Column name, type, server_default, and nullable may be changed here. Direct API to :func:`alter_column` + + Example:: + + col.alter(name='foobar', type=Integer(), server_default=text("a")) + """ if 'table' not in k: k['table'] = self.table @@ -487,7 +482,7 @@ class ChangesetColumn(object): return alter_column(self, *p, **k) def create(self, table=None, index_name=None, unique_name=None, - primary_key_name=None, connection=None, **kwargs): + primary_key_name=None, populate_default=True, connection=None, **kwargs): """Create this column in the database. Assumes the given table exists. ``ALTER TABLE ADD COLUMN``, @@ -513,7 +508,7 @@ populated with defaults :returns: self """ - self.populate_default = kwargs.pop('populate_default', False) + self.populate_default = populate_default self.alter_metadata = kwargs.pop('alter_metadata', DEFAULT_ALTER_METADATA) self.index_name = index_name self.unique_name = unique_name