|
1 | | -# Generated by Django 6.0.2 on 2026-03-06 23:44 |
| 1 | +# Generated by Django 6.0.2 on 2026-03-06 23:44 (patched) |
2 | 2 |
|
3 | 3 | import django.db.models.deletion |
4 | 4 | from django.db import migrations, models |
|
7 | 7 | class Migration(migrations.Migration): |
8 | 8 |
|
9 | 9 | dependencies = [ |
10 | | - ('nomz', '0001_initial'), |
| 10 | + ("nomz", "0002_restaurant_restaurantphoto"), |
| 11 | + ("nomz", "0002_loginlog"), |
11 | 12 | ] |
12 | 13 |
|
13 | 14 | operations = [ |
14 | 15 | migrations.CreateModel( |
15 | | - name='DataIngestionRun', |
| 16 | + name="DataIngestionRun", |
16 | 17 | fields=[ |
17 | | - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
18 | | - ('dataset', models.CharField(max_length=64)), |
19 | | - ('status', models.CharField(choices=[('running', 'Running'), ('success', 'Success'), ('failed', 'Failed')], default='running', max_length=20)), |
20 | | - ('started_at', models.DateTimeField(auto_now_add=True)), |
21 | | - ('finished_at', models.DateTimeField(blank=True, null=True)), |
22 | | - ('records_fetched', models.IntegerField(default=0)), |
23 | | - ('records_processed', models.IntegerField(default=0)), |
24 | | - ('records_created', models.IntegerField(default=0)), |
25 | | - ('records_updated', models.IntegerField(default=0)), |
26 | | - ('records_matched', models.IntegerField(default=0)), |
27 | | - ('records_skipped', models.IntegerField(default=0)), |
28 | | - ('error_count', models.IntegerField(default=0)), |
29 | | - ('error_log', models.JSONField(blank=True, default=list)), |
| 18 | + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), |
| 19 | + ("dataset", models.CharField(max_length=64)), |
| 20 | + ("status", models.CharField(choices=[("running", "Running"), ("success", "Success"), ("failed", "Failed")], default="running", max_length=20)), |
| 21 | + ("started_at", models.DateTimeField(auto_now_add=True)), |
| 22 | + ("finished_at", models.DateTimeField(blank=True, null=True)), |
| 23 | + ("records_fetched", models.IntegerField(default=0)), |
| 24 | + ("records_processed", models.IntegerField(default=0)), |
| 25 | + ("records_created", models.IntegerField(default=0)), |
| 26 | + ("records_updated", models.IntegerField(default=0)), |
| 27 | + ("records_matched", models.IntegerField(default=0)), |
| 28 | + ("records_skipped", models.IntegerField(default=0)), |
| 29 | + ("error_count", models.IntegerField(default=0)), |
| 30 | + ("error_log", models.JSONField(blank=True, default=list)), |
30 | 31 | ], |
31 | 32 | options={ |
32 | | - 'ordering': ['-started_at'], |
| 33 | + "ordering": ["-started_at"], |
33 | 34 | }, |
34 | 35 | ), |
35 | 36 | migrations.CreateModel( |
36 | | - name='Restaurant', |
| 37 | + name="RestaurantSourceRecord", |
37 | 38 | fields=[ |
38 | | - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
39 | | - ('name', models.CharField(max_length=255)), |
40 | | - ('display_name', models.CharField(blank=True, max_length=255)), |
41 | | - ('name_normalized', models.CharField(db_index=True, max_length=255)), |
42 | | - ('building', models.CharField(blank=True, max_length=64, null=True)), |
43 | | - ('street', models.CharField(blank=True, max_length=255, null=True)), |
44 | | - ('borough', models.CharField(blank=True, max_length=80, null=True)), |
45 | | - ('zip_code', models.CharField(blank=True, db_index=True, max_length=10, null=True)), |
46 | | - ('phone', models.CharField(blank=True, max_length=30, null=True)), |
47 | | - ('website', models.URLField(blank=True, max_length=500, null=True)), |
48 | | - ('cuisine_tags', models.JSONField(blank=True, default=list)), |
49 | | - ('latitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)), |
50 | | - ('longitude', models.DecimalField(blank=True, decimal_places=6, max_digits=10, null=True)), |
51 | | - ('composite_score', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True)), |
52 | | - ('grade_latest', models.CharField(blank=True, max_length=16, null=True)), |
53 | | - ('grade_score_latest', models.IntegerField(blank=True, null=True)), |
54 | | - ('last_inspection_date', models.DateField(blank=True, null=True)), |
55 | | - ('composite_score_calculated_at', models.DateTimeField(blank=True, null=True)), |
56 | | - ('is_active', models.BooleanField(default=True)), |
57 | | - ('created_at', models.DateTimeField(auto_now_add=True)), |
58 | | - ('updated_at', models.DateTimeField(auto_now=True)), |
| 39 | + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), |
| 40 | + ("source", models.CharField(choices=[("EATERIES", "Directory of Eateries"), ("DINING_OUT", "Dining Out NYC Locations"), ("DOHMH", "DOHMH Restaurant Inspection Results")], max_length=20)), |
| 41 | + ("external_id", models.CharField(max_length=200)), |
| 42 | + ("external_name", models.CharField(max_length=255)), |
| 43 | + ("external_address", models.CharField(blank=True, max_length=255, null=True)), |
| 44 | + ("raw_payload", models.JSONField(blank=True, null=True)), |
| 45 | + ("confidence", models.DecimalField(decimal_places=3, default=0.0, max_digits=4)), |
| 46 | + ("source_url", models.URLField(blank=True, max_length=500, null=True)), |
| 47 | + ("first_seen_at", models.DateTimeField(auto_now_add=True)), |
| 48 | + ("last_seen_at", models.DateTimeField(auto_now=True)), |
| 49 | + ("restaurant", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name="sources", to="nomz.restaurant")), |
59 | 50 | ], |
60 | 51 | options={ |
61 | | - 'ordering': ['name'], |
62 | | - 'indexes': [models.Index(fields=['name_normalized', 'zip_code'], name='nomz_restau_name_no_1bc4bb_idx'), models.Index(fields=['borough', 'zip_code'], name='nomz_restau_borough_8e6a1a_idx'), models.Index(fields=['is_active'], name='nomz_restau_is_acti_f59dd9_idx'), models.Index(fields=['latitude', 'longitude'], name='nomz_restau_latitud_09565a_idx')], |
| 52 | + "indexes": [ |
| 53 | + models.Index(fields=["source", "external_id"], name="nomz_source_ext_1"), |
| 54 | + models.Index(fields=["restaurant", "source"], name="nomz_source_rest_2"), |
| 55 | + ], |
| 56 | + "unique_together": {("source", "external_id")}, |
63 | 57 | }, |
64 | 58 | ), |
65 | 59 | migrations.CreateModel( |
66 | | - name='InspectionRecord', |
| 60 | + name="InspectionRecord", |
67 | 61 | fields=[ |
68 | | - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
69 | | - ('inspection_date', models.DateField()), |
70 | | - ('inspection_key', models.CharField(max_length=200)), |
71 | | - ('grade', models.CharField(blank=True, max_length=12, null=True)), |
72 | | - ('score', models.IntegerField(blank=True, null=True)), |
73 | | - ('critical_violations', models.IntegerField(default=0)), |
74 | | - ('noncritical_violations', models.IntegerField(default=0)), |
75 | | - ('violation_count', models.IntegerField(default=0)), |
76 | | - ('inspection_type', models.CharField(blank=True, max_length=128, null=True)), |
77 | | - ('action', models.CharField(blank=True, max_length=255, null=True)), |
78 | | - ('violations', models.JSONField(blank=True, default=list)), |
79 | | - ('camis', models.CharField(blank=True, max_length=80, null=True)), |
80 | | - ('boro', models.CharField(blank=True, max_length=80, null=True)), |
81 | | - ('raw_payload', models.JSONField(blank=True, null=True)), |
82 | | - ('created_at', models.DateTimeField(auto_now_add=True)), |
83 | | - ('restaurant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='inspections', to='nomz.restaurant')), |
| 62 | + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), |
| 63 | + ("inspection_date", models.DateField()), |
| 64 | + ("inspection_key", models.CharField(max_length=200)), |
| 65 | + ("grade", models.CharField(blank=True, max_length=12, null=True)), |
| 66 | + ("score", models.IntegerField(blank=True, null=True)), |
| 67 | + ("critical_violations", models.IntegerField(default=0)), |
| 68 | + ("noncritical_violations", models.IntegerField(default=0)), |
| 69 | + ("violation_count", models.IntegerField(default=0)), |
| 70 | + ("inspection_type", models.CharField(blank=True, max_length=128, null=True)), |
| 71 | + ("action", models.CharField(blank=True, max_length=255, null=True)), |
| 72 | + ("violations", models.JSONField(blank=True, default=list)), |
| 73 | + ("camis", models.CharField(blank=True, max_length=80, null=True)), |
| 74 | + ("boro", models.CharField(blank=True, max_length=80, null=True)), |
| 75 | + ("raw_payload", models.JSONField(blank=True, null=True)), |
| 76 | + ("created_at", models.DateTimeField(auto_now_add=True)), |
| 77 | + ("restaurant", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name="inspections", to="nomz.restaurant")), |
84 | 78 | ], |
85 | 79 | options={ |
86 | | - 'ordering': ['-inspection_date'], |
87 | | - 'indexes': [models.Index(fields=['restaurant', 'inspection_date'], name='nomz_inspec_restaur_035d0b_idx'), models.Index(fields=['grade'], name='nomz_inspec_grade_c214b2_idx')], |
88 | | - 'unique_together': {('restaurant', 'inspection_key')}, |
| 80 | + "ordering": ["-inspection_date"], |
| 81 | + "indexes": [ |
| 82 | + models.Index(fields=["restaurant", "inspection_date"], name="nomz_insp_rest_1"), |
| 83 | + models.Index(fields=["grade"], name="nomz_insp_grade_1"), |
| 84 | + ], |
| 85 | + "unique_together": {("restaurant", "inspection_key")}, |
89 | 86 | }, |
90 | 87 | ), |
91 | | - migrations.CreateModel( |
92 | | - name='RestaurantSourceRecord', |
93 | | - fields=[ |
94 | | - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
95 | | - ('source', models.CharField(choices=[('EATERIES', 'Directory of Eateries'), ('DINING_OUT', 'Dining Out NYC Locations'), ('DOHMH', 'DOHMH Inspection Results')], max_length=20)), |
96 | | - ('external_id', models.CharField(max_length=200)), |
97 | | - ('external_name', models.CharField(max_length=255)), |
98 | | - ('external_address', models.CharField(blank=True, max_length=255, null=True)), |
99 | | - ('raw_payload', models.JSONField(blank=True, null=True)), |
100 | | - ('confidence', models.DecimalField(decimal_places=3, default=0.0, max_digits=4)), |
101 | | - ('source_url', models.URLField(blank=True, max_length=500, null=True)), |
102 | | - ('first_seen_at', models.DateTimeField(auto_now_add=True)), |
103 | | - ('last_seen_at', models.DateTimeField(auto_now=True)), |
104 | | - ('restaurant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sources', to='nomz.restaurant')), |
105 | | - ], |
106 | | - options={ |
107 | | - 'indexes': [models.Index(fields=['source', 'external_id'], name='nomz_restau_source_160b12_idx'), models.Index(fields=['restaurant', 'source'], name='nomz_restau_restaur_446d59_idx')], |
108 | | - 'unique_together': {('source', 'external_id')}, |
109 | | - }, |
| 88 | + migrations.AddField( |
| 89 | + model_name="restaurant", |
| 90 | + name="neighborhood", |
| 91 | + field=models.CharField(blank=True, default="", max_length=100), |
| 92 | + ), |
| 93 | + migrations.AddField( |
| 94 | + model_name="restaurant", |
| 95 | + name="cuisine", |
| 96 | + field=models.CharField(blank=True, default="", max_length=100), |
| 97 | + ), |
| 98 | + migrations.AddField( |
| 99 | + model_name="restaurant", |
| 100 | + name="display_name", |
| 101 | + field=models.CharField(blank=True, default="", max_length=255), |
| 102 | + ), |
| 103 | + migrations.AddField( |
| 104 | + model_name="restaurant", |
| 105 | + name="name_normalized", |
| 106 | + field=models.CharField(blank=True, db_index=True, default="", max_length=255), |
| 107 | + ), |
| 108 | + migrations.AddField( |
| 109 | + model_name="restaurant", |
| 110 | + name="building", |
| 111 | + field=models.CharField(blank=True, max_length=64, null=True), |
| 112 | + ), |
| 113 | + migrations.AddField( |
| 114 | + model_name="restaurant", |
| 115 | + name="street", |
| 116 | + field=models.CharField(blank=True, max_length=255, null=True), |
| 117 | + ), |
| 118 | + migrations.AddField( |
| 119 | + model_name="restaurant", |
| 120 | + name="borough", |
| 121 | + field=models.CharField(blank=True, max_length=80, null=True), |
| 122 | + ), |
| 123 | + migrations.AddField( |
| 124 | + model_name="restaurant", |
| 125 | + name="zip_code", |
| 126 | + field=models.CharField(blank=True, db_index=True, max_length=10, null=True), |
| 127 | + ), |
| 128 | + migrations.AddField( |
| 129 | + model_name="restaurant", |
| 130 | + name="cuisine_tags", |
| 131 | + field=models.JSONField(blank=True, default=list), |
| 132 | + ), |
| 133 | + migrations.AddField( |
| 134 | + model_name="restaurant", |
| 135 | + name="latitude", |
| 136 | + field=models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True), |
| 137 | + ), |
| 138 | + migrations.AddField( |
| 139 | + model_name="restaurant", |
| 140 | + name="longitude", |
| 141 | + field=models.DecimalField(blank=True, decimal_places=6, max_digits=10, null=True), |
| 142 | + ), |
| 143 | + migrations.AddField( |
| 144 | + model_name="restaurant", |
| 145 | + name="composite_score", |
| 146 | + field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True), |
| 147 | + ), |
| 148 | + migrations.AddField( |
| 149 | + model_name="restaurant", |
| 150 | + name="grade_latest", |
| 151 | + field=models.CharField(blank=True, max_length=16, null=True), |
| 152 | + ), |
| 153 | + migrations.AddField( |
| 154 | + model_name="restaurant", |
| 155 | + name="grade_score_latest", |
| 156 | + field=models.IntegerField(blank=True, null=True), |
| 157 | + ), |
| 158 | + migrations.AddField( |
| 159 | + model_name="restaurant", |
| 160 | + name="last_inspection_date", |
| 161 | + field=models.DateField(blank=True, null=True), |
| 162 | + ), |
| 163 | + migrations.AddField( |
| 164 | + model_name="restaurant", |
| 165 | + name="composite_score_calculated_at", |
| 166 | + field=models.DateTimeField(blank=True, null=True), |
| 167 | + ), |
| 168 | + migrations.AddIndex( |
| 169 | + model_name="restaurant", |
| 170 | + index=models.Index(fields=["name_normalized", "zip_code"], name="nomz_restau_name_no_1bc4bb_idx"), |
| 171 | + ), |
| 172 | + migrations.AddIndex( |
| 173 | + model_name="restaurant", |
| 174 | + index=models.Index(fields=["borough", "zip_code"], name="nomz_restau_borough_8e6a1a_idx"), |
| 175 | + ), |
| 176 | + migrations.AddIndex( |
| 177 | + model_name="restaurant", |
| 178 | + index=models.Index(fields=["is_active"], name="nomz_restau_is_acti_f59dd9_idx"), |
| 179 | + ), |
| 180 | + migrations.AddIndex( |
| 181 | + model_name="restaurant", |
| 182 | + index=models.Index(fields=["latitude", "longitude"], name="nomz_restau_latitud_09565a_idx"), |
110 | 183 | ), |
111 | 184 | ] |
0 commit comments