storeness / meteor-postgres

Postgres Collections for Meteor
48 stars 7 forks source link

Use pre-existing PostgresSQL data and schema #2

Open sebastiandanilonr opened 9 years ago

sebastiandanilonr commented 9 years ago

Hello and thanks for this repo. It's possible to retrieve info for an existing postgres database (preexisting tables, function,etc)? I have a postgres database and i want to show the already existing info on a angular-meteor based app using this package.

UPDATE: I read that i can´t use pre-existing tables because they don´t have triggers. It's possible to add the triggers directly on postgres and make it work?

Thanks for your help.

MichaelHirn commented 9 years ago

Hi @sebastiandanilonr

Is it possible to receive infos about the db/tables? Sadly no, the underlying ORM is really hacky and we should switch it to a mature one like sequelize. But there are emerging some problems as well, you can check our thoughts on this here: https://github.com/storeness/sql

Is it possible to add triggers to an pre-existing table? I think so (not tried yet), but I can't see why it shouldn't work. You can see the code that gets used to set up the table with all the triggers, here: https://github.com/storeness/meteor-postgres/blob/master/packages/meteor-postgres/lib/server.coffee#L64-L81

You can call those on your table directly or you can flash out the specific parts of the query into individual methods.