# HG changeset patch # User Julien Cristau # Date 1394127683 -3600 # Node ID 737983d8749779bdea05fc46e02e7a0937327074 # Parent d96b5e72717cae436068ea80254b51492548b248 [migractions] add sanity check in rename_relation_type If the relation is still present in the fs schema, we probably shouldn't be renaming it (because it's still in use somewhere, possibly in a different cube). Closes #3608172 diff -r d96b5e72717c -r 737983d87497 server/migractions.py --- a/server/migractions.py Mon Apr 07 08:46:41 2014 +0000 +++ b/server/migractions.py Thu Mar 06 18:41:23 2014 +0100 @@ -1099,12 +1099,19 @@ if commit: self.commit() - def cmd_rename_relation_type(self, oldname, newname, commit=True): + def cmd_rename_relation_type(self, oldname, newname, commit=True, force=False): """rename an existing relation `oldname` is a string giving the name of the existing relation `newname` is a string giving the name of the renamed relation + + If `force` is True, proceed even if `oldname` still appears in the fs schema """ + if oldname in self.fs_schema and not force: + if not self.confirm('Relation %s is still present in the filesystem schema,' + ' do you really want to drop it?' % oldname, + default='n'): + raise SystemExit(1) self.cmd_add_relation_type(newname, commit=True) self.rqlexec('SET X %s Y WHERE X %s Y' % (newname, oldname), ask_confirm=self.verbosity>=2)