This repository has been archived by the owner on Apr 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransfer.py
64 lines (51 loc) · 1.79 KB
/
transfer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from core.database import *
from core.database.user import User as UserData, UserInfo, UserGachaInfo
amiya = SqliteDatabase('amiya.db')
class AmiyaBaseModel(Model):
class Meta:
database = amiya
class User(AmiyaBaseModel):
user_id = TextField(primary_key=True)
user_feeling = IntegerField(default=0)
user_mood = IntegerField(default=15)
message_num = IntegerField(default=0)
coupon = IntegerField(default=50)
gacha_break_even = IntegerField(default=0)
gacha_pool = IntegerField(default=1)
sign_in = IntegerField(default=0)
sign_times = IntegerField(default=0)
black = IntegerField(default=0)
waiting = TextField(null=True)
def transfer_user():
all_user: List[User] = User.select()
user_data = []
user_info_data = []
user_gacha_info_data = []
for item in all_user:
user_data.append({
'user_id': item.user_id,
'nickname': '',
'message_num': item.message_num,
'black': item.black,
})
user_info_data.append({
'user_id': item.user_id,
'user_feeling': item.user_feeling,
'user_mood': item.user_mood,
'sign_in': item.sign_in,
'sign_times': item.sign_times,
})
user_gacha_info_data.append({
'user_id': item.user_id,
'coupon': item.coupon,
'gacha_break_even': item.gacha_break_even,
'gacha_pool': item.gacha_pool,
})
UserData.delete().execute()
UserInfo.delete().execute()
UserGachaInfo.delete().execute()
UserData.batch_insert(user_data, chunk_size=100)
UserInfo.batch_insert(user_info_data, chunk_size=100)
UserGachaInfo.batch_insert(user_gacha_info_data, chunk_size=100)
if __name__ == '__main__':
transfer_user()