Update field

This commit is contained in:
Andros Fenollosa 2021-07-15 16:24:20 +02:00
parent 722f5d7a9a
commit 01f86a6b51
5 changed files with 50 additions and 3 deletions

View 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',),
},
),
]

View 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(),
),
]

View File

View 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)

View File

@ -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