Open tbenst opened 4 years ago
@tbenst could you elaborate a bit on the use case you would like to have this feature for? Is there a specific reason why you prefer GraphQL mutations over SQL in migrations?
@marionschleifer, well, I’d like to use it for the same reason why someone might want to use hasura or GraphQL in the first place: it’s easy for me to write a single GraphQL mutation, and much harder to write the 6 separate insertion SQL command for each logical datapoint
For example, insertions with UUIDs are painful. This would be trivial with GraphQL.
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
DO $$
DECLARE
firstUuid uuid = uuid_generate_v4();
secondUuid uuid = uuid_generate_v4();
BEGIN
INSERT INTO Entities (id, "type", str) VALUES
(firstUuid, 'fish', 'Tg(HuC:GCaMP6f)');
INSERT INTO Entities (id, type, date) VALUES
(secondUuid, 'date',
'2020-01-28 10:00:00-08');
INSERT INTO Relations (fromEntity, relation, toEntity) VALUES
(firstUuid, 'hasDOB', secondUuid);
END $$;
Hi, thanks for this awesome server! I’m currently using SQL in migrations to seed the database. I’d love if I could use a GraphQL mutation instead. Let me know if I missed this in the documentation?
If not, I’d like to request this feature. Thank you!