瀏覽代碼

clear video and channels on runtime upgrade

Mokhtar Naamani 3 年之前
父節點
當前提交
be6ee56293
共有 1 個文件被更改,包括 5 次插入12 次删除
  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();
     }
 }