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

Proposed by James Reynolds Jr.
Status: Superseded
Proposed branch: lp:~jimbox-comcast/mvhub/remove_additional_seq
Merge into: lp:~mvhub-commit/mvhub/trunk
Diff against target: 98 lines (+15/-39)
5 files modified
app-mvhub/conf/sql_select.lib (+0/-12)
app-mvhub/setup/database/sql/004_remove_unused_tables_and_seq.sql (+2/-3)
app-mvhub/setup/database/sql/005_synonym_cat_functions.sql (+0/-22)
app-mvhub/setup/database/sql/006_remove_more_unused_seq.sql (+8/-0)
lib-mvhub/lib/MVHub/Synonyms.pm (+5/-2)
To merge this branch: bzr merge lp:~jimbox-comcast/mvhub/remove_additional_seq
Reviewer Review Type Date Requested Status
Dan MacNeil Needs Fixing
Review via email: mp+27878@code.launchpad.net

This proposal has been superseded by a proposal from 2010-06-23.

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 :

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
413. By James Reynolds <email address hidden>

Moved the instruction to remove the two seq synonym_id_sequence and user_id_sequence to 006_~.

414. By James Reynolds <email address hidden>

Merged with trunk to prep for testing before submitting a merge request.

415. By James Reynolds <email address hidden>

Reverted to version 412 then created a new sql script to remove two seq.

416. By James Reynolds <email address hidden>

Prepped files to merge with trunk before pushing to launchpad.

417. By James Reynolds <email address hidden>

Succesfully merged with trunk. Next testing before the merge request.

418. By James Reynolds <email address hidden>

Changed 004 to origional so there are no conflicts and changed 006 to only remove user_id_seq.

419. By James Reynolds <email address hidden>

This branch is now prepared for merging.

420. By James Reynolds <email address hidden>

Modified the old script so it contained the latest version number.

421. By James Reynolds <email address hidden>

Merged branch with trunk before pushing to launchpad.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app-mvhub/conf/sql_select.lib'
2--- app-mvhub/conf/sql_select.lib 2010-06-09 14:25:30 +0000
3+++ app-mvhub/conf/sql_select.lib 2010-06-18 18:31:24 +0000
4@@ -259,18 +259,6 @@
5 WHERE
6 program_id = ?
7
8-[SYNONYM_STEM_X_CONCAT_SUBMITTED_WORDS]
9-SELECT
10- our_aggregate_concat(submitted_word)
11-AS
12- submitted_words
13-FROM
14- synonym_stem
15-GROUP BY
16- synonym_id
17-ORDER BY
18- submitted_words
19-
20 [SYNONYM_STEM_X_WORD_STEM]
21 SELECT DISTINCT
22 word_stem
23
24=== modified file 'app-mvhub/setup/database/sql/004_remove_unused_tables_and_seq.sql'
25--- app-mvhub/setup/database/sql/004_remove_unused_tables_and_seq.sql 2010-06-10 20:15:47 +0000
26+++ app-mvhub/setup/database/sql/004_remove_unused_tables_and_seq.sql 2010-06-18 18:31:24 +0000
27@@ -1,4 +1,3 @@
28---add version number and note before you add the other sql
29 BEGIN;
30
31 INSERT INTO version_log ( version,note )
32@@ -6,6 +5,6 @@
33
34 DROP TABLE user_type, log_category_search, web_requests CASCADE;
35
36-DROP SEQUENCE user_type_type_id_seq, log_category_search_search_id_seq, web_requests_id_seq;
37-
38+DROP SEQUENCE user_type_type_id_seq, log_category_search_search_id_seq, web_requests_id_seq,
39+
40 COMMIT;
41
42=== removed file 'app-mvhub/setup/database/sql/005_synonym_cat_functions.sql'
43--- app-mvhub/setup/database/sql/005_synonym_cat_functions.sql 2010-06-16 16:30:44 +0000
44+++ app-mvhub/setup/database/sql/005_synonym_cat_functions.sql 1970-01-01 00:00:00 +0000
45@@ -1,22 +0,0 @@
46-BEGIN;
47-INSERT INTO version_log (version, note )
48- VALUES (5,'adding two functions to return concatenated
49-synonyms');
50-/* Returns the concatenation of its 2 arguments, separated by a comma and a space. */
51-CREATE OR REPLACE FUNCTION our_concat(text, text) RETURNS text AS
52-$$
53- SELECT $1 || ', ' || $2;
54- $$ LANGUAGE sql
55- STABLE
56- RETURNS NULL ON NULL INPUT;
57-
58-
59-/* Returns a concatenation of all of the values in a grouped column,
60- delimited by a comma and a space.
61-*/
62-CREATE AGGREGATE our_aggregate_concat (
63- sfunc = our_concat,
64- basetype = text,
65- stype = text
66-);
67-COMMIT;
68
69=== added file 'app-mvhub/setup/database/sql/006_remove_more_unused_seq.sql'
70--- app-mvhub/setup/database/sql/006_remove_more_unused_seq.sql 1970-01-01 00:00:00 +0000
71+++ app-mvhub/setup/database/sql/006_remove_more_unused_seq.sql 2010-06-18 18:31:24 +0000
72@@ -0,0 +1,8 @@
73+BEGIN;
74+
75+INSERT INTO version_log ( version,note )
76+ VALUES (6,'Removes two unused seq');
77+
78+DROP SEQUENCE synonym_id_sequence, user_id_sequence;
79+
80+COMMIT;
81
82=== modified file 'lib-mvhub/lib/MVHub/Synonyms.pm'
83--- lib-mvhub/lib/MVHub/Synonyms.pm 2010-06-09 15:43:40 +0000
84+++ lib-mvhub/lib/MVHub/Synonyms.pm 2010-06-18 18:31:24 +0000
85@@ -37,8 +37,11 @@
86 # one word synonyms of each other.
87 sub fetch_synonyms_from_db {
88 my $dbh = MVHub::Utils::DB::get_dbh();
89- my $sql = MVHub::Utils::DB::get_sql_select_statement(
90- 'SYNONYM_STEM_X_CONCAT_SUBMITTED_WORDS');
91+ my $sql
92+ = 'SELECT our_aggregate_concat(submitted_word) AS submitted_words '
93+ . 'FROM synonym_stem '
94+ . 'GROUP BY synonym_id '
95+ . 'ORDER BY submitted_words';
96 my $rows_aref = $dbh->selectcol_arrayref($sql);
97 foreach ( @{$rows_aref} ) {
98 s/,//g;

Subscribers

People subscribed via source and target branches