| @ -0,0 +1,6 @@ | |||||
| PRAGMA foreign_keys=OFF; | |||||
| BEGIN TRANSACTION; | |||||
| CREATE TABLE IF NOT EXISTS "gestion_autor" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "nombre" varchar(200) NOT NULL, "biografia" text NULL, "foto" varchar(100) NULL); | |||||
| INSERT INTO gestion_autor VALUES(1,'Auster, Paul','','autores/auster.jpg'); | |||||
| INSERT INTO gestion_autor VALUES(3,'Noah Yuval Harari','ddgasfdgasdfgasdfgasdfg','autores/220px-Yuval_Noah_Harari_cropped.jpg'); | |||||
| COMMIT; | |||||
| @ -0,0 +1,37 @@ | |||||
| # Generated by Django 5.0.7 on 2024-08-09 11:18 | |||||
| import django.core.validators | |||||
| import django.db.models.deletion | |||||
| import gestion.models | |||||
| from django.db import migrations, models | |||||
| class Migration(migrations.Migration): | |||||
| dependencies = [ | |||||
| ('gestion', '0002_autor_reymotauser_is_active_reymotauser_is_staff_and_more'), | |||||
| ] | |||||
| operations = [ | |||||
| migrations.CreateModel( | |||||
| name='Autor', | |||||
| fields=[ | |||||
| ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |||||
| ('nombre', models.CharField(max_length=200)), | |||||
| ('biografia', models.TextField(blank=True, null=True)), | |||||
| ('foto', models.ImageField(blank=True, null=True, upload_to='autores/')), | |||||
| ], | |||||
| ), | |||||
| migrations.CreateModel( | |||||
| name='Libro', | |||||
| fields=[ | |||||
| ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |||||
| ('titulo', models.CharField(max_length=200)), | |||||
| ('fecha_publicacion', models.PositiveBigIntegerField(default=2024, validators=[django.core.validators.MinValueValidator(1984), gestion.models.max_value_current_year])), | |||||
| ('descripcion', models.TextField(blank=True, null=True)), | |||||
| ('archivo', models.FileField(upload_to='libros/')), | |||||
| ('portada', models.ImageField(blank=True, null=True, upload_to='portadas/')), | |||||
| ('autor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gestion.autor')), | |||||
| ], | |||||
| ), | |||||
| ] | |||||
| @ -0,0 +1,18 @@ | |||||
| # Generated by Django 5.0.7 on 2024-08-09 11:44 | |||||
| from django.db import migrations, models | |||||
| class Migration(migrations.Migration): | |||||
| dependencies = [ | |||||
| ('gestion', '0003_autor_libro'), | |||||
| ] | |||||
| operations = [ | |||||
| migrations.AddField( | |||||
| model_name='reymotauser', | |||||
| name='nombre', | |||||
| field=models.TextField(blank=True, null=True), | |||||
| ), | |||||
| ] | |||||
| @ -0,0 +1,18 @@ | |||||
| # Generated by Django 5.0.7 on 2024-08-09 11:46 | |||||
| from django.db import migrations, models | |||||
| class Migration(migrations.Migration): | |||||
| dependencies = [ | |||||
| ('gestion', '0004_reymotauser_nombre'), | |||||
| ] | |||||
| operations = [ | |||||
| migrations.AlterField( | |||||
| model_name='reymotauser', | |||||
| name='nombre', | |||||
| field=models.CharField(blank=True, max_length=200, null=True), | |||||
| ), | |||||
| ] | |||||
| @ -0,0 +1,8 @@ | |||||
| PRAGMA foreign_keys=OFF; | |||||
| BEGIN TRANSACTION; | |||||
| CREATE TABLE IF NOT EXISTS "gestion_libro" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "titulo" varchar(200) NOT NULL, "descripcion" text NULL, "archivo" varchar(100) NOT NULL, "autor_id" bigint NOT NULL REFERENCES "gestion_autor" ("id") DEFERRABLE INITIALLY DEFERRED, "fecha_publicacion" bigint unsigned NOT NULL CHECK ("fecha_publicacion" >= 0), "portada" varchar(100) NULL); | |||||
| INSERT INTO gestion_libro VALUES(1,'Sunset Park','buena','libros/Sunset_Park_-_Paul_Auster_12.epub',1,2018,'portadas/sunsetpark.jpeg'); | |||||
| INSERT INTO gestion_libro VALUES(2,'Invisible','ddd','libros/Invisible_-_Paul_Auster_5.epub',1,2024,'portadas/invisible.jpeg'); | |||||
| INSERT INTO gestion_libro VALUES(3,'El Palacio de la Luna','Lentejas caseras','libros/Palacio_de_la_Luna_El_-_Auster_Paul_99.epub',1,2018,'portadas/palacio.jpeg'); | |||||
| INSERT INTO gestion_libro VALUES(4,'21 Lecciones para el siglo XXI','ddd','libros/21_lecciones_para_el_siglo_XXI_-_Yuval_Noah_Harari_234.epub',3,2024,'portadas/lecciones.jpeg'); | |||||
| COMMIT; | |||||