Skip to content

Commit 168f3d0

Browse files
authored
Merge pull request #141 from SmoFlaDru/dev-benno
Adapt table names to lowercase for postgres migration
2 parents 52484bb + c2fcc41 commit 168f3d0

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

spybot/migrations/0001_initial.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Migration(migrations.Migration):
4949
('order', models.PositiveIntegerField()),
5050
],
5151
options={
52-
'db_table': 'TSChannel',
52+
'db_table': 'tschannel',
5353
'managed': True,
5454
},
5555
),
@@ -63,7 +63,7 @@ class Migration(migrations.Migration):
6363
('merged_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='tsusers', to=settings.AUTH_USER_MODEL)),
6464
],
6565
options={
66-
'db_table': 'TSUser',
66+
'db_table': 'tsuser',
6767
'managed': True,
6868
},
6969
),
@@ -88,7 +88,7 @@ class Migration(migrations.Migration):
8888
('tsuser', models.ForeignKey(blank=True, db_column='tsUserID', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='spybot.tsuser')),
8989
],
9090
options={
91-
'db_table': 'TSID',
91+
'db_table': 'tsid',
9292
'managed': True,
9393
},
9494
),
@@ -133,7 +133,7 @@ class Migration(migrations.Migration):
133133
('activity_hours', models.FloatField()),
134134
],
135135
options={
136-
'db_table': 'HourlyActivity',
136+
'db_table': 'hourlyactivity',
137137
'indexes': [models.Index(fields=['datetime'], name='HourlyActiv_datetim_96f0af_idx')],
138138
},
139139
),
@@ -162,7 +162,7 @@ class Migration(migrations.Migration):
162162
('tsuser', models.ForeignKey(blank=True, db_column='tsUserID', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='spybot.tsuser')),
163163
],
164164
options={
165-
'db_table': 'TSUserActivity',
165+
'db_table': 'tsuseractivity',
166166
'managed': True,
167167
'indexes': [models.Index(fields=['start_time'], name='TSUserActiv_startTi_95ea75_idx')],
168168
},

spybot/models.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TSChannel(DebuggableModel):
4242

4343
class Meta:
4444
managed = True
45-
db_table = 'TSChannel'
45+
db_table = 'tschannel'
4646

4747

4848
# Django doesn't have an unsigned int auto (auto-incremented) field type natively, so we provide our own
@@ -124,7 +124,7 @@ class TSUser(DebuggableModel):
124124

125125
class Meta:
126126
managed = True
127-
db_table = 'TSUser'
127+
db_table = 'tsuser'
128128

129129
def last_login_time(self):
130130
return getattr(TSUserActivity.objects.filter(tsuser=self, end_time__isnull=False).order_by('-end_time').first(), 'end_time', None)
@@ -136,7 +136,7 @@ class TSID(DebuggableModel):
136136

137137
class Meta:
138138
managed = True
139-
db_table = 'TSID'
139+
db_table = 'tsid'
140140

141141

142142
class TSUserActivity(DebuggableModel):
@@ -150,7 +150,7 @@ class TSUserActivity(DebuggableModel):
150150

151151
class Meta:
152152
managed = True
153-
db_table = 'TSUserActivity'
153+
db_table = 'tsuseractivity'
154154
indexes = [
155155
models.Index(fields=['start_time'])
156156
]
@@ -161,7 +161,7 @@ class HourlyActivity(DebuggableModel):
161161
activity_hours = models.FloatField(null=False)
162162

163163
class Meta:
164-
db_table = 'HourlyActivity'
164+
db_table = 'hourlyactivity'
165165
indexes = [
166166
models.Index(fields=['datetime']),
167167
]

0 commit comments

Comments
 (0)