summaryrefslogtreecommitdiff
path: root/python/skytools/dbstruct.py
diff options
context:
space:
mode:
authorMarko Kreen2009-10-28 13:34:27 +0000
committerMarko Kreen2009-11-03 12:43:44 +0000
commit7c61751b50809ade03179f3b6ee136e78681013f (patch)
tree450e7dfbd95fae4d22d14551f7863017f2521216 /python/skytools/dbstruct.py
parentc190ed030ab9d1c41c761b0cc9198142ab97bfc9 (diff)
dbstruct: Remove ONLY from ADD CONSTRAINT.
Parent table cannot have contraints that the childs do not have.
Diffstat (limited to 'python/skytools/dbstruct.py')
-rw-r--r--python/skytools/dbstruct.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/python/skytools/dbstruct.py b/python/skytools/dbstruct.py
index 916de131..8e559036 100644
--- a/python/skytools/dbstruct.py
+++ b/python/skytools/dbstruct.py
@@ -93,7 +93,9 @@ class TConstraint(TElem):
def get_create_sql(self, curs, new_table_name=None):
"""Generate creation SQL."""
- fmt = "ALTER TABLE ONLY %s ADD CONSTRAINT %s %s;"
+ # no ONLY here as table with childs (only case that matters)
+ # cannot have contraints that childs do not have
+ fmt = "ALTER TABLE %s ADD CONSTRAINT %s %s;"
if new_table_name:
name = self.name
if self.contype in ('p', 'u'):