]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
#553 propigate index on copied columns
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 25 Apr 2007 17:22:16 +0000 (17:22 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 25 Apr 2007 17:22:16 +0000 (17:22 +0000)
lib/sqlalchemy/schema.py

index a0dd287e33deaf6ecad468a41cbaa4be9de4264b..a27adf06eec604bec3cc977182c3669a095186c4 100644 (file)
@@ -571,11 +571,11 @@ class Column(SchemaItem, sql._ColumnClause):
 
         if self.index:
             if isinstance(self.index, basestring):
-                raise exceptions.ArgumentError("The 'index' keyword argument on Column is boolean only.  To create indexes with a specific name, append an explicit Index object to the Table's list of elements.")
+                raise exceptions.ArgumentError("The 'index' keyword argument on Column is boolean only.  To create indexes with a specific name, create an explicit Index object external to the Table.")
             Index('ix_%s' % self._label, self, unique=self.unique)
         elif self.unique:
             if isinstance(self.unique, basestring):
-                raise exceptions.ArgumentError("The 'unique' keyword argument on Column is boolean only.  To create unique constraints or indexes with a specific name, append an explicit UniqueConstraint or Index object to the Table's list of elements.")
+                raise exceptions.ArgumentError("The 'unique' keyword argument on Column is boolean only.  To create unique constraints or indexes with a specific name, append an explicit UniqueConstraint to the Table's list of elements, or create an explicit Index object external to the Table.")
             table.append_constraint(UniqueConstraint(self.key))
 
         toinit = list(self.args)
@@ -592,7 +592,7 @@ class Column(SchemaItem, sql._ColumnClause):
         This is used in ``Table.tometadata``.
         """
 
-        return Column(self.name, self.type, self.default, key = self.key, primary_key = self.primary_key, nullable = self.nullable, _is_oid = self._is_oid, case_sensitive=self._case_sensitive_setting, quote=self.quote, *[c.copy() for c in self.constraints])
+        return Column(self.name, self.type, self.default, key = self.key, primary_key = self.primary_key, nullable = self.nullable, _is_oid = self._is_oid, case_sensitive=self._case_sensitive_setting, quote=self.quote, index=self.index, *[c.copy() for c in self.constraints])
 
     def _make_proxy(self, selectable, name = None):
         """Create a *proxy* for this column.