Skip to content

Instantly share code, notes, and snippets.

@yulgit1
Last active August 29, 2015 14:20
Show Gist options
  • Save yulgit1/2a2f7f46c52859cb2436 to your computer and use it in GitHub Desktop.
Save yulgit1/2a2f7f46c52859cb2436 to your computer and use it in GitHub Desktop.
Addded stored procedures:
Stored procedure name: lb_datehydraend
Input parameter: hpid
Replaces: update = @@client.execute(%Q/update dbo.hydra_publish set dateHydraEnd=GETDATE() where hpid=#{i["hpid"]}/)
Line : 299,309,332,351,370,497
Stored procedure name: lb_datehydraend_hydraid
Input parameter: hpid,hydraid
Replaces: str = %Q/update dbo.hydra_publish set hydraID='#{obj.pid}', dateHydraEnd=GETDATE() where hpid=#{i["hpid"]}
Line : 699
Stored procedure name: lb_datehydraend_datehydrastart
Input parameter: hpid
Replaces: update = @@client.execute(%Q/update hydra_publish set dateHydraStart = null,dateHydraEnd = null where hpid = #{i["hpid"]}/)
Line : 863
Stored procedure name: lb_datehydrastart_attempts_server
Input parameter: hpid,server,ingestserver
Replaces: update = update = @@client.execute(%Q/update dbo.hydra_publish set dateHydraStart=GETDATE(),attempts=(select attempts+1 from hydra_publish where hpid=#{i["hpid"]}),server='#{@server}',ingestServer='#{@ingest_server}' where hpid=#{i["hpid"]}/)
Line : 925
Stored procedure name: lb_datehydrastart_datehydraend_action_server
Input parameter: hpid,server
Replaces: update = @@client.execute(%Q/update dbo.hydra_publish set dateHydraStart=GETDATE(),dateHydraEnd=GETDATE(),action='duplic',server='#{@server}' where hpid=#{i["hpid"]}/)
Line : 931
------------------------------------
tests of yulhy:14:
test setup:
use rails console to refresh oids already in fedora/solr by deleting from fedora/solr (digcoll:140-144)
o = ActiveFedora::Base.find("digcoll:140")
o.delete
1) do 5 inserts 1, 1 parent, 4 children (hpid in (387761-5))
2) refresh 1 totally and throw error
3) refresh 1 in db and and check duplic
4) change 1 in db to update and refresh
5) change same 1 to db inact and refresh
6) change same 1 to active and refresh
7) change same 1 to delete and refresh
8) change same 1 purge and refresh
refresh SQL for above:
update hydra_publish set hydraID='',action='insert',dateHydraStart=null,dateHydraEnd=null,attempts=0,server=null,ingestServer=null where hpid in
(387761,
387762,
387763,
387764,
387765)
update hydra_publish set hydraID='',action='insert',dateHydraStart=null,dateHydraEnd=null,attempts=0,server=null,ingestServer=null where hpid in (387764)
update hydra_publish set action='update',dateHydraStart=null,dateHydraEnd=null,attempts=0,server=null,ingestServer=null where hpid in (387763)
update hydra_publish set action='inact',dateHydraStart=null,dateHydraEnd=null,attempts=0,server=null,ingestServer=null where hpid in (387763)
update hydra_publish set action='active',dateHydraStart=null,dateHydraEnd=null,attempts=0,server=null,ingestServer=null where hpid in (387763)
update hydra_publish set action='delete',dateHydraStart=null,dateHydraEnd=null,attempts=0,server=null,ingestServer=null where hpid in (387763)
update hydra_publish set action='purge',dateHydraStart=null,dateHydraEnd=null,attempts=0,server=null,ingestServer=null where hpid in (387763)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment