new_contents: # -*- coding: utf-8 -*-
  # Generated by Django 1.10.5 on 2017-04-02 13:10
  from __future__ import unicode_literals
  
  from django.db import migrations, models
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('WEIPDCRM', '0025_auto_20180404_1515'),
      ]
  
      operations = [
          migrations.RunSQL(
              "DROP VIEW `package_view`;"
          ),
          migrations.RunSQL(
              "CREATE VIEW `package_view` AS SELECT `id`, `c_name`, `created_at`, `c_package`, `c_version`, `c_section_id`, `enabled`, `online_icon`, SUM(`download_times`) AS `download_count` FROM (SELECT * FROM `WEIPDCRM_version` WHERE `enabled` = TRUE) AS T WHERE `id` IN (SELECT MAX(`id`) FROM `WEIPDCRM_version` GROUP BY `c_package`) ORDER BY `c_package` DESC;"
          ),
      ]
  
subject: Update SQL for package_view