How do i auto update backend from postgres schema

I added 5 more tables to my existing connected database, how do make it show up in the existing dashboard?

It seem’s like the correct way to do this would be manually editing .forestadmin-schema.json? But that seems like a lot of work given total number of tables I added is around 10 if you consider joining tables for many2many relationships.

Another way would be to generate another project using lumber-cli but that doesn’t seem like a recommended approach.

Let me know if I am missing anything here :slight_smile:

Hi @BK42,

The recommended approach to add new tables to an existing lumber generated project is to define the models related to the new tables manually in the models directory of your project (attributes and relationships).
Once done properly, your server restart in your development environment should automatically update the .forestadmin-schema.json. By the way this file is automatically generated and you should never edit it manually, more about that here.

If the manual creation of the new models seems to be to much work, you can create a new temporary “draft” project based on the same database connection URL with lumber generate.
The new project repository should contain the old and new tables models. Then you just have to copy-paste the models directory from the draft project to your current one.
Be sure that the changes won’t erase manual update you’ve done in your current project and then you’re good to commit the new models and .forestadmin-schema.json.

Hope it helps.

3 Likes

Just wanted to take a moment to say that I am in awe of what you have build (ignoring rough edges because it is still early) and keep on keeping on :slight_smile:

I like the idea of creating “draft” project. Because, I am process of creating/migrating to database out of old data store so I am adding lots of new tables everyday.

Is there easy way to create draft project without adding new project to UI and hence polluting your DB?
Because as per my screenshot below.:

  1. I don’t see a way to generate “draft” project without giving a new project name
  2. I don’t want to create a pollution on frontend by having 10’s of draft projects.

Hi @BK42,

Depending on how many tables you’re intending to add and at what frequency I see 3 options for you:

  • If you can create the all DB tables before hand, you’d have to do only one “draft project” to populate the models.
  • If you can add a lot of those tables and only add a couple more after that, I’d recommend doing one draft project and then manually create the missing models (if there ain’t many that might be quicker that doing a draft project project)
  • If you want to iterate a lot and have batch of several tables at each time, then you’ll need to create a lot of draft (and so, pollution). But it is to be noted that you can clean those drafts directly from the UI to keep both our DB and the list of your project on a sane state. This is achieved by dropping the draft project by clicking on the trash icon when sliding your mouse over a project:

I do hope those steps will fit you need!

1 Like