[ARVADOS] updated: 67c0a6e006f6e181204559dc28af16a8656878b8
git at public.curoverse.com
git at public.curoverse.com
Tue Aug 19 11:07:04 EDT 2014
Summary of changes:
.../arvados/v1/collections_controller.rb | 2 +-
.../20140811184643_collection_use_regular_uuids.rb | 35 ++++++++++++----------
services/api/db/structure.sql | 2 +-
3 files changed, 22 insertions(+), 17 deletions(-)
via 67c0a6e006f6e181204559dc28af16a8656878b8 (commit)
from b7ab0180bbe96dd1b61b9713d5a3f033f48386c5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 67c0a6e006f6e181204559dc28af16a8656878b8
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Tue Aug 19 11:07:00 2014 -0400
3036: Updated migration to set modified_at instead of updated_at, added modified_by.
diff --git a/services/api/app/controllers/arvados/v1/collections_controller.rb b/services/api/app/controllers/arvados/v1/collections_controller.rb
index d136b99..443bbb4 100644
--- a/services/api/app/controllers/arvados/v1/collections_controller.rb
+++ b/services/api/app/controllers/arvados/v1/collections_controller.rb
@@ -171,8 +171,8 @@ class Arvados::V1::CollectionsController < ApplicationController
end
elsif rsc == Collection
if c = Collection.readable_by(*@read_users).where(uuid: uuid).limit(1).first
- visited[uuid] = c.as_api_response
search_edges(visited, c.portable_data_hash, direction)
+ visited[c.portable_data_hash] = c.as_api_response
end
elsif rsc != nil
rsc.where(uuid: uuid).each do |r|
diff --git a/services/api/db/migrate/20140811184643_collection_use_regular_uuids.rb b/services/api/db/migrate/20140811184643_collection_use_regular_uuids.rb
index fd9054c..8755ee3 100644
--- a/services/api/db/migrate/20140811184643_collection_use_regular_uuids.rb
+++ b/services/api/db/migrate/20140811184643_collection_use_regular_uuids.rb
@@ -17,19 +17,20 @@ where link_class='name' and collections.uuid is null
}
links = ActiveRecord::Base.connection.select_all %{
select links.uuid, head_uuid, tail_uuid, links.name,
-manifest_text, links.created_at, links.updated_at
+manifest_text, links.created_at, links.modified_at, links.modified_by
#{from_clause}
}
links.each do |d|
ActiveRecord::Base.connection.execute %{
-insert into collections (uuid, portable_data_hash, owner_uuid, name, manifest_text, created_at, updated_at)
+insert into collections (uuid, portable_data_hash, owner_uuid, name, manifest_text, created_at, modified_at, modified_by)
values (#{ActiveRecord::Base.connection.quote Collection.generate_uuid},
#{ActiveRecord::Base.connection.quote d['head_uuid']},
#{ActiveRecord::Base.connection.quote d['tail_uuid']},
#{ActiveRecord::Base.connection.quote d['name']},
#{ActiveRecord::Base.connection.quote d['manifest_text']},
#{ActiveRecord::Base.connection.quote d['created_at']},
-#{ActiveRecord::Base.connection.quote d['updated_at']})
+#{ActiveRecord::Base.connection.quote d['modified_at']},
+#{ActiveRecord::Base.connection.quote d['modified_by']})
}
end
ActiveRecord::Base.connection.execute "delete from links where links.uuid in (select links.uuid #{from_clause})"
@@ -41,18 +42,19 @@ from links inner join collections on head_uuid=collections.portable_data_hash
where link_class='permission' and links.name='can_read' and collections.uuid is null
}
links = ActiveRecord::Base.connection.select_all %{
-select links.uuid, head_uuid, tail_uuid, manifest_text, links.created_at, links.updated_at
+select links.uuid, head_uuid, tail_uuid, manifest_text, links.created_at, links.modified_at
#{from_clause}
}
links.each do |d|
ActiveRecord::Base.connection.execute %{
-insert into collections (uuid, portable_data_hash, owner_uuid, manifest_text, created_at, updated_at)
+insert into collections (uuid, portable_data_hash, owner_uuid, manifest_text, created_at, modified_at, modified_by)
values (#{ActiveRecord::Base.connection.quote Collection.generate_uuid},
#{ActiveRecord::Base.connection.quote d['head_uuid']},
#{ActiveRecord::Base.connection.quote d['tail_uuid']},
#{ActiveRecord::Base.connection.quote d['manifest_text']},
#{ActiveRecord::Base.connection.quote d['created_at']},
-#{ActiveRecord::Base.connection.quote d['updated_at']})
+#{ActiveRecord::Base.connection.quote d['modified_at']},
+#{ActiveRecord::Base.connection.quote d['modified_by']})
}
end
ActiveRecord::Base.connection.execute "delete from links where links.uuid in (select links.uuid #{from_clause})"
@@ -60,19 +62,20 @@ values (#{ActiveRecord::Base.connection.quote Collection.generate_uuid},
say_with_time "Step 4. Migrate remaining orphan collection objects" do
links = ActiveRecord::Base.connection.select_all %{
-select portable_data_hash, owner_uuid, manifest_text, created_at, updated_at
+select portable_data_hash, owner_uuid, manifest_text, created_at, modified_at
from collections
where uuid is null and portable_data_hash not in (select portable_data_hash from collections where uuid is not null)
}
links.each do |d|
ActiveRecord::Base.connection.execute %{
-insert into collections (uuid, portable_data_hash, owner_uuid, manifest_text, created_at, updated_at)
+insert into collections (uuid, portable_data_hash, owner_uuid, manifest_text, created_at, modified_at, modified_by)
values (#{ActiveRecord::Base.connection.quote Collection.generate_uuid},
#{ActiveRecord::Base.connection.quote d['portable_data_hash']},
#{ActiveRecord::Base.connection.quote d['owner_uuid']},
#{ActiveRecord::Base.connection.quote d['manifest_text']},
#{ActiveRecord::Base.connection.quote d['created_at']},
-#{ActiveRecord::Base.connection.quote d['updated_at']})
+#{ActiveRecord::Base.connection.quote d['modified_at']},
+#{ActiveRecord::Base.connection.quote d['modified_by']})
}
end
end
@@ -95,20 +98,21 @@ from links
where head_uuid like '________________________________+%' and tail_uuid like '________________________________+%' and links.link_class = 'provenance'
}
links = ActiveRecord::Base.connection.select_all %{
-select links.uuid, head_uuid, tail_uuid, links.created_at, links.updated_at, links.owner_uuid
+select links.uuid, head_uuid, tail_uuid, links.created_at, links.modified_at, links.modified_by, links.owner_uuid
#{from_clause}
}
links.each do |d|
newuuid = Job.generate_uuid
ActiveRecord::Base.connection.execute %{
-insert into jobs (uuid, script_parameters, output, running, success, created_at, updated_at, owner_uuid)
+insert into jobs (uuid, script_parameters, output, running, success, created_at, modified_at, modified_by, owner_uuid)
values (#{ActiveRecord::Base.connection.quote newuuid},
#{ActiveRecord::Base.connection.quote "---\ninput: "+d['tail_uuid']},
#{ActiveRecord::Base.connection.quote d['head_uuid']},
#{ActiveRecord::Base.connection.quote false},
#{ActiveRecord::Base.connection.quote true},
#{ActiveRecord::Base.connection.quote d['created_at']},
-#{ActiveRecord::Base.connection.quote d['updated_at']},
+#{ActiveRecord::Base.connection.quote d['modified_at']},
+#{ActiveRecord::Base.connection.quote d['modified_by']},
#{ActiveRecord::Base.connection.quote d['owner_uuid']})
}
end
@@ -122,12 +126,12 @@ where collections.uuid is not null
}
links = ActiveRecord::Base.connection.select_all %{
select links.uuid, collections.uuid as collectionuuid, tail_uuid, link_class, links.properties,
-links.name, links.created_at, links.updated_at, links.owner_uuid
+links.name, links.created_at, links.modified_at, links.modified_by, links.owner_uuid
#{from_clause}
}
links.each do |d|
ActiveRecord::Base.connection.execute %{
-insert into links (uuid, head_uuid, tail_uuid, link_class, name, properties, created_at, updated_at, owner_uuid)
+insert into links (uuid, head_uuid, tail_uuid, link_class, name, properties, created_at, modified_at, modified_by, owner_uuid)
values (#{ActiveRecord::Base.connection.quote Link.generate_uuid},
#{ActiveRecord::Base.connection.quote d['collectionuuid']},
#{ActiveRecord::Base.connection.quote d['tail_uuid']},
@@ -135,7 +139,8 @@ values (#{ActiveRecord::Base.connection.quote Link.generate_uuid},
#{ActiveRecord::Base.connection.quote d['name']},
#{ActiveRecord::Base.connection.quote d['properties']},
#{ActiveRecord::Base.connection.quote d['created_at']},
-#{ActiveRecord::Base.connection.quote d['updated_at']},
+#{ActiveRecord::Base.connection.quote d['modified_at']},
+#{ActiveRecord::Base.connection.quote d['modified_by']},
#{ActiveRecord::Base.connection.quote d['owner_uuid']})
}
end
diff --git a/services/api/db/structure.sql b/services/api/db/structure.sql
index a00e6cd..de29332 100644
--- a/services/api/db/structure.sql
+++ b/services/api/db/structure.sql
@@ -168,7 +168,7 @@ CREATE TABLE collections (
manifest_text text,
name character varying(255),
description character varying(255),
- properties character varying(255),
+ properties text,
expire_time date
);
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list