From 2be46b3320dc0b54d4f5025ea38f9c3be7c0d0ca Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Thu, 19 Apr 2018 22:25:58 +0200
Subject: [PATCH] Fix #142: Increased max_length on TrackFile.source

---
 .../migrations/0025_auto_20180419_2023.py      | 18 ++++++++++++++++++
 api/funkwhale_api/music/models.py              |  2 +-
 changes/changelog.d/142.enhancement            |  1 +
 3 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 api/funkwhale_api/music/migrations/0025_auto_20180419_2023.py
 create mode 100644 changes/changelog.d/142.enhancement

diff --git a/api/funkwhale_api/music/migrations/0025_auto_20180419_2023.py b/api/funkwhale_api/music/migrations/0025_auto_20180419_2023.py
new file mode 100644
index 00000000..6b0230d5
--- /dev/null
+++ b/api/funkwhale_api/music/migrations/0025_auto_20180419_2023.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.0.3 on 2018-04-19 20:23
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('music', '0024_populate_uuid'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='trackfile',
+            name='source',
+            field=models.URLField(blank=True, max_length=500, null=True),
+        ),
+    ]
diff --git a/api/funkwhale_api/music/models.py b/api/funkwhale_api/music/models.py
index 4ec3ff42..cc3849d5 100644
--- a/api/funkwhale_api/music/models.py
+++ b/api/funkwhale_api/music/models.py
@@ -412,7 +412,7 @@ class TrackFile(models.Model):
     track = models.ForeignKey(
         Track, related_name='files', on_delete=models.CASCADE)
     audio_file = models.FileField(upload_to='tracks/%Y/%m/%d', max_length=255)
-    source = models.URLField(null=True, blank=True)
+    source = models.URLField(null=True, blank=True, max_length=500)
     creation_date = models.DateTimeField(default=timezone.now)
     modification_date = models.DateTimeField(auto_now=True)
     duration = models.IntegerField(null=True, blank=True)
diff --git a/changes/changelog.d/142.enhancement b/changes/changelog.d/142.enhancement
new file mode 100644
index 00000000..9784f540
--- /dev/null
+++ b/changes/changelog.d/142.enhancement
@@ -0,0 +1 @@
+Increased max_length on TrackFile.source, this will help when importing files with a really long path (#142)
-- 
GitLab