better document summary of changeset actions
This commit is contained in:
parent
a3d3470d5e
commit
201fe50e6c
@ -18,6 +18,7 @@ Module :mod:`constraint <migrate.changeset.constraint>` -- Constraint schema mig
|
|||||||
|
|
||||||
.. automodule:: migrate.changeset.constraint
|
.. automodule:: migrate.changeset.constraint
|
||||||
:members:
|
:members:
|
||||||
|
:inherited-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
:member-order: groupwise
|
:member-order: groupwise
|
||||||
:synopsis: Standalone schema constraint objects
|
:synopsis: Standalone schema constraint objects
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
0.6.0
|
0.6 (11.07.2010)
|
||||||
-----
|
---------------------------
|
||||||
|
|
||||||
.. _backwards-06:
|
.. _backwards-06:
|
||||||
|
|
||||||
|
@ -21,6 +21,26 @@ Changeset operations can be used independently of SQLAlchemy Migrate's
|
|||||||
For more information, see the generated documentation for
|
For more information, see the generated documentation for
|
||||||
:mod:`migrate.changeset`.
|
:mod:`migrate.changeset`.
|
||||||
|
|
||||||
|
.. _summary-changeset-api:
|
||||||
|
|
||||||
|
Summary of supported actions:
|
||||||
|
|
||||||
|
|
||||||
|
* :meth:`Create a column <ChangesetColumn.create>`
|
||||||
|
* :meth:`Drop a column <ChangesetColumn.drop>`
|
||||||
|
* :meth:`Alter a column <ChangesetColumn.alter>` (name, nullabe, type, server_default)
|
||||||
|
* :meth:`Rename a table <ChangesetTable.rename>`
|
||||||
|
* :meth:`Rename an index <ChangesetIndex.rename>`
|
||||||
|
* :meth:`Create primary key constraint <migrate.changeset.constraint.PrimaryKeyConstraint>`
|
||||||
|
* :meth:`Drop primary key constraint <migrate.changeset.constraint.PrimaryKeyConstraint.drop>`
|
||||||
|
* :meth:`Create foreign key contraint <migrate.changeset.constraint.ForeignKeyConstraint.create>`
|
||||||
|
* :meth:`Drop foreign key constraint <migrate.changeset.constraint.ForeignKeyConstraint.drop>`
|
||||||
|
* :meth:`Create unique key contraint <migrate.changeset.constraint.UniqueConstraint.create>`
|
||||||
|
* :meth:`Drop unique key constraint <migrate.changeset.constraint.UniqueConstraint.drop>`
|
||||||
|
* :meth:`Create check key contraint <migrate.changeset.constraint.CheckConstraint.create>`
|
||||||
|
* :meth:`Drop check key constraint <migrate.changeset.constraint.CheckConstraint.drop>`
|
||||||
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
alter_metadata keyword defaults to True.
|
alter_metadata keyword defaults to True.
|
||||||
@ -45,6 +65,8 @@ Given a standard SQLAlchemy table::
|
|||||||
# Column is added to table based on its name
|
# Column is added to table based on its name
|
||||||
assert col is table.c.col1
|
assert col is table.c.col1
|
||||||
|
|
||||||
|
# col1 is populated with 'foobar' because of `populate_default`
|
||||||
|
|
||||||
.. _column-drop:
|
.. _column-drop:
|
||||||
|
|
||||||
:meth:`Drop a column <ChangesetColumn.drop>`::
|
:meth:`Drop a column <ChangesetColumn.drop>`::
|
||||||
|
@ -465,20 +465,15 @@ class ChangesetColumn(object):
|
|||||||
def alter(self, *p, **k):
|
def alter(self, *p, **k):
|
||||||
"""Alter a column's definition: ``ALTER TABLE ALTER COLUMN``.
|
"""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
|
Column name, type, server_default, and nullable may be changed
|
||||||
here.
|
here.
|
||||||
|
|
||||||
Direct API to :func:`alter_column`
|
Direct API to :func:`alter_column`
|
||||||
|
|
||||||
|
Example::
|
||||||
|
|
||||||
|
col.alter(name='foobar', type=Integer(), server_default=text("a"))
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if 'table' not in k:
|
if 'table' not in k:
|
||||||
k['table'] = self.table
|
k['table'] = self.table
|
||||||
@ -487,7 +482,7 @@ class ChangesetColumn(object):
|
|||||||
return alter_column(self, *p, **k)
|
return alter_column(self, *p, **k)
|
||||||
|
|
||||||
def create(self, table=None, index_name=None, unique_name=None,
|
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.
|
"""Create this column in the database.
|
||||||
|
|
||||||
Assumes the given table exists. ``ALTER TABLE ADD COLUMN``,
|
Assumes the given table exists. ``ALTER TABLE ADD COLUMN``,
|
||||||
@ -513,7 +508,7 @@ populated with defaults
|
|||||||
|
|
||||||
:returns: self
|
: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.alter_metadata = kwargs.pop('alter_metadata', DEFAULT_ALTER_METADATA)
|
||||||
self.index_name = index_name
|
self.index_name = index_name
|
||||||
self.unique_name = unique_name
|
self.unique_name = unique_name
|
||||||
|
Loading…
Reference in New Issue
Block a user