Explorar el Código

clear video and channels on runtime upgrade

Mokhtar Naamani hace 3 años
padre
commit
be6ee56293
Se han modificado 1 ficheros con 5 adiciones y 12 borrados
  1. 5 12
      runtime-modules/content/src/lib.rs

+ 5 - 12
runtime-modules/content/src/lib.rs

@@ -1409,21 +1409,14 @@ impl<T: Trait> Module<T> {
     }
 }
 
-// Some initial config for the module on runtime upgrade
+// Giza:
+// Reset Videos and Channels on runtime upgrade but preserving next ids and categories.
 impl<T: Trait> Module<T> {
     pub fn on_runtime_upgrade() {
-        // all ids start at 1
-        <NextChannelCategoryId<T>>::put(T::ChannelCategoryId::one());
-        <NextVideoCategoryId<T>>::put(T::VideoCategoryId::one());
-        <NextVideoId<T>>::put(T::VideoId::one());
-        <NextChannelId<T>>::put(T::ChannelId::one());
-        <NextPlaylistId<T>>::put(T::PlaylistId::one());
-        <NextSeriesId<T>>::put(T::SeriesId::one());
-        <NextPersonId<T>>::put(T::PersonId::one());
-        <NextChannelOwnershipTransferRequestId<T>>::put(T::ChannelOwnershipTransferRequestId::one());
-
-        // VideoById map is cleared
+        // Clear VideoById map
         <VideoById<T>>::remove_all();
+        // Clear ChannelById map
+        <ChannelById<T>>::remove_all();
     }
 }