Skip to content

Commit

Permalink
Add migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
laskarj committed Nov 24, 2023
1 parent 27eea95 commit 135791b
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 0 deletions.
94 changes: 94 additions & 0 deletions cinema/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Generated by Django 4.1 on 2023-11-09 11:55

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
initial = True

dependencies = []

operations = [
migrations.CreateModel(
name="Actor",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("first_name", models.CharField(max_length=150)),
("last_name", models.CharField(max_length=150)),
],
),
migrations.CreateModel(
name="CinemaHall",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=255)),
("rows", models.IntegerField()),
("seat_in_rows", models.IntegerField()),
],
),
migrations.CreateModel(
name="Genre",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name="Movie",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=255)),
("description", models.TextField()),
("duration", models.IntegerField()),
(
"actors",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="actor_movies",
to="cinema.actor",
),
),
(
"genres",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="genre_movies",
to="cinema.genre",
),
),
],
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.1 on 2023-11-09 11:56

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("cinema", "0001_initial"),
]

operations = [
migrations.RenameField(
model_name="cinemahall",
old_name="seat_in_rows",
new_name="seats_in_row",
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 4.1 on 2023-11-09 12:31

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("cinema", "0002_rename_seat_in_rows_cinemahall_seats_in_row"),
]

operations = [
migrations.RemoveField(
model_name="movie",
name="actors",
),
migrations.RemoveField(
model_name="movie",
name="genres",
),
migrations.AddField(
model_name="movie",
name="actors",
field=models.ManyToManyField(
related_name="actor_movies", to="cinema.actor"
),
),
migrations.AddField(
model_name="movie",
name="genres",
field=models.ManyToManyField(
related_name="genre_movies", to="cinema.genre"
),
),
]
29 changes: 29 additions & 0 deletions cinema/migrations/0004_alter_movie_actors_alter_movie_genres.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 4.1 on 2023-11-24 19:12

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
(
"cinema",
"0003_remove_movie_actors_remove_movie_genres_movie_actors_and_more",
),
]

operations = [
migrations.AlterField(
model_name="movie",
name="actors",
field=models.ManyToManyField(
null=True, related_name="actor_movies", to="cinema.actor"
),
),
migrations.AlterField(
model_name="movie",
name="genres",
field=models.ManyToManyField(
null=True, related_name="genre_movies", to="cinema.genre"
),
),
]
26 changes: 26 additions & 0 deletions cinema/migrations/0005_alter_movie_actors_alter_movie_genres.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.1 on 2023-11-24 19:12

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("cinema", "0004_alter_movie_actors_alter_movie_genres"),
]

operations = [
migrations.AlterField(
model_name="movie",
name="actors",
field=models.ManyToManyField(
related_name="actor_movies", to="cinema.actor"
),
),
migrations.AlterField(
model_name="movie",
name="genres",
field=models.ManyToManyField(
related_name="genre_movies", to="cinema.genre"
),
),
]

0 comments on commit 135791b

Please sign in to comment.