Skip to content

Commit

Permalink
[master][noticket][s]: CLI command to check version of db.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Read committed Jan 17, 2012
1 parent 814b468 commit 93f24f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions ckan/lib/cli.py
Expand Up @@ -62,6 +62,7 @@ class ManageDb(CkanCommand):
db init # create and put in default data
db clean
db upgrade [{version no.}] # Data migrate
db version # returns current version of data schema
db dump {file-path} # dump to a pg_dump file
db dump-rdf {dataset-name} {file-path}
db simple-dump-csv {file-path}
Expand Down Expand Up @@ -100,6 +101,8 @@ def command(self):
model.repo.upgrade_db(self.args[1])
else:
model.repo.upgrade_db()
elif cmd == 'version':
self.version()
elif cmd == 'dump':
self.dump()
elif cmd == 'load':
Expand Down Expand Up @@ -248,6 +251,10 @@ def send_rdf(self):
talis = ckan.lib.talis.Talis()
return talis.send_rdf(talis_store, username, password)

def version(self):
from ckan.model import Session
print Session.execute('select version from migrate_version;').fetchall()


class SearchIndexCommand(CkanCommand):
'''Creates a search index for all datasets
Expand Down
4 changes: 2 additions & 2 deletions ckan/model/authz.py
Expand Up @@ -208,7 +208,7 @@ def add_authorization_group_to_role(cls, authorization_group, role, domain_obj):
commit, will add the role to the database twice. Since some other
functions count the number of occurrences, that leaves a fairly obvious
bug. But adding a commit here seems to break various tests.
So don't call this twice without committing, I guess...
So don\'t call this twice without committing, I guess...
'''
if cls.authorization_group_has_role(authorization_group, role, domain_obj):
return
Expand Down Expand Up @@ -355,7 +355,7 @@ def give_all_packages_default_user_roles():
print 'Creating default user for for %s with admins %s' % (pkg.name, admins)
setup_default_user_roles(pkg, admins)

# default user roles - used when the config doesn't specify them
# default user roles - used when the config doesn\'t specify them
default_default_user_roles = {
'Package': {"visitor": ["editor"], "logged_in": ["editor"]},
'Group': {"visitor": ["reader"], "logged_in": ["reader"]},
Expand Down

0 comments on commit 93f24f3

Please sign in to comment.