forked from jonoxia/platform-game
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase_tables.py
More file actions
47 lines (40 loc) · 1.12 KB
/
database_tables.py
File metadata and controls
47 lines (40 loc) · 1.12 KB
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
#!/usr/bin/python
from sqlobject import *
import datetime
from platformer_config import DB_URL
connection = connectionForURI( DB_URL )
sqlhub.processConnection = connection
class Player(SQLObject):
email = StringCol()
name = StringCol()
session = StringCol()
avatarURL = StringCol()
class Level(SQLObject):
name = StringCol()
creator = ForeignKey("Player")
modified = DateTimeCol()
startX = IntCol(default = 0)
startY = IntCol(default = 0)
bgUrl = StringCol(default = "")
tilesetUrl = StringCol(default = "")
goalUrl = StringCol(default = "")
musicUrl = StringCol(default = "")
class LevelObject( SQLObject ):
level = ForeignKey("Level")
type = StringCol()
x = IntCol()
y = IntCol()
width = IntCol()
height = IntCol()
class Score( SQLObject ):
class sqlmeta:
defaultOrder = "completionTime"
level = ForeignKey("Level")
player = ForeignKey("Player")
completionTime = IntCol()
achievedOn = DateTimeCol()
if __name__ == "__main__":
Player.createTable()
Level.createTable()
LevelObject.createTable()
Score.createTable()