mirror of
https://github.com/Eugeny/tabby-web.git
synced 2026-08-18 15:26:04 +01:00
wip
This commit is contained in:
29
tabby/app/migrations/0004_sync_token.py
Normal file
29
tabby/app/migrations/0004_sync_token.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import secrets
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def run_forward(apps, schema_editor):
|
||||
for user in apps.get_model('app', 'User').objects.all():
|
||||
user.config_sync_token = secrets.token_hex(64)
|
||||
user.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('app', '0003_auto_20210711_1855'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='user',
|
||||
name='config_sync_token',
|
||||
field=models.CharField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
migrations.RunPython(run_forward, lambda _, __: None),
|
||||
migrations.AlterField(
|
||||
model_name='user',
|
||||
name='config_sync_token',
|
||||
field=models.CharField(max_length=255),
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user