Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Add a migration to load users and buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
robyoung committed Oct 7, 2013
1 parent d5d43d1 commit 6f2529d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions migrations/004_load_seed_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
Load initial user and bucket data from seed files.
"""
import logging
import os
import subprocess
import sys

log = logging.getLogger(__name__)


def up(db):
names = db.collection_names()

if "users" in names:
log.info("users collection already created")
return

if "buckets" in names:
log.info("buckets collection already created")
return

invoke = os.path.join(os.path.dirname(sys.executable), "invoke")
subprocess.call([invoke, "load_seed"])

1 comment on commit 6f2529d

@tombooth
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if buckets or users already should exist should be if buckets and users exist. If somehow only one got created (script broke or something) then the other will never be added to join it.

Please sign in to comment.