61 lines
3.5 KiB
Python
61 lines
3.5 KiB
Python
|
|
# Generated by Django 4.2 on 2026-04-05 12:00
|
||
|
|
|
||
|
|
from django.db import migrations, models
|
||
|
|
import django.db.models.deletion
|
||
|
|
|
||
|
|
|
||
|
|
class Migration(migrations.Migration):
|
||
|
|
|
||
|
|
initial = True
|
||
|
|
|
||
|
|
dependencies = [
|
||
|
|
]
|
||
|
|
|
||
|
|
operations = [
|
||
|
|
migrations.CreateModel(
|
||
|
|
name='LobsterMemory',
|
||
|
|
fields=[
|
||
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||
|
|
('lobster_id', models.CharField(help_text='龙虾ID', max_length=50)),
|
||
|
|
('file_path', models.CharField(help_text='文件相对路径', max_length=500)),
|
||
|
|
('content', models.TextField(help_text='文件内容')),
|
||
|
|
('hash', models.CharField(help_text='SHA256哈希', max_length=64)),
|
||
|
|
('status', models.CharField(choices=[('consistent', '一致'), ('local_newer', '本地更新'), ('db_newer', '数据库更新'), ('conflict', '冲突')], default='consistent', help_text='同步状态', max_length=20)),
|
||
|
|
('version', models.IntegerField(default=1, help_text='版本号')),
|
||
|
|
('size', models.IntegerField(default=0, help_text='文件大小(字节)')),
|
||
|
|
('created_at', models.DateTimeField(auto_now_add=True, help_text='创建时间')),
|
||
|
|
('updated_at', models.DateTimeField(auto_now=True, help_text='更新时间')),
|
||
|
|
],
|
||
|
|
options={
|
||
|
|
'db_table': 'lobster_memory',
|
||
|
|
'ordering': ['-updated_at'],
|
||
|
|
},
|
||
|
|
),
|
||
|
|
migrations.CreateModel(
|
||
|
|
name='SyncHistory',
|
||
|
|
fields=[
|
||
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||
|
|
('lobster_id', models.CharField(help_text='龙虾ID', max_length=50)),
|
||
|
|
('file_path', models.CharField(help_text='文件相对路径', max_length=500)),
|
||
|
|
('action', models.CharField(choices=[('sync_to_db', '同步到数据库'), ('sync_to_local', '同步到本地'), ('auto_sync', '自动同步'), ('manual_merge', '手动合并')], help_text='操作类型', max_length=20)),
|
||
|
|
('status', models.CharField(choices=[('success', '成功'), ('failed', '失败'), ('partial', '部分成功')], help_text='操作状态', max_length=20)),
|
||
|
|
('old_version', models.IntegerField(blank=True, help_text='操作前版本', null=True)),
|
||
|
|
('new_version', models.IntegerField(blank=True, help_text='操作后版本', null=True)),
|
||
|
|
('old_hash', models.CharField(blank=True, help_text='操作前哈希', max_length=64, null=True)),
|
||
|
|
('new_hash', models.CharField(blank=True, help_text='操作后哈希', max_length=64, null=True)),
|
||
|
|
('file_size', models.IntegerField(default=0, help_text='文件大小(字节)')),
|
||
|
|
('operator', models.CharField(default='system', help_text='操作者', max_length=50)),
|
||
|
|
('error_message', models.TextField(blank=True, help_text='错误信息', null=True)),
|
||
|
|
('execution_time', models.FloatField(default=0, help_text='执行时间(秒)')),
|
||
|
|
('created_at', models.DateTimeField(auto_now_add=True, help_text='操作时间')),
|
||
|
|
],
|
||
|
|
options={
|
||
|
|
'db_table': 'sync_history',
|
||
|
|
'ordering': ['-created_at'],
|
||
|
|
},
|
||
|
|
),
|
||
|
|
migrations.AlterUniqueTogether(
|
||
|
|
name='lobstermemory',
|
||
|
|
unique_together={('lobster_id', 'file_path', 'version')},
|
||
|
|
),
|
||
|
|
]
|