init.sql 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. -- Creates initial entries for a workspace and adds some collections and requests to it.
  2. -- Creates an environment.
  3. INSERT INTO workspaces(id, name) VALUES (0, 'My workspace');
  4. INSERT INTO workspace_envs(id, workspace_id, name) VALUES (0, 0, 'My env');
  5. -- JSON responses and simple nesting
  6. INSERT INTO
  7. workspace_env_variables(id, workspace_id, env_id, name, value, secret)
  8. VALUES(0, 0, 0, 'BASE_URL', 'https://jsonplaceholder.typicode.com', false);
  9. INSERT INTO
  10. workspace_entries(id, workspace_id, parent_id, name, type)
  11. VALUES (0, 0, NULL, 'My collection', 1);
  12. INSERT INTO
  13. workspace_entries(id, workspace_id, parent_id, name, type)
  14. VALUES
  15. (1, 0, 0, 'My request in col', 0),
  16. (2, 0, NULL, 'My request', 0);
  17. INSERT INTO
  18. request_params(workspace_id, request_id, method, url)
  19. VALUES
  20. (0, 1, 'GET', '{{BASE_URL}}/posts/:ID'),
  21. (0, 2, 'GET', '{{BASE_URL}}/todos/:ID');
  22. INSERT INTO request_path_params(position, request_id, name, value)
  23. VALUES
  24. (18, 1, 'ID', '1'),
  25. (18, 2, 'ID', '1');
  26. INSERT INTO request_headers(request_id, name, value) VALUES(1, 'accept', '*/*');
  27. -- Hardcore nesting
  28. INSERT INTO
  29. workspace_entries(id, workspace_id, parent_id, name, type)
  30. VALUES
  31. (3, 0, 0, 'Beginning of the nesting', 1),
  32. (4, 0, 3, 'Continuation of the nesting', 1),
  33. (5, 0, 4, 'Beginning of hardcore nesting', 1),
  34. (6, 0, 5, 'This one is really nested and has a long name', 1),
  35. (7, 0, 6, 'The finally nested requested request', 0);
  36. INSERT INTO
  37. request_params(workspace_id, request_id, method, url)
  38. VALUES
  39. (0, 7, 'GET', 'https://codemirror.net/examples/readonly/');