[ARVADOS] updated: 48c12769b32edce2b2d7592c58dcc7ed9ea63369

git at public.curoverse.com git at public.curoverse.com
Sat Dec 13 15:10:39 EST 2014


Summary of changes:
 .../20141208174553_descriptions_are_strings.rb       | 19 +++++++++++++++++++
 .../api/db/migrate/20141208185217_search_index.rb    |  8 ++++----
 services/api/db/structure.sql                        | 20 +++++++++++---------
 services/api/test/unit/arvados_model_test.rb         |  7 +++++--
 4 files changed, 39 insertions(+), 15 deletions(-)
 create mode 100644 services/api/db/migrate/20141208174553_descriptions_are_strings.rb

       via  48c12769b32edce2b2d7592c58dcc7ed9ea63369 (commit)
      from  011cdc12d3d3a664e8a8ef09bc0e7f5223afa6df (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 48c12769b32edce2b2d7592c58dcc7ed9ea63369
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Sat Dec 13 15:08:55 2014 -0500

    4523: Change description column from text to string on jobs, groups, pipeline_instances and pipeline_templates. Also, update search indexes to include the description column for those tables.

diff --git a/services/api/db/migrate/20141208174553_descriptions_are_strings.rb b/services/api/db/migrate/20141208174553_descriptions_are_strings.rb
new file mode 100644
index 0000000..b33a49a
--- /dev/null
+++ b/services/api/db/migrate/20141208174553_descriptions_are_strings.rb
@@ -0,0 +1,19 @@
+class DescriptionsAreStrings < ActiveRecord::Migration
+  def tables_with_description_column
+    %w{collections groups jobs pipeline_instances pipeline_templates}
+  end
+
+  def up
+    tables_with_description_column.each do |table|
+      change_column table.to_sym, :description, :string, :limit => 10000
+    end
+  end
+
+  def down
+    tables_with_description_column.each do |table|
+      if table != 'collections'
+        change_column table.to_sym, :description, :text
+      end
+    end
+  end
+end
diff --git a/services/api/db/migrate/20141208185217_search_index.rb b/services/api/db/migrate/20141208185217_search_index.rb
index 639bdc2..f11a37c 100644
--- a/services/api/db/migrate/20141208185217_search_index.rb
+++ b/services/api/db/migrate/20141208185217_search_index.rb
@@ -5,17 +5,17 @@ class SearchIndex < ActiveRecord::Migration
       "api_clients" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "name", "url_prefix"],
       "authorized_keys" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "name", "key_type", "authorized_user_uuid"],
       "collections" => ["owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "portable_data_hash", "redundancy_confirmed_by_client_uuid", "uuid", "name", "description"],
-      "groups" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "name", "group_class"],
+      "groups" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "name", "description", "group_class"],
       "humans" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid"],
       "job_tasks" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "job_uuid", "created_by_job_task_uuid"],
-      "jobs" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "submit_id", "script", "script_version", "cancelled_by_client_uuid", "cancelled_by_user_uuid", "output", "is_locked_by_uuid", "log", "repository", "supplied_script_version", "docker_image_locator", "state", "arvados_sdk_version"],
+      "jobs" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "submit_id", "script", "script_version", "cancelled_by_client_uuid", "cancelled_by_user_uuid", "output", "is_locked_by_uuid", "log", "repository", "supplied_script_version", "docker_image_locator", "description", "state", "arvados_sdk_version"],
       "keep_disks" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "ping_secret", "node_uuid", "filesystem_uuid", "keep_service_uuid"],
       "keep_services" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "service_host", "service_type"],
       "links" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "tail_uuid", "link_class", "name", "head_uuid"],
       "logs" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "object_uuid", "event_type", "object_owner_uuid"],
       "nodes" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "hostname", "domain", "ip_address", "job_uuid"],
-      "pipeline_instances" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "pipeline_template_uuid", "name", "state"],
-      "pipeline_templates" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "name"],
+      "pipeline_instances" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "pipeline_template_uuid", "name", "state", "description"],
+      "pipeline_templates" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "name", "description"],
       "repositories" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "name", "fetch_url", "push_url"],
       "specimens" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "material"],
       "traits" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "name"],
diff --git a/services/api/db/structure.sql b/services/api/db/structure.sql
index f50f907..6f2971f 100644
--- a/services/api/db/structure.sql
+++ b/services/api/db/structure.sql
@@ -167,7 +167,7 @@ CREATE TABLE collections (
     uuid character varying(255),
     manifest_text text,
     name character varying(255),
-    description character varying(255),
+    description character varying(10000),
     properties text,
     expires_at date
 );
@@ -272,7 +272,7 @@ CREATE TABLE groups (
     modified_by_user_uuid character varying(255),
     modified_at timestamp without time zone,
     name character varying(255) NOT NULL,
-    description text,
+    description character varying(10000),
     updated_at timestamp without time zone NOT NULL,
     group_class character varying(255)
 );
