add schema-dump command, fix imports

This commit is contained in:
roadscape 2019-07-23 12:46:12 -05:00
parent 42fcb9843c
commit 790eb1d263
3 changed files with 7 additions and 2 deletions

View File

@ -34,6 +34,10 @@ serve-local:
db-head-state:
curl -H 'Content-Type: application/json' -d '{"id":1,"jsonrpc":"2.0","method":"db_head_state"}' http://localhost:8080
.PHONY: dump-schema
dump-schema:
pg_dump -s -x --use-set-session-authorization hivepytest | sed -e '/^--/d' | awk -v RS= -v ORS='\n\n' '1' > schema.sql
ipython:
docker run -it $(PROJECT_DOCKER_RUN_ARGS) $(PROJECT_DOCKER_TAG) ipython

View File

@ -12,7 +12,6 @@ from hive.utils.normalize import rep_log10, vests_amount
from hive.utils.timer import Timer
from hive.utils.account import safe_profile_metadata
from hive.utils.unique_fifo import UniqueFIFO
from hive.indexer.community import Community
log = logging.getLogger(__name__)
@ -80,6 +79,7 @@ class Accounts:
cls._ids[name] = _id
# post-insert: pass to communities to check for new registrations
from hive.indexer.community import Community
Community.register(new_names, block_date)
# account cache methods

View File

@ -8,7 +8,6 @@ import ujson as json
from hive.db.adapter import Db
from hive.indexer.accounts import Accounts
from hive.indexer.posts import Posts
log = logging.getLogger(__name__)
@ -311,6 +310,8 @@ class CommunityOp:
assert self.account, 'permlink requires named account'
_permlink = read_key_str(self.op, 'permlink')
assert _permlink, 'must name a permlink'
from hive.indexer.posts import Posts
_pid, _depth = Posts.get_id_and_depth(self.account, _permlink)
assert _pid, 'invalid post: %s/%s' % (self.account, _permlink)