Adding new columns to database tables

I’m creating a ghost theme and I want to add a new column to the products (tiers) table and member tables, I’ve added the migrations successfully to “…/versions/5.24/” and it runs without any errors when ghost start but the JSON response from ghost Admin API does not include the columns I added. When I view the database with a GUI tool like DB browser(SQLite) I see the columns are present in the tables but I can’t read or insert data from it via the admin API. Any ideas on how I can solve this?

You might be missing changing the schema files?

At the risk of being picky, however, you aren’t making a theme. That’s a fork of the Ghost core. Nothing wrong with that — maybe that’s exactly what you need — but the result won’t be a theme that others can install easily.

Thanks for your response, so there are two things: First, it is a theme I am trying to make, I didn’t fork ghost core. Although that’s the option I’m considering right now since nothing else seems to work and I think that’s because the tier service which controls the creating and updating tiers imports a class from @tryghost/tier npm package and that basically does not include the new property I added to the table (This is just my theory of what could be the cause).
Secondly, I did change the schema and model as well but nothing worked

Changing the database columns is not a theme in the traditional Ghost sense! That language is going to be confusing for non technical users, so I’ll respectfully suggest you not describe this project as a theme.

Sounds cool though! I’m curious what you’re building!

1 Like

Ohh I see, I did not know that. Thanks for pointing that out, I’ll take note of that. I’m curious to know the boundaries of what constitutes a Ghost theme though, so I don’t misconstrue things like this in the future.
I’m building an integration with a web3 protocol called Unlock Protocol which is a protocol for memberships. The goal is to allow publishers to leverage some of the membership features of Unlock using Ghost.
I don’t know if there’s a better way to implement this but this route is the best I could think of, essentially I want a solution others can use easily.

A Ghost theme is a .zip file that a user can load onto the site using the /ghost settings menu. It controls all the layout parts, and a bunch of the logic (which posts are on which page, in what order), but a theme doesn’t modify the structure of the database.

I suspect that looking in ghost/core in the api folder is probably a good starting point for your problem. Sorry I can’t help more - maybe someone who has worked in the core will come through and help you out!

1 Like

I hope so too. Thanks a lot