Browse Source

Add first stub for profile database

CURA-6096
Jaime van Kessel 3 years ago
parent
commit
3f80fcb5e5
1 changed files with 26 additions and 0 deletions
  1. 26 0
      cura/Settings/CuraContainerRegistry.py

+ 26 - 0
cura/Settings/CuraContainerRegistry.py

@@ -44,6 +44,32 @@ class CuraContainerRegistry(ContainerRegistry):
         # is added, we check to see if an extruder stack needs to be added.
         self.containerAdded.connect(self._onContainerAdded)
 
+    @override(ContainerRegistry)
+    def _createDatabaseFile(self, db_path: str) -> None:
+        connection = super()._createDatabaseFile(db_path)
+        cursor = connection.cursor()
+        cursor.execute("""
+                CREATE TABLE qualities(
+                    id text,
+                    name text,
+                    quality_type text,
+                    material text,
+                    variant text,
+                    global_quality bool,
+                    definition text
+                );
+                CREATE UNIQUE INDEX idx_qualities_id on qualities (id);
+
+                CREATE TABLE variants(
+                    id text,
+                    name text,
+                    hardware_type text,
+                    definition text
+                );
+                CREATE UNIQUE INDEX idx_variants_id on variants (id);
+            """)
+        return connection
+
     @override(ContainerRegistry)
     def addContainer(self, container: ContainerInterface) -> bool:
         """Overridden from ContainerRegistry