# Dgman - Dgraph Schema Manager and Helper

**URL:** <https://discuss.dgraph.io/t/dgman-dgraph-schema-manager-and-helper/3769>\
**Category:** Dgraph\
**Created:** [December 15, 2018, 8:52am UTC](https://discuss.dgraph.io/t/dgman-dgraph-schema-manager-and-helper/3769 "2018-12-15T08:52:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![wildan2711](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/wildan2711/32/1320_2.png) [@wildan2711](https://discuss.dgraph.io/u/wildan2711)\
**Post date:** [December 15, 2018, 8:52am UTC](https://discuss.dgraph.io/t/dgman-dgraph-schema-manager-and-helper/3769/1 "2018-12-15T08:52:37Z")

</div>

Hey guys, we want to inform about a library we created for a more rapid development using Dgraph.

[Dgman](https://github.com/dolan-in/dgman) is a schema manager for Dgraph using the Go Dgraph client (dgo), which manages Dgraph schema and indexes from Go tags in struct definitions

## Features

- Create schemas and indexes from struct tags.
- Detect conflicts from existing schema and defined schema.
- Autoinject [node type](https://docs.dgraph.io/howto/#giving-nodes-a-type) from struct.
- Field unique checking (e.g: emails, username).
- Query helpers.

[We](https://github.com/dolan-in) are a startup that is looking to use Dgraph in production, and planning to release some time next year.

This is our first open source project, so some heavy criticism are welcome 😉. Thank you and we hope this library is useful for the community.

---

<div class="post-metadata">

**Author:** ![tlmichael](https://avatars.discourse-cdn.com/v4/letter/t/97f17d/32.png) [@tlmichael](https://discuss.dgraph.io/u/tlmichael)\
**Post date:** [December 16, 2018, 5:48am UTC](https://discuss.dgraph.io/t/dgman-dgraph-schema-manager-and-helper/3769/2 "2018-12-16T05:48:26Z")

</div>

Very cool, I’d appreciate if you bumped the thread if/when you add support for deleting the data. I’ve always found the process of deleting a node and all its edges to be the most frustrating part, so I’d be curious to see how you would handle it (:

---

<div class="post-metadata">

**Author:** ![AugustHell](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/augusthell/32/1417_2.png) [@AugustHell](https://discuss.dgraph.io/u/AugustHell)\
**Post date:** [January 12, 2019, 9:53pm UTC](https://discuss.dgraph.io/t/dgman-dgraph-schema-manager-and-helper/3769/3 "2019-01-12T21:53:11Z")

</div>

I used this library the last days for getting a mysql database converted to dgraph and it helped me a lot.  
For rapid devolpment of a new project, it would be cool if dgman would able to mutate the schema, maybe with another function or a non-default option to do so. If you come from a sql world like me, creating relations like 1:n, n:n in dgraph have mutliple ways to do it 😄 . So designing the data model I often changed just the index option like term/hash or adding @reverse.  
Another thing related to the data modeling: Having a lot of tables to convert and getting errors back in some cases with no mention to the source (eg protocol errors), I ended up with doing CreateSchema for every node type extended with info about it.  
Despite of this small isues, Dgman was easy to use for me and I think it’s a good start up tool for getting a new project to run, thank you 😉

---

<div class="post-metadata">

**Author:** ![wildan2711](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/wildan2711/32/1320_2.png) [@wildan2711](https://discuss.dgraph.io/u/wildan2711)\
**Post date:** [January 14, 2019, 3:55pm UTC](https://discuss.dgraph.io/t/dgman-dgraph-schema-manager-and-helper/3769/4 "2019-01-14T15:55:20Z")

</div>

@tlmichael Thanks! yes, deleting is quite cumbersome, still figuring out how to make it simple.

@AugustHell Thanks! Great to know this library is of help.

Yeah, we thought of adding for updating the schema, the first doubt was for indexes, an update would require reindexing, we had troubles with those before. Maybe, when there is little data it would not be a problem. We’ll add it probably.

Can you share what protocol errors did you get? Thanks.

---

<div class="post-metadata">

**Author:** ![AugustHell](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/augusthell/32/1417_2.png) [@AugustHell](https://discuss.dgraph.io/u/AugustHell)\
**Post date:** [January 16, 2019, 9:06am UTC](https://discuss.dgraph.io/t/dgman-dgraph-schema-manager-and-helper/3769/5 "2019-01-16T09:06:20Z")

</div>

Here it is:  
“rpc error: code = Unknown desc = Undefined Type”

happens when you try to create a schema with a 1:1 relation (which is a issue and not supported), like:

```auto
type Webproject struct {
	UID string `json:"uid,omitempty"`
	Name string `json:"webproject.name,omitempty" dgraph:"index=hash"`
	Server string `json:"webproject.server,omitempty" dgraph:"index=hash"`
	IP string `json:"webproject.ip" dgraph:"index=hash"`
	Domain Domain `json:"webproject.domain"`
}

```

“Keyboard not found, press any key to continue…” 😁

---

<div class="post-metadata">

**Author:** ![wildan2711](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/wildan2711/32/1320_2.png) [@wildan2711](https://discuss.dgraph.io/u/wildan2711)\
**Post date:** [January 21, 2019, 6:07pm UTC](https://discuss.dgraph.io/t/dgman-dgraph-schema-manager-and-helper/3769/6 "2019-01-21T18:07:58Z")

</div>

Just released v0.4.1 that supports updating schema index with the `MutateSchema` function. We added a workaround for the above protocol errors by parsing field with Struct types to `uid`, just a fallback though, as you said with 1:1 relations, I agree that it is not supported.

---

<div class="post-metadata">

**Author:** ![AugustHell](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/augusthell/32/1417_2.png) [@AugustHell](https://discuss.dgraph.io/u/AugustHell)\
**Post date:** [January 22, 2019, 11:08am UTC](https://discuss.dgraph.io/t/dgman-dgraph-schema-manager-and-helper/3769/7 "2019-01-22T11:08:48Z")

</div>

Nice, thank you, that is helpful 😉

---

<div class="post-metadata">

**Author:** ![wildan2711](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/wildan2711/32/1320_2.png) [@wildan2711](https://discuss.dgraph.io/u/wildan2711)\
**Post date:** [February 26, 2019, 4:44pm UTC](https://discuss.dgraph.io/t/dgman-dgraph-schema-manager-and-helper/3769/8 "2019-02-26T16:44:56Z")

</div>

Hey guys, we released a new version that adds delete helpers using a query. [Check it out](https://github.com/dolan-in/dgman#delete-helper) 😉
