Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insert field to fieldMap #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

ugurcandede
Copy link
Owner

In this branch, adds a field to fieldMap

fieldMap["ts.scope"] = {"id": 123, "value": 20, "type": "SELECT", "order": 1, "name": "TICKET"}

This query can be used to generate the result.json file from the database.

  • First execute this SQL command to get schema_names for all tenants.
SELECT 'SELECT jsonb_object_agg(foo.tenantid, foo.json) FROM(' || string_agg('(select ''' || mt.schema_name ||''' as tenantId, fdeo.id as json from ' || mt.schema_name || '.field_definition fd LEFT JOIN ' || mt.schema_name || '.field_definition_entity_options fdeo on fd.id = fdeo.field_definition_entity_id WHERE fd.key = ''ts.scope'' AND fdeo.label = ''TICKET'')', ' UNION ') || ')as foo' || ';' from main.tenant mt;
  • Copy generated SQL query string and execute with \gexec command using psql

SELECT 'SELECT jsonb_object_agg(foo ................. from main.tenant mt \gexec

  • Then copy result and paste it to result.json file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant