]> git.parisson.com Git - telemeta-data.git/commitdiff
storage durations as integers for compatibility with Django mysql backend
authorolivier <olivier@3bf09e05-f825-4182-b9bc-eedd7160adf0>
Thu, 11 Feb 2010 13:02:34 +0000 (13:02 +0000)
committerolivier <olivier@3bf09e05-f825-4182-b9bc-eedd7160adf0>
Thu, 11 Feb 2010 13:02:34 +0000 (13:02 +0000)
git-svn-id: http://svn.parisson.org/svn/crem@153 3bf09e05-f825-4182-b9bc-eedd7160adf0

trunk/docref/crem.sql
trunk/docref/docref.odt
trunk/import/migration/migrate.py [changed mode: 0644->0755]
trunk/import/migration/tasks/collections.py
trunk/import/migration/tasks/core.py
trunk/import/migration/tasks/items.py

index 705d30b219d8caea5b2bdce2b5110460c7d172f2..4ca26194e1874e6795f5c0d4a1c10fb90fcd1865 100644 (file)
@@ -213,7 +213,7 @@ CREATE TABLE media_collections (
     recorded_from_year      INTEGER NOT NULL DEFAULT 0,
     recorded_to_year        INTEGER NOT NULL DEFAULT 0,
     recording_context_id    INTEGER,
-    approx_duration         TIME NOT NULL DEFAULT 0,
+    approx_duration         INT NOT NULL DEFAULT 0,
     doctype_code            INTEGER NOT NULL DEFAULT 0,
     travail                 VARCHAR(250) NOT NULL DEFAULT '',
     state                   TEXT NOT NULL DEFAULT '',
@@ -255,7 +255,7 @@ CREATE TABLE media_items (
     track                   VARCHAR(250) NOT NULL DEFAULT '',
     old_code                VARCHAR(250) UNIQUE NOT NULL,
     code                    VARCHAR(250) UNIQUE, -- Doit ĂȘtre unique mais peut ĂȘtre inconnu
-    approx_duration         TIME NOT NULL DEFAULT 0,
+    approx_duration         INT NOT NULL DEFAULT 0,
     recorded_from_date      DATE NOT NULL DEFAULT 0,
     recorded_to_date        DATE NOT NULL DEFAULT 0,
     location_id             INTEGER,
index 12a01733b198255877bbb9c92c3321845e34520e..7203e6b8f216a97d699f8e9f9caf59ea8ec8f493 100644 (file)
Binary files a/trunk/docref/docref.odt and b/trunk/docref/docref.odt differ
old mode 100644 (file)
new mode 100755 (executable)
index 5e13694..7697d12
@@ -1,3 +1,4 @@
+#!/usr/bin/python
 # -*- coding: utf-8 -*-
 #
 # CREM Database migrator
index c84746461f337cc67f62c0148d3b9f06f994c0e0..7c176a822b9653eb043e7309529ea8d94e8476c0 100644 (file)
@@ -58,7 +58,7 @@ class CollectionsCopyMigrator(DataMigrator):
         ('Ref_Biblio',         'external_references'),
         ('Commentaire',        'comment'),
         ('Autres_Cotes',       'alt_ids'),
-        ('Duree_approx',       'approx_duration'),
+        ('Duree_approx',       'approx_duration', 'TIME_TO_SEC'),
         ('Tri DiBm',           'doctype_code'),
         ('Travail',            'travail'),
         ('CompilFacePlage',    'state'),
index b138d2a67ac0b0ca9a16309cb52aeb8fb6d7cfef..c9acafa7d7013e02b6d75b912123ec0c4f3246cd 100644 (file)
@@ -87,9 +87,12 @@ class DataMigrator(DataMigrationTask):
 
     def build_assignments(self, map):
         assign = []
-        for f1, f2 in map:
-            f2 = '`%s`' % f2
-            f1 = '`%s`' % f1
+        for e in map:
+            f2 = '`%s`' % e[1]
+            if len(e) > 2:
+                f1 = '%s(`%s`)' % (e[2], e[0])
+            else:
+                f1 = '`%s`' % e[0]
             assign.append((f2, f1))
 
         return assign
index ed07c592ec22acc7d39e7786191a1c8a683fcf69..b00b67e65a0883c2346db372d2edcb23d0e588b7 100644 (file)
@@ -46,7 +46,7 @@ class ItemsCopyMigrator(DataMigrator):
     map = [
         ('Face_Plage',         'track'),
         ('Cote_Phono',         'old_code'),
-        ('Duree',              'approx_duration'),
+        ('Duree',              'approx_duration', 'TIME_TO_SEC'),
         ('Titre_piece',        'title'),
         ('Transcrip_Trad',     'alt_title'),
         ('Auteur',             'author'),