mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 13:11:08 -05:00
Create initial migration for HistoricalSlug model; update foreign key references to use settings.AUTH_USER_MODEL and define unique constraints
This commit is contained in:
@@ -1,50 +1,32 @@
|
|||||||
# Generated by Django 5.1.4 on 2025-02-10 01:10
|
from django.conf import settings
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("contenttypes", "0002_remove_content_type_name"),
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
('contenttypes', '0002_remove_content_type_name'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name="HistoricalSlug",
|
name='HistoricalSlug',
|
||||||
fields=[
|
fields=[
|
||||||
(
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
"id",
|
('object_id', models.PositiveIntegerField()),
|
||||||
models.BigAutoField(
|
('slug', models.SlugField(max_length=255)),
|
||||||
auto_created=True,
|
('created_at', models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now)),
|
||||||
primary_key=True,
|
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
|
||||||
serialize=False,
|
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='historical_slugs', to=settings.AUTH_USER_MODEL)),
|
||||||
verbose_name="ID",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
("object_id", models.PositiveIntegerField()),
|
|
||||||
("slug", models.SlugField(max_length=255)),
|
|
||||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
||||||
(
|
|
||||||
"content_type",
|
|
||||||
models.ForeignKey(
|
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
|
||||||
to="contenttypes.contenttype",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
"indexes": [
|
'unique_together': {('content_type', 'slug')},
|
||||||
models.Index(
|
'indexes': [
|
||||||
fields=["content_type", "object_id"],
|
models.Index(fields=['content_type', 'object_id'], name='history_tra_content_1234ab_idx'),
|
||||||
name="history_tra_content_63013c_idx",
|
models.Index(fields=['slug'], name='history_tra_slug_1234ab_idx'),
|
||||||
),
|
|
||||||
models.Index(fields=["slug"], name="history_tra_slug_f843aa_idx"),
|
|
||||||
],
|
],
|
||||||
"unique_together": {("content_type", "slug")},
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
13
memory-bank/state/history_tracking_migration.md
Normal file
13
memory-bank/state/history_tracking_migration.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
Current State at Mon Feb 10 00:19:42 EST 2025:
|
||||||
|
|
||||||
|
1. In process of migrating history tracking system
|
||||||
|
2. Created initial migration for HistoricalSlug model
|
||||||
|
3. Interrupted during attempt to handle auto_now_add field migration
|
||||||
|
4. Migration files in progress:
|
||||||
|
- history_tracking/migrations/0001_initial.py
|
||||||
|
- rides/migrations/0002_event_models_unmanaged.py
|
||||||
|
|
||||||
|
Next planned steps (awaiting confirmation):
|
||||||
|
1. Complete history_tracking migrations
|
||||||
|
2. Update rides event models
|
||||||
|
3. Test history tracking functionality
|
||||||
@@ -5,6 +5,8 @@ import pgtrigger.compiler
|
|||||||
import pgtrigger.migrations
|
import pgtrigger.migrations
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
PARKS_APP_MODEL = "parks.park"
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
@@ -84,12 +86,12 @@ class Migration(migrations.Migration):
|
|||||||
("closing_date", models.DateField(blank=True, null=True)),
|
("closing_date", models.DateField(blank=True, null=True)),
|
||||||
("created_at", models.DateTimeField(auto_now_add=True, null=True)),
|
("created_at", models.DateTimeField(auto_now_add=True, null=True)),
|
||||||
("updated_at", models.DateTimeField(auto_now=True)),
|
("updated_at", models.DateTimeField(auto_now=True)),
|
||||||
(
|
|
||||||
"park",
|
"park",
|
||||||
models.ForeignKey(
|
models.ForeignKey(
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
related_name="areas",
|
related_name="areas",
|
||||||
to="parks.park",
|
to=PARKS_APP_MODEL,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -117,11 +119,11 @@ class Migration(migrations.Migration):
|
|||||||
db_constraint=False,
|
db_constraint=False,
|
||||||
on_delete=django.db.models.deletion.DO_NOTHING,
|
on_delete=django.db.models.deletion.DO_NOTHING,
|
||||||
related_name="+",
|
related_name="+",
|
||||||
related_query_name="+",
|
to=PARKS_APP_MODEL,
|
||||||
to="parks.park",
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
"pgh_context",
|
||||||
"pgh_context",
|
"pgh_context",
|
||||||
models.ForeignKey(
|
models.ForeignKey(
|
||||||
db_constraint=False,
|
db_constraint=False,
|
||||||
@@ -214,11 +216,11 @@ class Migration(migrations.Migration):
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
"pgh_obj",
|
"pgh_obj",
|
||||||
models.ForeignKey(
|
|
||||||
db_constraint=False,
|
db_constraint=False,
|
||||||
on_delete=django.db.models.deletion.DO_NOTHING,
|
on_delete=django.db.models.deletion.DO_NOTHING,
|
||||||
related_name="events",
|
related_name="events",
|
||||||
to="parks.park",
|
to=PARKS_APP_MODEL,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user