paljs / prisma-tools

Prisma tools to help you generate CRUD system for GraphQL servers
https://paljs.com
MIT License
687 stars 55 forks source link

Add support to configure different database types #198

Open divideby0 opened 3 years ago

divideby0 commented 3 years ago

I've found the built-in support for SQLite is a great way to get started. But more often than not, my team is building apps that talk to Postgres or other remote databases. So, along with all the other project setup options, I'm proposing an additional option to choose your target database:

$ npx @paljs/cli create
.______      ___       __             __       _______.
|   _  \    /   \     |  |           |  |     /       |
|  |_)  |  /  ^  \    |  |           |  |    |   (----`
|   ___/  /  /_\  \   |  |     .--.  |  |     \   \
|  |     /  _____  \  |  `----.|  `--'  | .----)   |
| _|    /__/     \__\ |_______| \______/  |_______/

✔ Please select your start example · full-stack-nextjs
✔ Please select your start framework · Material UI
? Please select your target database...
  sqlite
❯ postgresql
  mysql

In practice, I imagine this functionality would work similarly to the way one would bootstrap a project in Prisma 1, when it prompted you with the option to create a new database. If you chose that option, I believe it then prompted you for which type of database you'd like to create. And then, based on that choice, it would create a docker-compose.yml file to run that database in a container. I believe pal c will always create a new database, so the simplest approach might be to just give the user an option of the type.

Eventually, it might also be helpful to ask the user for a connection string, but that's simple enough to change that we may not need to do it right away

AhmedElywa commented 3 years ago

Interesting feature