Merge lp:~jimbox-comcast/mvhub/remove_additional_seq into lp:~mvhub-commit/mvhub/trunk

Proposed by James Reynolds Jr.
Status: Merged
Merged at revision: 449
Proposed branch: lp:~jimbox-comcast/mvhub/remove_additional_seq
Merge into: lp:~mvhub-commit/mvhub/trunk
Diff against target: 81 lines (+9/-24)
3 files modified
app-mvhub/setup/database/sql/005_synonym_cat_functions.sql (+0/-24)
app-mvhub/setup/database/sql/010_remove_more_unused_seq.sql (+8/-0)
lib-mvhub/lib/MVHub/Synonyms.pm (+1/-0)
To merge this branch: bzr merge lp:~jimbox-comcast/mvhub/remove_additional_seq
Reviewer Review Type Date Requested Status
Dan MacNeil Pending
Review via email: mp+29730@code.launchpad.net

This proposal supersedes a proposal from 2010-07-09.

Description of the change

Adds a script to drop two vestigial sequences from the database.

To post a comment you must log in.
Revision history for this message
Dan MacNeil (omacneil) wrote : Posted in a previous version of this proposal

The old version of 004_remove_unused_tables_and_seq.sql (now in trunk)

...did some stuff and set version_log.version =4

The new version does **more** stuff, but under many circumstances this will never be called.

If a version_log.version == 4, 004_remove_unused_tables_seq.sql won't be run.

You need to put the new stuff in 006_remove_more_unused_seq.sql

In app-mvhub/project-tools/bin/mv_update_development the database is DROPped , new data is loaded and all the schema updating scripts in app-mvhub/setup/database/sql are run.

In production, we don't care to wipe old data, so only the new, unrun sql scripts are run.

Make fix & push branch

review: Needs Fixing
Revision history for this message
James Reynolds Jr. (jimbox-comcast) wrote : Posted in a previous version of this proposal

I reverted to revision 412 and created 006_remove_more_unused_seq.sql as requested.

Revision history for this message
Dan MacNeil (omacneil) wrote : Posted in a previous version of this proposal

There are conflict markers in the diff against trunk for this merge request.

Those should be resolved.

Merging trunk into the the branch and resolve conflicts before pushing branch again

SYNONYM_STEM_X_CONCAT_SUBMITTED_WORDS should not be removed. Once you merge trunk and priya's schema updates, the test will pass for this.

Revision history for this message
Dan MacNeil (omacneil) wrote : Posted in a previous version of this proposal

null op to change merge status

review: Needs Fixing
Revision history for this message
Saroun Sek (saroun-sek) wrote : Posted in a previous version of this proposal

> There are conflict markers in the diff against trunk for this merge request.
>
> Those should be resolved.
>
>
> Merging trunk into the the branch and resolve conflicts before pushing branch
> again
>
>
> SYNONYM_STEM_X_CONCAT_SUBMITTED_WORDS should not be removed. Once you merge
> trunk and priya's schema updates, the test will pass for this.

SYNONYM_STEM_X_CONCAT_SUBMITTED_WORDS gets a conflict with my branch. I chose SYNONYM_STEM_X_SUBMITTED_WORDS as the name, which caused a conflict. I don't think he'll need to add it back in since when he merges with mine, it will give a conflict both ways.

Revision history for this message
Dan MacNeil (omacneil) wrote : Posted in a previous version of this proposal

Sadly, 006 while was a valid schemea version number when the comment was written, it iis no longer a valid number as we now have 007,008

See:

  Executing 005_synonym_cat_functions.sql...SUCCESS
  Executing 007_alter_tables_and_remove_old.sql...SUCCESS
  Executing 008_drop_zip_distance_table.sql...SUCCESS
  Executing 009_drop_get_agency_name.sql...SUCCESS

So your script will never be called on the production database as the production database is at verison 007

The scheama updating script only runs scripts with a lower number than the version number in the database.

review: Needs Fixing
Revision history for this message
Dan MacNeil (omacneil) wrote : Posted in a previous version of this proposal

@Saroun

I may not be completely undertanding you, but as a rule, conflicts should be fixed in the branch before merging back to trunk.

