Script for setting up database user, schema, and seed data.

This script is for bootstrapping the initial database. It can be run via
a container, but requires that a Postgres superuser's credentials be
provided via our normal config. That way the superuser can provision a
less-privileged user for the application's database connection.
This commit is contained in:
dandds
2020-01-23 06:25:35 -05:00
parent 49edd028a0
commit 49a1a219ae
3 changed files with 88 additions and 3 deletions

View File

@@ -93,10 +93,13 @@ class Users(object):
return user
@classmethod
def give_ccpo_perms(cls, user):
def give_ccpo_perms(cls, user, commit=True):
user.permission_sets = PermissionSets.get_all()
db.session.add(user)
db.session.commit()
if commit:
db.session.commit()
return user
@classmethod