1097 self.rqlexec('DELETE CWRType X WHERE X name %r' % rtype, |
1097 self.rqlexec('DELETE CWRType X WHERE X name %r' % rtype, |
1098 ask_confirm=self.verbosity>=2) |
1098 ask_confirm=self.verbosity>=2) |
1099 if commit: |
1099 if commit: |
1100 self.commit() |
1100 self.commit() |
1101 |
1101 |
1102 def cmd_rename_relation_type(self, oldname, newname, commit=True): |
1102 def cmd_rename_relation_type(self, oldname, newname, commit=True, force=False): |
1103 """rename an existing relation |
1103 """rename an existing relation |
1104 |
1104 |
1105 `oldname` is a string giving the name of the existing relation |
1105 `oldname` is a string giving the name of the existing relation |
1106 `newname` is a string giving the name of the renamed relation |
1106 `newname` is a string giving the name of the renamed relation |
1107 """ |
1107 |
|
1108 If `force` is True, proceed even if `oldname` still appears in the fs schema |
|
1109 """ |
|
1110 if oldname in self.fs_schema and not force: |
|
1111 if not self.confirm('Relation %s is still present in the filesystem schema,' |
|
1112 ' do you really want to drop it?' % oldname, |
|
1113 default='n'): |
|
1114 raise SystemExit(1) |
1108 self.cmd_add_relation_type(newname, commit=True) |
1115 self.cmd_add_relation_type(newname, commit=True) |
1109 self.rqlexec('SET X %s Y WHERE X %s Y' % (newname, oldname), |
1116 self.rqlexec('SET X %s Y WHERE X %s Y' % (newname, oldname), |
1110 ask_confirm=self.verbosity>=2) |
1117 ask_confirm=self.verbosity>=2) |
1111 self.cmd_drop_relation_type(oldname, commit=commit) |
1118 self.cmd_drop_relation_type(oldname, commit=commit) |
1112 |
1119 |