diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-10-25 00:40:34 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-10-25 00:40:34 +0000 |
commit | aa557982fa2518e6d520ce17894093d5ed03c0eb (patch) | |
tree | 5bc55ac2aa8d33de635c380f775e642c52bc7d8c /lib/sqlalchemy/schema.py | |
parent | 82ea898ab06063ebac631f4e375331550a226687 (diff) | |
download | sqlalchemy-aa557982fa2518e6d520ce17894093d5ed03c0eb.tar.gz |
- Added new ENUM type to the Postgresql dialect, which exists as a schema-level
construct and extends the generic Enum type. Automatically
associates itself with tables and their parent metadata
to issue the appropriate CREATE TYPE/DROP TYPE
commands as needed, supports unicode labels, supports
reflection. [ticket:1511]
- MySQL ENUM now subclasses the new generic Enum type, and also handles
unicode values implicitly, if the given labelnames are unicode
objects.
- Added a new Enum generic type, currently supported on
Postgresql and MySQL. Enum is a schema-aware object
to support databases which require specific DDL in
order to use enum or equivalent; in the case of PG
it handles the details of `CREATE TYPE`, and on
other databases without native enum support can
support generation of CHECK constraints.
[ticket:1109] [ticket:1511]
- types documentation updates
- some cleanup on schema/expression docs
Diffstat (limited to 'lib/sqlalchemy/schema.py')
-rw-r--r-- | lib/sqlalchemy/schema.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 5b63f6e29..b99f79a8e 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -641,6 +641,9 @@ class Column(SchemaItem, expression.ColumnClause): self.foreign_keys = util.OrderedSet() self._table_events = set() + if isinstance(self.type, types.SchemaType): + self.type._set_parent(self) + if self.default is not None: if isinstance(self.default, (ColumnDefault, Sequence)): args.append(self.default) @@ -651,8 +654,10 @@ class Column(SchemaItem, expression.ColumnClause): args.append(self.server_default) else: args.append(DefaultClause(self.server_default)) + if self.onupdate is not None: args.append(ColumnDefault(self.onupdate, for_update=True)) + if self.server_onupdate is not None: if isinstance(self.server_onupdate, FetchedValue): args.append(self.server_default) |