Browse Source

Updated some MySQL properties and MigrationHandler stuff

Yann Weber 9 years ago
parent
commit
24b758af9b
2 changed files with 5 additions and 4 deletions
  1. 3
    2
      DataSource/MySQL/MySQL.py
  2. 2
    2
      EditorialModel/migrationhandler/mysql.py

+ 3
- 2
DataSource/MySQL/MySQL.py View File

7
 class MySQL(object):
7
 class MySQL(object):
8
 
8
 
9
     relations_table_name = 'relation'
9
     relations_table_name = 'relation'
10
+    relation_table_pkname = 'id_relation'
10
     relations_field_nature = 'nature'
11
     relations_field_nature = 'nature'
11
     field_lodel_id = 'lodel_id'
12
     field_lodel_id = 'lodel_id'
12
     class_table_prefix = 'class_'
13
     class_table_prefix = 'class_'
26
     # @param type_name str
27
     # @param type_name str
27
     # @param field_name str
28
     # @param field_name str
28
     # @return str
29
     # @return str
29
-    def get_r2t2table_name(cls, class_name, type_name, field_name):
30
-        return "%s_%s_%s" % (class_name, type_name, field_name)
30
+    def get_r2t2table_name(cls, class_name, type_name):
31
+        return "r2t_%s_%s" % (class_name, type_name)
31
 
32
 
32
     @classmethod
33
     @classmethod
33
     ## @brief gets the fk name between two tables
34
     ## @brief gets the fk name between two tables

+ 2
- 2
EditorialModel/migrationhandler/mysql.py View File

235
     def _r2t2table_name(self, em, emfield):
235
     def _r2t2table_name(self, em, emfield):
236
         emclass = emfield.em_class
236
         emclass = emfield.em_class
237
         emtype = em.component(emfield.rel_to_type_id)
237
         emtype = em.component(emfield.rel_to_type_id)
238
-        return self.datasource.get_r2t2table_name(emclass.name, emtype.name, emfield.name)
238
+        return self.datasource.get_r2t2table_name(emclass.name, emtype.name)
239
         #return "%s_%s_%s"%(emclass.name, emtype.name, emfield.name)
239
         #return "%s_%s_%s"%(emclass.name, emtype.name, emfield.name)
240
      
240
      
241
     ## @brief Generate a columns_fieldtype dict given a rel2type EmField
241
     ## @brief Generate a columns_fieldtype dict given a rel2type EmField
504
     # @todo do it
504
     # @todo do it
505
     @property
505
     @property
506
     def _relation_pk(self):
506
     def _relation_pk(self):
507
-        return ('id_relation', EditorialModel.fieldtypes.pk.EmFieldType())
507
+        return (MySQL.relation_table_pkname, EditorialModel.fieldtypes.pk.EmFieldType())
508
     
508
     
509
     ## @brief Returns a dict { colname:fieldtype } of relation table columns
509
     ## @brief Returns a dict { colname:fieldtype } of relation table columns
510
     @property
510
     @property

Loading…
Cancel
Save