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

migration: 25 -> 26: Fix is_network flag for external files

Fix #253
parent ff0c0152
Pipeline #17275 passed with stage
in 14 minutes and 56 seconds
......@@ -105,3 +105,9 @@ MediaGroup::index( MediaGroup::Indexes::LastModificationDate, 26 ),
" AND file_type = " +
std::to_string( static_cast<std::underlying_type_t<IFile::Type>>(
IFile::Type::Unknown ) ),
/*
* Fix external files is_network state
*/
"UPDATE " + File::Table::Name + " SET is_network = 1"
" WHERE is_external = 1 AND substr(mrl, 0, 7) != 'file://'",
......@@ -687,4 +687,12 @@ TEST_F( DbModel, Upgrade25to26 )
auto encodedFile = File::fetch( ml.get(), 6 );
ASSERT_NE( nullptr, encodedFile );
ASSERT_EQ( "udp://@224.10.50.36:5004", encodedFile->mrl() );
ASSERT_TRUE( encodedFile->isNetwork() );
const std::string req = "SELECT * FROM " + File::Table::Name +
" WHERE is_network = 1";
auto networkFiles = File::fetchAll<File>( ml.get(), req );
ASSERT_EQ( 1u, networkFiles.size() );
ASSERT_EQ( networkFiles[0]->id(), encodedFile->id() );
}
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