Subversion Repositories computer_asset_manager_v1

Rev

Blame | Last modification | View Log | Download | RSS feed

/*
   Clones the maintenance schedule of one machine (<CLONE_FROM>) 
   into new machine (<CLONE_INTO)
   Search/Replace all instances of <CLONE_FROM> with the device_id
   of the machine to get the schedule from.
   Now, Search/Replace all instances of <CLONE_INTO> with the
   device_id of the machine you want to add schedule to
   Run query on CAMP
*/
insert into maintenance_schedule
   (
      device_id,
      maintenance_task_id,
      schedule,
      login_id,
      added_date
   )
   select
      <CLONE_INTO>,
      maintenance_task_id,
      schedule,
      login_id,
      now()
   from
      maintenance_schedule
   where
      device_id = <CLONE_FROM>;


insert into maintenance_performed
   (
      device_id,
      maintenance_task_id,
      maintenance_date,
      notes,
      login_id
   )
   select
      device_id,
      maintenance_task_id,
      now(),
      'Initial Load',
      login_id
   from
      maintenance_schedule
   where
      device_id = <CLONE_INTO>;