/*
    This script inserts a default administrator with username 'admin' into the table 'medusa_admin'.
*/

-- Comment out 'SET sqlblanklines on' if you're using a SQL client other than Oracle SQL*Plus
SET sqlblanklines on

DELETE
FROM medusa_admin
WHERE username = 'admin';

INSERT INTO medusa_admin (username,
                          givenname,
                          surname,
                          roles,
                          pwd_hash,
                          pwd_chg_enf)
VALUES ('admin',
        'IAM',
        'Administrator',
        'superadmin',
        'MedusaPwdHistoryAAAAYSRhcmdvbjJpZCR2PTE5JG09MTk0NTYsdD0yLHA9MSRJZ214enpweUxqRW1ldVZHeWcwdGVnJGRRdS9NRGpybzF6SDFpcy9lenRjWnBMT3FURUZjSGo3SFl4K3d2emZDU2s=',
        1 /* Password change enforced */
       );

/*
    Depending on auto commit settings of Oracle, this line is necessary or
    may be superfluous. If no auto commit is enabled and no no commit is done;
    the process will block on Oracle, i.e. the administrator is not visible
    for other processes, or - even worse - also blocks other processes
    infinitely.
*/
COMMIT;
