Delimiter //
/**
 * Clone table, used for contacts
 */ 
Drop Procedure if exists LOADER_CREATE_TABLE_ACCOUNTS_REPLICATION//
Create Procedure LOADER_CREATE_TABLE_ACCOUNTS_REPLICATION()
Begin

    Drop Table If Exists LOADER_ACCOUNTS_REPLICATION;

    Create Table LOADER_ACCOUNTS_REPLICATION (

        -- champs pour le traitements de l'import
        LOADER_STATUS_ID_LOADER_STATUS Int Unsigned Not Null,

        -- pour la gestion correct du muti-cible
        LOADER_ACCOUNTS_ID_LOADER_ACCOUNTS Int Unsigned Not Null,

        -- champ auto increment, initialisé avant chanque import
        ID_LOADER_ACCOUNTS_REPLICATION Int Unsigned Not Null Auto_increment,

        -- General, references
        ID_ACCOUNTS Int Unsigned Null,
        ID_ACCOUNTS_NEW Int Unsigned Null,

        -- contraintes et indexes
        Primary Key (ID_LOADER_ACCOUNTS_REPLICATION)
        , Index (LOADER_STATUS_ID_LOADER_STATUS)
        , Index (ID_ACCOUNTS)
        , Index (ID_ACCOUNTS_NEW)
        , Index (LOADER_ACCOUNTS_ID_LOADER_ACCOUNTS)

    ) ;

End //
Delimiter ;
call LOADER_CREATE_TABLE_ACCOUNTS_REPLICATION();