forked from fedora-infra/fmn.web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
createdb.py
executable file
·39 lines (34 loc) · 1.27 KB
/
createdb.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
#!/usr/bin/env python
import sys
import fedmsg.config
import fmn.lib.models
config = fedmsg.config.load_config()
uri = config.get('fmn.sqlalchemy.uri')
if not uri:
raise ValueError("fmn.sqlalchemy.uri must be present")
if '-h' in sys.argv or '--help'in sys.argv:
print "createdb.py [--with-dev-data]"
sys.exit(0)
session = fmn.lib.models.init(uri, debug=True, create=True)
if '--with-dev-data' in sys.argv:
context1 = fmn.lib.models.Context.create(
session, name="irc", description="Internet Relay Chat",
detail_name="irc nick", icon="user",
placeholder="z3r0_c00l",
)
context2 = fmn.lib.models.Context.create(
session, name="email", description="Electronic Mail",
detail_name="email address", icon="envelope",
placeholder="[email protected]",
)
context3 = fmn.lib.models.Context.create(
session, name="android", description="Google Cloud Messaging",
detail_name="registration id", icon="phone",
placeholder="laksdjfasdlfkj183097falkfj109f"
)
context4 = fmn.lib.models.Context.create(
session, name="desktop", description="fedmsg-notify",
detail_name="None", icon="console",
placeholder="There's no need to put a value here"
)
session.commit()