Revision history for this message
James Reynolds Jr. (jimbox-comcast) wrote :

The script now runs when the version value is 10.

Revision history for this message
Dan MacNeil (omacneil) wrote : Posted in a previous version of this proposal

looks good approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'app-mvhub/setup/database/sql/005_synonym_cat_functions.sql'
2--- app-mvhub/setup/database/sql/005_synonym_cat_functions.sql 1970-01-01 00:00:00 +0000
3+++ app-mvhub/setup/database/sql/005_synonym_cat_functions.sql 2010-07-12 17:43:42 +0000
4@@ -0,0 +1,24 @@
5+BEGIN;
6+INSERT INTO version_log (version, note )
7+ VALUES (5,'adding two functions to return concatenated synonyms');
8+
9+/* Returns the concatenation of its 2 arguments, separated by a comma and a space. */
10+CREATE OR REPLACE FUNCTION our_concat(text, text) RETURNS text AS
11+$$
12+ SELECT $1 || ', ' || $2;
13+ $$ LANGUAGE sql
14+ STABLE
15+ RETURNS NULL ON NULL INPUT;
16+
17+
18+/* Returns a concatenation of all of the values in a grouped column,
19+ delimited by a comma and a space.
20+*/
21+DROP AGGREGATE IF EXISTS our_aggregate_concat(text);
22+
23+CREATE AGGREGATE our_aggregate_concat (
24+ sfunc = our_concat,
25+ basetype = text,
26+ stype = text
27+);
28+COMMIT;
29
30=== removed file 'app-mvhub/setup/database/sql/005_synonym_cat_functions.sql'
31--- app-mvhub/setup/database/sql/005_synonym_cat_functions.sql 2010-06-18 19:40:06 +0000
32+++ app-mvhub/setup/database/sql/005_synonym_cat_functions.sql 1970-01-01 00:00:00 +0000
33@@ -1,24 +0,0 @@
34-BEGIN;
35-INSERT INTO version_log (version, note )
36- VALUES (5,'adding two functions to return concatenated synonyms');
37-
38-/* Returns the concatenation of its 2 arguments, separated by a comma and a space. */
39-CREATE OR REPLACE FUNCTION our_concat(text, text) RETURNS text AS
40-$$
41- SELECT $1 || ', ' || $2;
42- $$ LANGUAGE sql
43- STABLE
44- RETURNS NULL ON NULL INPUT;
45-
46-
47-/* Returns a concatenation of all of the values in a grouped column,
48- delimited by a comma and a space.
49-*/
50-DROP AGGREGATE IF EXISTS our_aggregate_concat(text);
51-
52-CREATE AGGREGATE our_aggregate_concat (
53- sfunc = our_concat,
54- basetype = text,
55- stype = text
56-);
57-COMMIT;
58
59=== added file 'app-mvhub/setup/database/sql/010_remove_more_unused_seq.sql'
60--- app-mvhub/setup/database/sql/010_remove_more_unused_seq.sql 1970-01-01 00:00:00 +0000
61+++ app-mvhub/setup/database/sql/010_remove_more_unused_seq.sql 2010-07-12 17:43:42 +0000
62@@ -0,0 +1,8 @@
63+BEGIN;
64+
65+INSERT INTO version_log ( version,note )
66+ VALUES (10,'Removes one unused seq');
67+
68+DROP SEQUENCE user_id_sequence;
69+
70+COMMIT;
71
72=== modified file 'lib-mvhub/lib/MVHub/Synonyms.pm'
73--- lib-mvhub/lib/MVHub/Synonyms.pm 2010-06-29 19:21:04 +0000
74+++ lib-mvhub/lib/MVHub/Synonyms.pm 2010-07-12 17:43:42 +0000
75@@ -37,6 +37,7 @@
76 # one word synonyms of each other.
77 sub fetch_synonyms_from_db {
78 my $dbh = MVHub::Utils::DB::get_dbh();
79+
80 my $sql = MVHub::Utils::DB::get_sql_select_statement(
81 'SYNONYM_STEM_X_SUBMITTED_WORDS');
82

Subscribers

People subscribed via source and target branches