Module shortner.migrations.0001_initial

Expand source code
# Generated by Django 3.2.1 on 2022-10-03 15:41

from django.db import migrations, models
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Link",
            fields=[
                ("long_url", models.CharField(max_length=2083)),
                (
                    "special_code",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("stub", models.CharField(max_length=10, unique=True)),
            ],
        ),
    ]

Classes

class Migration (name, app_label)

The base class for all migrations.

Migration files will import this from django.db.migrations.Migration and subclass it as a class called Migration. It will have one or more of the following attributes:

  • operations: A list of Operation instances, probably from django.db.migrations.operations
  • dependencies: A list of tuples of (app_path, migration_name)
  • run_before: A list of tuples of (app_path, migration_name)
  • replaces: A list of migration_names

Note that all migrations come out of migrations and into the Loader or Graph as instances, having been initialized with their app label and name.

Expand source code
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Link",
            fields=[
                ("long_url", models.CharField(max_length=2083)),
                (
                    "special_code",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("stub", models.CharField(max_length=10, unique=True)),
            ],
        ),
    ]

Ancestors

  • django.db.migrations.migration.Migration

Class variables

var dependencies
var initial
var operations