0003_auto_20160303_1057.py 635 B

1234567891011121314151617181920
  1. # -*- coding: utf-8 -*-
  2. # Generated by Django 1.9.3 on 2016-03-03 10:57
  3. from __future__ import unicode_literals
  4. from django.db import migrations
  5. class Migration(migrations.Migration):
  6. """Empty floatfield are stored as empty string by sqlite. But Django hates
  7. that and refuse to handle it properly until they are stored as NULL."""
  8. dependencies = [
  9. ('contribmap', '0001_initial'),
  10. ]
  11. float_cols = ['bandwidth', 'share_part', 'floor', 'floor_total']
  12. operations = [
  13. migrations.RunSQL(
  14. "UPDATE contribs SET {col}=NULL WHERE {col}='';".format(col=i))
  15. for i in float_cols
  16. ]