generated from kc3hack/2023_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
migration.py
120 lines (101 loc) · 2.29 KB
/
migration.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
from app.core import app, db
from app.models.room_member import RoomMember
from app.models.user import User
from app.models.room import Room
from app.models.pin import Pin
with app.app_context():
db.drop_all()
with app.app_context():
db.create_all()
with app.app_context():
user1 = User(
name = 'kido',
password = 'ryuuki1111',
uuid = '551nikuman'
)
user2 = User(
name = 'asakura',
password = 'oujya5555',
uuid = 'linebot12'
)
user3 = User(
name = 'morimoto',
password = 'forestbook',
uuid = 'kamenrider'
)
user4 = User(
name = 'xiao',
password = 'shou0417',
uuid = 'wind'
)
user5 = User(
name = 'itoho',
password = 'kindai',
uuid = 'hardware'
)
db.session.add(user1)
db.session.add(user2)
db.session.add(user3)
db.session.add(user4)
db.session.add(user5)
room1 = Room(
room_number = '1',
user_id = '1'
)
db.session.add(room1)
room_member1 = RoomMember(
room_id = '1',
user_id = '2'
)
room_member2 = RoomMember(
room_id = '1',
user_id = '3'
)
room_member3 = RoomMember(
room_id = '1',
user_id = '4'
)
db.session.add(room_member1)
db.session.add(room_member2)
db.session.add(room_member3)
pin1 = Pin(
uuid= 'commit33',
altitude = '21.0',
longuitude ='35.0012',
latitude ='135.123',
type = 'enemy',
user_id = '1',
room_id = '1'
)
pin2 = Pin(
uuid= 'commit44',
altitude = '42.0',
longuitude ='70.0024',
latitude ='270.246',
type = 'go',
user_id = '2',
room_id = '1'
)
pin3 = Pin(
uuid= 'commit55',
altitude = '84.0',
longuitude ='140.0048',
latitude ='540.492',
type = 'go',
user_id = '3',
room_id = '1'
)
pin4 = Pin(
uuid= 'commit66',
altitude = '168.0',
longuitude ='280.0096',
latitude ='1080.984',
type = 'defend',
user_id = '4',
room_id = '1'
)
db.session.add(pin1)
db.session.add(pin2)
db.session.add(pin3)
db.session.add(pin4)
db.session.commit()