# -*- coding: utf-8 -*-
import os

from ppms.migration.packet import *
from ppms import ppms

class AddSessionId(SQLPacket):
    '''Adds the new Session ID dataitem to the user info
    
    This adds the new DI 062216 "Session-ID" to the user info that opens
    when you press CTRL + B
    '''
    version = 1
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 10673

    sql_filename = 'WI10673_add_session_id.sql'

    def fix(self, runner):
        sqlpath = self.get_sql_file_path(self.sql_planta_de_dbms, self.sql_filename)
        queries = self.get_queries_from_file(sqlpath)

        for query in queries:
            self.modify_and_log(query)

        return self.success()