From 0839b9c96c8f1a2e79d84f90191d313aca3283be Mon Sep 17 00:00:00 2001 From: FeliPython Date: Sun, 21 Apr 2024 19:07:58 -0300 Subject: [PATCH] Commit message: Add initial Django migrations for music app This commit introduces the initial Django migrations for the music application. It creates the models for Artist, Album, and Song, with the necessary fields and dependencies. This lays the foundation for the music database schema and facilitates further data operations. --- first_api/music/migrations/0001_initial.py | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 first_api/music/migrations/0001_initial.py diff --git a/first_api/music/migrations/0001_initial.py b/first_api/music/migrations/0001_initial.py new file mode 100644 index 0000000..936ae86 --- /dev/null +++ b/first_api/music/migrations/0001_initial.py @@ -0,0 +1,80 @@ +# Generated by Django 5.0.3 on 2024-04-21 21:58 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [] + + operations = [ + migrations.CreateModel( + name="Artist", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=100)), + ], + ), + migrations.CreateModel( + name="Album", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("title", models.CharField(max_length=100)), + ("release_year", models.IntegerField()), + ( + "artist", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="music.artist" + ), + ), + ], + ), + migrations.CreateModel( + name="Song", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("author", models.CharField(max_length=100)), + ("title", models.CharField(max_length=100)), + ("duration", models.IntegerField()), + ( + "album", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="music.album" + ), + ), + ( + "artist", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="music.artist" + ), + ), + ], + ), + ]