How to aproach existing db #2321
-
What is the best way of adding something like a pgx connection for querying a existing postgres database?. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
OK, what I understood regarding your main point is that you don't want to create/manage new database tables using Buffalo's database management features such as migration but just want to use your existing database tables as a data store for the models of your app. Is it correct? It could be simple. Let's see the typical workflow of developing an application with Buffalo briefly.
These are typical steps but in your situation, the database and tables already exist so you don't want to go through step 4. So just skip that step. That's totally fine. Some more things to be considered are:
That's all! However, if you are not familiar with Buffalo's behavior yet, starting with the pure Buffalo app as a learning material could be the best solution. Once you understand how the Buffalo app interacts with the database, developing an app with an existing database is not a hard thing. I think this document is a good starting point to an understanding of the model. https://gobuffalo.io/documentation/database/models/ --- original content of this comment --- |
Beta Was this translation helpful? Give feedback.
-
I want to use it with the --api flag to do a simple rest api querying a existing postgres db. And a the same time learn the language. Im aware that i probably dont need to use buffalo but i want to try it anyways. |
Beta Was this translation helpful? Give feedback.
OK, what I understood regarding your main point is that you don't want to create/manage new database tables using Buffalo's database management features such as migration but just want to use your existing database tables as a data store for the models of your app. Is it correct? It could be simple. Let's see the typical workflow of developing an application with Buffalo briefly.
buffalo new app ....
, and go into the app's directory.database.yml
with the access parameters such as user, password, host, port, etc.