Toni Ruža avatar Toni Ruža committed 4ca74fd

Removed field_type column from the Changes table in the sqlite backend.

Comments (0)

Files changed (2)

roktar/backends/sqlite_backend.py

     change_time INTEGER,
     entity_id INTEGER,
     field_name TEXT,
-    field_type TEXT,
     old_value BLOB,
     new_value BLOB
 );
         last_change = self.get_last_change_uuid()
         for key, value in data.iteritems():
             new_change = uuid4().hex
-
-            if isinstance(value, int):
-                field_type = "int"
-            elif isinstance(value, float):
-                field_type = "real"
-            else:
-                field_type = "text"
-
             self.insert(
                 "Changes",
                 change_uuid=new_change,
                 change_time=timestamp,
                 entity_id=entity_id,
                 field_name=key,
-                field_type=field_type,
                 old_value=dumps(None),
                 new_value=dumps(value)
             )

tests/test_data_handling.py

             entity, dict(hello="world"), "Entity has an unexpected value"
         )
 
-        chages = list(self.roktar.get_changes(entity_id))
-        self.assertEqual(len(chages), 1, "Entity didn't remember it's changes")
+        changes = list(self.roktar.get_changes(entity_id))
+        self.assertEqual(len(changes), 1, "Entity didn't remember it's changes")
 
-        change = chages[0]
+        change = changes[0]
         change_uuid = UUID(change["change_uuid"])
         change_time = datetime.fromtimestamp(change["change_time"])
         self.assertEqual(change_uuid.version, 4)
         )
         self.assertEqual(change["entity_id"], entity_id)
         self.assertEqual(change["field_name"], "hello")
-        self.assertEqual(change["field_type"], "text")
         self.assertEqual(loads(str(change["old_value"])), None)
         self.assertEqual(loads(str(change["new_value"])), "world")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.