@@ -37,12 +37,13 @@ DO $$
37
37
c .data # > array['tables', 'users', 'name'] ? 'cast_as'));
38
38
39
39
-- Match index removed
40
- PERFORM eql_v2 .remove_search_config (' users' , ' name' , ' match' );
40
+ PERFORM eql_v2 .remove_search_config (' users' , ' name' , ' match' , migrating => true );
41
41
ASSERT NOT (SELECT _search_config_exists(' users' , ' name' , ' match' ));
42
42
43
- -- All indexes removed, delete the emtpty pending config
44
- PERFORM eql_v2 .remove_search_config (' users' , ' name' , ' unique' );
45
- ASSERT (SELECT NOT EXISTS (SELECT FROM eql_v2_configuration c WHERE c .state = ' pending' ));
43
+ -- All indexes removed, but column config preserved
44
+ PERFORM eql_v2 .remove_search_config (' users' , ' name' , ' unique' , migrating => true);
45
+ ASSERT (SELECT EXISTS (SELECT FROM eql_v2_configuration c WHERE c .state = ' pending' ));
46
+ ASSERT (SELECT data # > array['tables', 'users', 'name', 'indexes'] = '{}' FROM eql_v2_configuration c WHERE c.state = 'pending');
46
47
47
48
END;
48
49
$$ LANGUAGE plpgsql;
@@ -82,15 +83,16 @@ DO $$
82
83
83
84
84
85
-- Match index removed
85
- PERFORM eql_v2 .remove_search_config (' users' , ' name' , ' match' );
86
+ PERFORM eql_v2 .remove_search_config (' users' , ' name' , ' match' , migrating => true );
86
87
ASSERT NOT (SELECT _search_config_exists(' users' , ' name' , ' match' ));
87
88
88
89
-- Match index removed
89
- PERFORM eql_v2 .remove_search_config (' blah' , ' vtha' , ' unique' );
90
+ PERFORM eql_v2 .remove_search_config (' blah' , ' vtha' , ' unique' , migrating => true );
90
91
ASSERT NOT (SELECT _search_config_exists(' users' , ' vtha' , ' unique' ));
91
92
92
- -- All indexes removed, delete the emtpty pending config
93
- ASSERT (SELECT NOT EXISTS (SELECT FROM eql_v2_configuration c WHERE c .state = ' pending' ));
93
+ -- All indexes removed, but column config preserved
94
+ ASSERT (SELECT EXISTS (SELECT FROM eql_v2_configuration c WHERE c .state = ' pending' ));
95
+ ASSERT (SELECT data # > array['tables', 'blah', 'vtha', 'indexes'] = '{}' FROM eql_v2_configuration c WHERE c.state = 'pending');
94
96
95
97
END;
96
98
$$ LANGUAGE plpgsql;
@@ -122,9 +124,10 @@ DO $$
122
124
WHERE c .state = ' pending' AND
123
125
c .data # > array['tables', 'users', 'name'] ? 'cast_as'));
124
126
125
- -- All indexes removed, delete the emtpty pending config
126
- PERFORM eql_v2 .remove_search_config (' users' , ' name' , ' match' );
127
- ASSERT (SELECT NOT EXISTS (SELECT FROM eql_v2_configuration c WHERE c .state = ' pending' ));
127
+ -- All indexes removed, but column config preserved
128
+ PERFORM eql_v2 .remove_search_config (' users' , ' name' , ' match' , migrating => true);
129
+ ASSERT (SELECT EXISTS (SELECT FROM eql_v2_configuration c WHERE c .state = ' pending' ));
130
+ ASSERT (SELECT data # > array['tables', 'users', 'name', 'indexes'] = '{}' FROM eql_v2_configuration c WHERE c.state = 'pending');
128
131
END;
129
132
$$ LANGUAGE plpgsql;
130
133
0 commit comments