Does trying to work directly with postgres database is completely insane attempt

(Admir Hodzic) #1

I am mostly DBA and from time to time .NET developer.
What I want to try is to develop man-in-middle between Discourse instance and DotNetNuke user portal.
Propose for that piece of software is to sync user-groups from DNN to Discourse.
I did attach discource to DNN over SSO so I have strong reference between users at DNN and users at Discourse.
I want to send groups (roles at DNN) form DNN to Discourse.
Also I want to send user’s belonging to groups from DNN to Discourse.
Since I am most comfortable doing things on db layer I did open postgres access on discource and with “PG Admin” start looking at tables.
From my perspective of view I only need three tables to work with at discourse.

public.single_sign_on_records (read only)

I did start .net project using libraries for postgres .
So far things looks promising I get data from discource without problems,
also I am able to do update or insert records at discource.

Before I continue spending more time on my project,
Can you please give me any guidelines is there something that I should be extra careful.

I saw that PK at tables are Int with auto increments.
I am planing to let postgresql generating ID-s.

I did not explore yet with about encoding
Any suggestions on that ?
How I should encode my strings before I send them to discourse ?

I know that there is many pitfalls when you going to database directly avoiding all APIS and others.
But this is most comfortable way to me.

Do I need to edit any other tables if I change something at these two I already mentioned ?

I am planing to make my project open source so any suggestions is gladd.
I know that @Stackfish also using DNN as SSO provider for their Discourse if you get interesting please ping so we can share experiences and code.

Using the REST API with other languages
(Régis Hanol) #2

To answer the question in your title: YES

I highly suggest that you work with the API rather than poking directly at the database. That way, you’ll be sure everything will always be consistent (even if we change business rules).

I know, being a DBA, you feel comfortable working and messing with SQL all day, but, trust me, you will regret it. It’s better to suck it up now and do some work to learn how to API works.