# Path: entity/configuration.py
# class Configuration:
#     def __init__(self, id=None, name='', value=''):
#     def __str__(self):
#     def delete(self, db):
#     def find_all(db):
#     def find_name(db, name):
#     def find_pk(db, id):
#     def from_row(row):
#     def is_new(self):
#     def save(self, db):
#     def __generic_find(db, query, params):
# 
# Path: entity/tag.py
# class Tag:
#     def __init__(self, id=None, name='', synonym_of=None, synonyms=[]):
#     def __str__(self):
#     def delete(self, db):
#     def find_all(db):
#     def find_name(db, name):
#     def find_pk(db, id):
#     def find_recipe(db, recipe):
#     def find_synonyms(self, db):
#     def from_row(db, row, find_synonyms=True):
#     def is_new(self):
#     def name_exists(db, name):
#     def save(self, db):
#     def __generic_find(db, query, params):
# 
# Path: migration/tags.py



from entity import configuration as config_entity
from entity import tag as tag_entity
from migration import tags as tag_lists
import os
import shutil
import sqlite3
import sys
        # Version 12 -> 13
        current = 12

        # Finished
        db.close()

    def __create_db(self):
        """ Create database file if not existing. """
        if not os.path.exists(self.db_file):
            shutil.copy(self.home+self.EMPTY_DB_FILE, self.db_file)

    def __create_tags(self, db, tags):
        """ Create initial set of German and English tags. """
        for tag_names in tags:
            first = True
            parent_id = None
            for tag_name in tag_names:
                tag = tag_entity.Tag(name=tag_name, synonym_of=parent_id)
                try:
                    tag.save(db)
                except sqlite3.IntegrityError:
                    print('{} in [{}]'.format(tag_name, ', '.join(tag_names)))
                    sys.exit(80085)
                if first:
                    parent_id = tag.id
                    first = False
        db.commit()

    def __is_version(self, db, version):
        """ Checks version in configuration table. """

# Path: entity/configuration.py
# class Configuration:
#     def __init__(self, id=None, name='', value=''):
#     def __str__(self):
#     def delete(self, db):
#     def find_all(db):
#     def find_name(db, name):
#     def find_pk(db, id):
#     def from_row(row):
#     def is_new(self):
#     def save(self, db):
#     def __generic_find(db, query, params):
# 
# Path: entity/tag.py
# class Tag:
#     def __init__(self, id=None, name='', synonym_of=None, synonyms=[]):
#     def __str__(self):
#     def delete(self, db):
#     def find_all(db):
#     def find_name(db, name):
#     def find_pk(db, id):
#     def find_recipe(db, recipe):
#     def find_synonyms(self, db):
#     def from_row(db, row, find_synonyms=True):
#     def is_new(self):
#     def name_exists(db, name):
#     def save(self, db):
#     def __generic_find(db, query, params):
# 
# Path: migration/tags.py



# Path: migration/migration_manager.py
from entity import configuration as config_entity
from entity import tag as tag_entity
from migration import tags as tag_lists
import os
import shutil
import sqlite3
import sys

        # Version 12 -> 13
        current = 12

        # Finished
        db.close()

    def __create_db(self):
        """ Create database file if not existing. """
        if not os.path.exists(self.db_file):
            shutil.copy(self.home+self.EMPTY_DB_FILE, self.db_file)

    def __create_tags(self, db, tags):
        """ Create initial set of German and English tags. """
        for tag_names in tags:
            first = True
            parent_id = None
            for tag_name in tag_names:
                tag = tag_entity.Tag(name=tag_name, synonym_of=parent_id)
                try:
                    tag.save(db)
                except sqlite3.IntegrityError:
                    print('{} in [{}]'.format(tag_name, ', '.join(tag_names)))
                    sys.exit(80085)
                if first:
                    parent_id = tag.id
                    first = False
        db.commit()

    def __is_version(self, db, version):
        """ Checks version in configuration table. """

        config = config_entity.Configuration.find_name(db, self.CONFIG_VERSION)