Commit f462cc04 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

MediaGroup: Rename UpdateNbMedia trigger

To explicitely mention that it targets per-type media count
refs #251
parent a9a9c3cb
......@@ -415,7 +415,7 @@ void MediaGroup::createTriggers( sqlite::Connection* connection )
sqlite::Tools::executeRequest( connection,
trigger( Triggers::DeleteFts, Settings::DbModelVersion ) );
sqlite::Tools::executeRequest( connection,
trigger( Triggers::UpdateNbMedia, Settings::DbModelVersion ) );
trigger( Triggers::UpdateNbMediaPerType, Settings::DbModelVersion ) );
sqlite::Tools::executeRequest( connection,
trigger( Triggers::DecrementNbMediaOnDeletion, Settings::DbModelVersion ) );
sqlite::Tools::executeRequest( connection,
......@@ -573,7 +573,7 @@ std::string MediaGroup::trigger( MediaGroup::Triggers t, uint32_t dbModel )
" WHERE id_group = old.group_id;"
" END";
}
case Triggers::UpdateNbMedia:
case Triggers::UpdateNbMediaPerType:
{
assert( dbModel >= 26 );
return "CREATE TRIGGER " + triggerName( t, dbModel ) +
......@@ -720,9 +720,9 @@ std::string MediaGroup::triggerName(MediaGroup::Triggers t, uint32_t dbModel)
case Triggers::UpdateDurationOnMediaDeletion:
assert( dbModel >= 25 );
return "media_group_update_duration_on_media_deletion";
case Triggers::UpdateNbMedia:
case Triggers::UpdateNbMediaPerType:
assert( dbModel >= 26 );
return "media_group_update_nb_media";
return "media_group_update_nb_media_types";
default:
assert( !"Invalid trigger" );
}
......@@ -803,7 +803,7 @@ bool MediaGroup::checkDbModel( MediaLibraryPtr ml )
return check( ml->getConn(), Triggers::InsertFts ) &&
check( ml->getConn(), Triggers::DeleteFts ) &&
check( ml->getConn(), Triggers::UpdateNbMedia ) &&
check( ml->getConn(), Triggers::UpdateNbMediaPerType ) &&
check( ml->getConn(), Triggers::DecrementNbMediaOnDeletion ) &&
check( ml->getConn(), Triggers::DeleteEmptyGroups ) &&
check( ml->getConn(), Triggers::RenameForcedSingleton ) &&
......
......@@ -55,7 +55,7 @@ public:
RenameForcedSingleton,
UpdateDurationOnMediaChange,
UpdateDurationOnMediaDeletion,
UpdateNbMedia,
UpdateNbMediaPerType,
};
enum class Indexes : uint8_t
{
......
......@@ -63,7 +63,7 @@ MediaGroup::schema( MediaGroup::Table::Name, 26 ),
/* Update MediaGroup triggers */
"DROP TRIGGER " + MediaGroup::triggerName( MediaGroup::Triggers::IncrementNbMediaOnGroupChange, 25 ),
"DROP TRIGGER " + MediaGroup::triggerName( MediaGroup::Triggers::DecrementNbMediaOnGroupChange, 25 ),
MediaGroup::trigger( MediaGroup::Triggers::UpdateNbMedia, 26 ),
MediaGroup::trigger( MediaGroup::Triggers::UpdateNbMediaPerType, 26 ),
/* Recreate MediaGroup indexes & triggers that were deleted during the migration */
MediaGroup::trigger( MediaGroup::Triggers::InsertFts, 26 ),
......
......@@ -74,7 +74,7 @@ namespace
"media_group_rename_forced_singleton",
"media_group_update_duration_on_media_change",
"media_group_update_duration_on_media_deletion",
"media_group_update_nb_media",
"media_group_update_nb_media_types",
"media_update_device_presence",
"show_decrement_nb_episode",
"show_increment_nb_episode",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment