text: # Generated by Django 3.0.4 on 2020-04-02 20:47
  
  import uuid
  
  from django.db import migrations, models
  import django.db.models.deletion
  
  
  class Migration(migrations.Migration):
  
      dependencies = [("core", "0015_auto_20190904_1234")]
  
      operations = [
          migrations.AlterField(
              model_name="consumersite",
              name="portable_to",
              field=models.ManyToManyField(
                  blank=True,
                  help_text=(
                      "consumer sites to which all resources in this consumer site are portable."
                  ),
                  related_name="reachable_from",
                  through="core.ConsumerSitePortability",
                  to="core.ConsumerSite",
                  verbose_name="portable to",
              ),
          ),
          migrations.AlterField(
              model_name="playlist",
              name="is_portable_to_consumer_site",
              field=models.BooleanField(
                  default=False,
                  help_text=(
                      "Are all resources in this playlist portable to any playlist in other "
                      "consumer sites"
                  ),
              ),
          ),
          migrations.AlterField(
              model_name="playlist",
              name="is_portable_to_playlist",
              field=models.BooleanField(
                  default=True,
                  help_text=(
                      "Are all resources in this playlist portable to any playlist in this "
                      "consumer site"
                  ),
              ),
          ),
          migrations.CreateModel(
              name="PlaylistPortability",
              fields=[
                  ("deleted", models.DateTimeField(editable=False, null=True)),
                  (
                      "id",
                      models.UUIDField(
                          default=uuid.uuid4,
                          editable=False,
                          help_text="primary key for the record as UUID",
                          primary_key=True,
                          serialize=False,
                          verbose_name="id",
                      ),
                  ),
                  (
                      "created_on",
                      models.DateTimeField(
                          auto_now_add=True,
                          help_text="date and time at which a record was created",
                          verbose_name="created on",
                      ),
                  ),
                  (
                      "updated_on",
                      models.DateTimeField(
                          auto_now=True,
                          help_text="date and time at which a record was last updated",
                          verbose_name="updated on",
                      ),
                  ),
                  (
                      "source_playlist",
                      models.ForeignKey(
                          help_text="playlist that is portable.",
                          on_delete=django.db.models.deletion.CASCADE,
                          related_name="portable_to_links",
                          to="core.Playlist",
                          verbose_name="source playlist",
                      ),
                  ),
                  (
                      "target_playlist",
                      models.ForeignKey(
                          help_text="playlist to which portability is automatic.",
                          on_delete=django.db.models.deletion.CASCADE,
                          related_name="reachable_from_links",
                          to="core.Playlist",
                          verbose_name="target playlist",
                      ),
                  ),
              ],
              options={
                  "verbose_name": "playlist portability",
                  "verbose_name_plural": "playlist portabilities",
                  "db_table": "Playlist_portability",
              },
          ),
          migrations.AddField(
              model_name="playlist",
              name="portable_to",
              field=models.ManyToManyField(
                  blank=True,
                  help_text="Playlists to which the resources in this playlist are portable.",
                  related_name="reachable_from",
                  through="core.PlaylistPortability",
                  to="core.Playlist",
                  verbose_name="portable to playlists",
              ),
          ),
          migrations.AddConstraint(
              model_name="playlistportability",
              constraint=models.UniqueConstraint(
                  condition=models.Q(deleted=None),
                  fields=("source_playlist", "target_playlist"),
                  name="playlist_portability_unique_idx",
              ),
          ),
      ]
  