I have lots of services which I am integrating. (also I am new to sql)
For each service integration I get different response,
For example, for zoom, I would just need to store the access_Token, for github, I would need to store the access_token and organization_idand asana would have something like "workspace_gid" and token.
Should we create a seperate table for each service asana, github, jira or is it better to have single table with clauses? Can someone help me with pros and cons of having single table vs multi-table?
Multiple Table
With Multiple Table, I can enforce the columns to have value when saving into Db.
create table "public"."service_asana" ( "id" bigint generated by default as identity not null, "created_at" timestamp with time zone default now(), "workspace_id" bigint not null, "token" text not null, "workspace_gid" text not null default ''::text, "auto_invite" boolean not null default false, "last_synced" timestamp with time zone, "sync_status" service_sync_status ); create table "public"."service_docusign" ( "id" bigint generated by default as identity not null, "created_at" timestamp with time zone default now(), "workspace_id" bigint not null, "token" text not null, "org" text not null default ''::text, "account_id" text not null, "permission_id" text not null, "auto_invite" boolean not null default false, "last_synced" timestamp with time zone, "sync_status" service_sync_status );
but things like permission_id
and account_id
, I am never going to sort or query things on them
Single Table,
The other approach I was thinking about is to store service data in column as in JSON format.
Which one is more recommended. Also, in single Table, even auth token should be inside JSON? because I am never gonna query on that. Alternatively, Is there any better approach?