Changed work of shelf books
This commit is contained in:
29
backend/apps/shelf_books/migrations/0001_initial.py
Normal file
29
backend/apps/shelf_books/migrations/0001_initial.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Generated by Django 6.0.3 on 2026-03-22 12:16
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('books', '0001_initial'),
|
||||
('shelves', '0002_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ShelfItem',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('quantity', models.PositiveIntegerField(default=0)),
|
||||
('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='shelf_items', to='books.book')),
|
||||
('shelf', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='book_items', to='shelves.shelf')),
|
||||
],
|
||||
options={
|
||||
'constraints': [models.UniqueConstraint(fields=('book', 'shelf'), name='unique_book_per_shelf')],
|
||||
},
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,19 @@
|
||||
# Generated by Django 6.0.3 on 2026-03-22 12:53
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('books', '0001_initial'),
|
||||
('shelf_books', '0001_initial'),
|
||||
('shelves', '0002_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameModel(
|
||||
old_name='ShelfItem',
|
||||
new_name='ShelfBook',
|
||||
),
|
||||
]
|
||||
0
backend/apps/shelf_books/migrations/__init__.py
Normal file
0
backend/apps/shelf_books/migrations/__init__.py
Normal file
Reference in New Issue
Block a user