@@ -431,7 +431,7 @@ CREATE TABLE jobs (
     supplied_script_version character varying(255),
     docker_image_locator character varying(255),
     priority integer DEFAULT 0 NOT NULL,
-    description text,
+    description character varying(10000),
     state character varying(255),
     arvados_sdk_version character varying(255)
 );
@@ -685,7 +685,7 @@ CREATE TABLE pipeline_instances (
     properties text,
     state character varying(255),
     components_summary text,
-    description text,
+    description character varying(10000),
     started_at timestamp without time zone,
     finished_at timestamp without time zone
 );
@@ -725,7 +725,7 @@ CREATE TABLE pipeline_templates (
     name character varying(255),
     components text,
     updated_at timestamp without time zone NOT NULL,
-    description text
+    description character varying(10000)
 );
 
 
@@ -1324,7 +1324,7 @@ CREATE UNIQUE INDEX groups_owner_uuid_name_unique ON groups USING btree (owner_u
 -- Name: groups_search_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
 --
 
-CREATE INDEX groups_search_index ON groups USING btree (uuid, owner_uuid, modified_by_client_uuid, modified_by_user_uuid, name, group_class);
+CREATE INDEX groups_search_index ON groups USING btree (uuid, owner_uuid, modified_by_client_uuid, modified_by_user_uuid, name, description, group_class);
 
 
 --
@@ -1989,7 +1989,7 @@ CREATE INDEX job_tasks_search_index ON job_tasks USING btree (uuid, owner_uuid,
 -- Name: jobs_search_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
 --
 
-CREATE INDEX jobs_search_index ON jobs USING btree (uuid, owner_uuid, modified_by_client_uuid, modified_by_user_uuid, submit_id, script, script_version, cancelled_by_client_uuid, cancelled_by_user_uuid, output, is_locked_by_uuid, log, repository, supplied_script_version, docker_image_locator, state, arvados_sdk_version);
+CREATE INDEX jobs_search_index ON jobs USING btree (uuid, owner_uuid, modified_by_client_uuid, modified_by_user_uuid, submit_id, script, script_version, cancelled_by_client_uuid, cancelled_by_user_uuid, output, is_locked_by_uuid, log, repository, supplied_script_version, docker_image_locator, description, state, arvados_sdk_version);
 
 
 --
@@ -2038,7 +2038,7 @@ CREATE INDEX nodes_search_index ON nodes USING btree (uuid, owner_uuid, modified
 -- Name: pipeline_instances_search_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
 --
 
-CREATE INDEX pipeline_instances_search_index ON pipeline_instances USING btree (uuid, owner_uuid, modified_by_client_uuid, modified_by_user_uuid, pipeline_template_uuid, name, state);
+CREATE INDEX pipeline_instances_search_index ON pipeline_instances USING btree (uuid, owner_uuid, modified_by_client_uuid, modified_by_user_uuid, pipeline_template_uuid, name, state, description);
 
 
 --
@@ -2052,7 +2052,7 @@ CREATE UNIQUE INDEX pipeline_template_owner_uuid_name_unique ON pipeline_templat
 -- Name: pipeline_templates_search_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
 --
 
-CREATE INDEX pipeline_templates_search_index ON pipeline_templates USING btree (uuid, owner_uuid, modified_by_client_uuid, modified_by_user_uuid, name);
+CREATE INDEX pipeline_templates_search_index ON pipeline_templates USING btree (uuid, owner_uuid, modified_by_client_uuid, modified_by_user_uuid, name, description);
 
 
 --
@@ -2309,4 +2309,6 @@ INSERT INTO schema_migrations (version) VALUES ('20141111133038');
 
 INSERT INTO schema_migrations (version) VALUES ('20141208164553');
 
+INSERT INTO schema_migrations (version) VALUES ('20141208174553');
+
 INSERT INTO schema_migrations (version) VALUES ('20141208185217');
\ No newline at end of file
diff --git a/services/api/test/unit/arvados_model_test.rb b/services/api/test/unit/arvados_model_test.rb
index ca9198f..b353793 100644
--- a/services/api/test/unit/arvados_model_test.rb
+++ b/services/api/test/unit/arvados_model_test.rb
@@ -137,10 +137,13 @@ class ArvadosModelTest < ActiveSupport::TestCase
         search_index_columns = table_class.searchable_columns('ilike')
 
         indexes = ActiveRecord::Base.connection.indexes(table)
-        search_index = indexes.select do |index|
+        search_index_by_columns = indexes.select do |index|
           index.columns == search_index_columns
         end
-        assert !search_index.empty?, "#{table} does not have search index with all searchable columns #{search_index_columns}"
+        search_index_by_name = indexes.select do |index|
+          index.name == "#{table}_search_index"
+        end
+        assert !search_index_by_columns.empty?, "#{table} has no search index with columns #{search_index_columns}. Instead found search index with columns #{search_index_by_name.first.andand.columns}"
       end
     end
   end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list