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,6 +7,7 @@ import settings
7 7
 class MySQL(object):
8 8
 
9 9
     relations_table_name = 'relation'
10
+    relation_table_pkname = 'id_relation'
10 11
     relations_field_nature = 'nature'
11 12
     field_lodel_id = 'lodel_id'
12 13
     class_table_prefix = 'class_'
@@ -26,8 +27,8 @@ class MySQL(object):
26 27
     # @param type_name str
27 28
     # @param field_name str
28 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 33
     @classmethod
33 34
     ## @brief gets the fk name between two tables

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

@@ -235,7 +235,7 @@ class MysqlMigrationHandler(EditorialModel.migrationhandler.dummy.DummyMigration
235 235
     def _r2t2table_name(self, em, emfield):
236 236
         emclass = emfield.em_class
237 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 239
         #return "%s_%s_%s"%(emclass.name, emtype.name, emfield.name)
240 240
      
241 241
     ## @brief Generate a columns_fieldtype dict given a rel2type EmField
@@ -504,7 +504,7 @@ FOR EACH ROW SET {col_val_list};""".format(
504 504
     # @todo do it
505 505
     @property
506 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 509
     ## @brief Returns a dict { colname:fieldtype } of relation table columns
510 510
     @property

Loading…
Cancel
Save