# HG changeset patch # User Sylvain Thénault # Date 1406019621 -7200 # Node ID 671bbfed459b553b6214ee1e7c91cba60a41f685 # Parent 0f64ef873f7a4c45cb920094fa942531ae6d661e [CWEP002 migration] support drop_relation_type/drop_relation_definition/drop_attribute for computed attributes diff -r 0f64ef873f7a -r 671bbfed459b server/test/datacomputed/schema.py --- a/server/test/datacomputed/schema.py Thu Aug 28 18:31:18 2014 +0200 +++ b/server/test/datacomputed/schema.py Tue Jul 22 11:00:21 2014 +0200 @@ -38,7 +38,7 @@ class Note(EntityType): note = Int() - + note20 = Int(formula='Any N*20 WHERE X note N') class concerns(RelationDefinition): subject = 'Note' diff -r 0f64ef873f7a -r 671bbfed459b server/test/unittest_migractions.py --- a/server/test/unittest_migractions.py Thu Aug 28 18:31:18 2014 +0200 +++ b/server/test/unittest_migractions.py Tue Jul 22 11:00:21 2014 +0200 @@ -799,6 +799,31 @@ self.assertIn('score', self.schema) self.assert_score_initialized(mh) + def assert_computed_attribute_dropped(self): + self.assertNotIn('note20', self.schema) + # DROP COLUMN not supported by sqlite + #with self.mh() as (cnx, mh): + # fields = self.table_schema(mh, '%sNote' % SQL_PREFIX) + #self.assertNotIn('%snote20' % SQL_PREFIX, fields) + + def test_computed_attribute_drop_type(self): + self.assertIn('note20', self.schema) + with self.mh() as (cnx, mh): + mh.cmd_drop_relation_type('note20') + self.assert_computed_attribute_dropped() + + def test_computed_attribute_drop_relation_definition(self): + self.assertIn('note20', self.schema) + with self.mh() as (cnx, mh): + mh.cmd_drop_relation_definition('Note', 'note20', 'Int') + self.assert_computed_attribute_dropped() + + def test_computed_attribute_drop_attribute(self): + self.assertIn('note20', self.schema) + with self.mh() as (cnx, mh): + mh.cmd_drop_attribute('Note', 'note20') + self.assert_computed_attribute_dropped() + if __name__ == '__main__': unittest_main()