apstanisic / zmaj

Zmaj is a headless CMS for managing database
https://zmaj.vercel.app
MIT License
5 stars 0 forks source link

Allow code only mode #60

Open apstanisic opened 1 year ago

apstanisic commented 1 year ago

Creating schema with GUI complicates migration a lot, it's harder to create data without autocomplete.

Using GUI is only easier for non developers, but usually non developers should not touch database. Since Zmaj already has support for migrations, only thing to enable code models is to allow users to pass collections directly. Then I can even allow functions to be attached to them, since they don't have to be a valid json anymore. It should be more like Laravel Nova.

Summarized: Allow user to pass CollectionDef, and provide settings to enable/disable managing db, and settings should we generate missing collections.

Something like

await runServer({
  collections: [myPostCollection],
  managingDb: {
    allowChangingDb: true,
    autoGenerateMissingCollections: true
  }
})
apstanisic commented 1 year ago

Defining models