SAAS-923 - 2.5.14 schema upgrade to add partial unique index on cc_pref's keystr column (when subjid is null)
This commit is contained in:
parent
999f03ea1e
commit
5cb396e512
5 changed files with 34 additions and 2 deletions
|
@ -24,7 +24,8 @@ define('LICENSE_URL' , 'http://www.gnu.org/licenses/agpl-3.0-standalone.h
|
|||
define('AIRTIME_COPYRIGHT_DATE' , '2010-2015');
|
||||
define('AIRTIME_REST_VERSION' , '1.1');
|
||||
define('AIRTIME_API_VERSION' , '1.1');
|
||||
define('AIRTIME_CODE_VERSION' , '2.5.13');
|
||||
// XXX: it's important that we upgrade this every time we add an upgrade!
|
||||
define('AIRTIME_CODE_VERSION' , '2.5.14');
|
||||
|
||||
// Defaults
|
||||
define('DEFAULT_LOGO_PLACEHOLDER', 1);
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
ALTER TABLE cc_pref ALTER COLUMN subjid SET NULL;
|
||||
ALTER TABLE cc_pref ALTER COLUMN subjid SET DEFAULT NULL;
|
||||
CREATE UNIQUE INDEX cc_pref_key_idx ON cc_pref (keystr) WHERE subjid IS NULL;
|
||||
ANALYZE cc_pref;
|
|
@ -31,7 +31,8 @@ class Application_Model_Preference
|
|||
$con->beginTransaction();
|
||||
|
||||
try {
|
||||
static::_lock($con);
|
||||
/* Comment this out while we reevaluate it in favor of a unique constraint
|
||||
static::_lock($con); */
|
||||
$userId = self::getUserId();
|
||||
|
||||
if ($isUserValue && is_null($userId)) {
|
||||
|
|
|
@ -455,3 +455,21 @@ class AirtimeUpgrader2513 extends AirtimeUpgrader
|
|||
return '2.5.13';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class AirtimeUpgrader2514
|
||||
*
|
||||
* SAAS-923 - Add a partial constraint to cc_pref so that keystrings must be unique
|
||||
*/
|
||||
class AirtimeUpgrader2514 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions() {
|
||||
return array (
|
||||
'2.5.13'
|
||||
);
|
||||
}
|
||||
|
||||
public function getNewVersion() {
|
||||
return '2.5.14';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -376,3 +376,11 @@ INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_descripti
|
|||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_genre', '', 'string');
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s4_channels', 'stereo', 'string');
|
||||
|
||||
-- added in 2.5.14 - this can't be set up in Propel's XML schema, so we need to do it here -- Duncan
|
||||
|
||||
ALTER TABLE cc_pref ALTER COLUMN subjid SET NULL;
|
||||
ALTER TABLE cc_pref ALTER COLUMN subjid SET DEFAULT NULL;
|
||||
CREATE UNIQUE INDEX cc_pref_key_idx ON cc_pref (keystr) WHERE subjid IS NULL;
|
||||
ANALYZE cc_pref; -- this validates the new partial index
|
||||
|
||||
--end added in 2.5.14
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue