# Tips, patterns, approaches for migrating away from database-driven website

**URL:** <https://discourse.gohugo.io/t/tips-patterns-approaches-for-migrating-away-from-database-driven-website/30245>\
**Category:** support\
**Created:** [December 27, 2020, 10:24pm UTC](https://discourse.gohugo.io/t/tips-patterns-approaches-for-migrating-away-from-database-driven-website/30245 "2020-12-27T22:24:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnmckinzie](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/johnmckinzie/32/13116_2.png) [@johnmckinzie](https://discourse.gohugo.io/u/johnmckinzie)\
**Post date:** [December 27, 2020, 10:24pm UTC](https://discourse.gohugo.io/t/tips-patterns-approaches-for-migrating-away-from-database-driven-website/30245/1 "2020-12-27T22:24:35Z")

</div>

For quite a while now, I’ve been looking to migrate from CakePHP/MySQL-based implementation to a static-site generated approach, preferably Hugo. I’ve been racking my brain on how to leverage posts, front matter, and data files to represent some of the data type relationships. It’s a record label website, so it’s not terribly complex. Here are a few examples of data types and their relationships:

- Bands: has many Releases, has many Members, has many Events
- Release: has many Tracks
- Tracks: belongs to many Releases, has many Bands
- Event: has many Bands

Am I asking too much Hugo’s “Content Management” model?

Also, I have been looking at Contentful to manage the data/relationships and then generate the Markdown/down files as part of a CI step before I run Hugo to generate the site.

Any help or guidance would be appreciate. Just trying to find the right tool and approach for the job.

---

<div class="post-metadata">

**Author:** ![GothSeiDank](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/gothseidank/32/13028_2.png) [@GothSeiDank](https://discourse.gohugo.io/u/GothSeiDank)\
**Post date:** [December 27, 2020, 11:31pm UTC](https://discourse.gohugo.io/t/tips-patterns-approaches-for-migrating-away-from-database-driven-website/30245/2 "2020-12-27T23:31:05Z")

</div>

You can easily do this with JSON files:

```auto
{
        "Ancient Bards":
        {
            "active_since": "2006",
            "active": true,
            "albums": [
                "AncientBards/AllianceOfKings.json", "SoullessChild.json"
            ],
            "events": "AncientBards/events.json"
        }
 }

```

Then, in AllianceOfKings.json:

```auto
    
        {
            "name": "Alliance of Kings"
            "tracks":[
                "Song1",
                "Song2"
            ]
        }
   

```

And so on. It is a bit of work, but not impossible.  
You can then load these into Hugo during generation.

---

<div class="post-metadata">

**Author:** ![johnmckinzie](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/johnmckinzie/32/13116_2.png) [@johnmckinzie](https://discourse.gohugo.io/u/johnmckinzie)\
**Post date:** [December 27, 2020, 11:36pm UTC](https://discourse.gohugo.io/t/tips-patterns-approaches-for-migrating-away-from-database-driven-website/30245/3 "2020-12-27T23:36:23Z")

</div>

I really appreciate the quick response. Let me play around with it and see how it goes. I might not need all those relationships going forward. It was a side project to learn CakePHP for I might have over designed the object relationships.

---

<div class="post-metadata">

**Author:** ![yaythomas](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/yaythomas/32/12334_2.png) [@yaythomas](https://discourse.gohugo.io/u/yaythomas)\
**Post date:** [December 28, 2020, 12:04pm UTC](https://discourse.gohugo.io/t/tips-patterns-approaches-for-migrating-away-from-database-driven-website/30245/4 "2020-12-28T12:04:03Z")

</div>

funnily enough, the Hugo docs example on data templates involves discographies. . . [https://gohugo.io/templates/data-templates/#example-jaco-pastorius-solo-discography](https://gohugo.io/templates/data-templates/#example-jaco-pastorius-solo-discography)

depending on your data, taxonomies might also serve the purpose in some instances. [https://gohugo.io/content-management/taxonomies](https://gohugo.io/content-management/taxonomies). But in this case you’re going to have to get away from thinking in “relational db” terms and work with intersecting content hierarchies instead.

---

<div class="post-metadata">

**Author:** ![johnmckinzie](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/johnmckinzie/32/13116_2.png) [@johnmckinzie](https://discourse.gohugo.io/u/johnmckinzie)\
**Post date:** [December 29, 2020, 3:26am UTC](https://discourse.gohugo.io/t/tips-patterns-approaches-for-migrating-away-from-database-driven-website/30245/5 "2020-12-29T03:26:29Z")

</div>

I took a look at that example, but it didn’t seem to map well to what I was doing. I’ll take another look at the taxonomy page. Thanks for the suggestion!
