Update field
This commit is contained in:
parent
722f5d7a9a
commit
01f86a6b51
31
app/library/migrations/0001_initial.py
Normal file
31
app/library/migrations/0001_initial.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Generated by Django 3.2.5 on 2021-07-15 14:23
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Book',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('title', models.CharField(max_length=255)),
|
||||||
|
('country', models.CharField(max_length=255)),
|
||||||
|
('year', models.IntegerField(max_length=5)),
|
||||||
|
('author', models.CharField(max_length=255)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'Book',
|
||||||
|
'verbose_name_plural': 'Books',
|
||||||
|
'ordering': ('created_at',),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
18
app/library/migrations/0002_alter_book_year.py
Normal file
18
app/library/migrations/0002_alter_book_year.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 3.2.5 on 2021-07-15 14:24
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('library', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='book',
|
||||||
|
name='year',
|
||||||
|
field=models.IntegerField(),
|
||||||
|
),
|
||||||
|
]
|
0
app/library/migrations/__init__.py
Normal file
0
app/library/migrations/__init__.py
Normal file
@ -6,7 +6,7 @@ from django.db import models
|
|||||||
class Book(models.Model):
|
class Book(models.Model):
|
||||||
title = models.CharField(max_length=255)
|
title = models.CharField(max_length=255)
|
||||||
country = models.CharField(max_length=255)
|
country = models.CharField(max_length=255)
|
||||||
year = models.CharField(max_length=4)
|
year = models.IntegerField()
|
||||||
author = models.CharField(max_length=255)
|
author = models.CharField(max_length=255)
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
updated_at = models.DateTimeField(auto_now=True)
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
rm -rf app/library/migrations
|
|
||||||
python manage.py makemigrations library
|
|
||||||
python manage.py migrate
|
python manage.py migrate
|
||||||
python manage.py runscript create_books
|
python manage.py runscript create_books
|
||||||
|
Loading…
Reference in New Issue
Block a user