Skip to content

Commit

Permalink
chore: add a issue by user sample sheet (bytebase#13830)
Browse files Browse the repository at this point in the history
  • Loading branch information
tianzhou authored Sep 20, 2024
1 parent 95af4b6 commit 623acd5
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions backend/demo/data/default/dump.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2351,6 +2351,7 @@ INSERT INTO public.audit_log (id, created_ts, payload) VALUES (124, 1720666255,
INSERT INTO public.audit_log (id, created_ts, payload) VALUES (126, 1720669334, '{"user": "users/101", "method": "/bytebase.v1.SQLService/Query", "parent": "projects/project-sample", "request": "{\"name\":\"instances/prod-sample-instance/databases/hr_prod\", \"connectionDatabase\":\"hr_prod\", \"statement\":\"SELECT * FROM salary;\", \"limit\":1000}", "resource": "instances/prod-sample-instance/databases/hr_prod", "response": "{\"results\":[{\"columnNames\":[\"emp_no\", \"amount\", \"from_date\", \"to_date\"], \"columnTypeNames\":[\"INT4\", \"INT4\", \"DATE\", \"DATE\"], \"masked\":[false, true, false, false], \"sensitive\":[false, true, false, false], \"latency\":\"0.008754250s\", \"statement\":\"WITH result AS (\\nSELECT * FROM salary\\n) SELECT * FROM result LIMIT 1000;\"}], \"allowExport\":true}", "severity": "INFO"}') ON CONFLICT DO NOTHING;
INSERT INTO public.audit_log (id, created_ts, payload) VALUES (127, 1720669353, '{"user": "users/101", "method": "/bytebase.v1.SQLService/Query", "parent": "projects/project-sample", "request": "{\"name\":\"instances/prod-sample-instance/databases/hr_prod\", \"connectionDatabase\":\"hr_prod\", \"statement\":\"SELECT * FROM employee;\", \"limit\":1000}", "resource": "instances/prod-sample-instance/databases/hr_prod", "response": "{\"results\":[{\"columnNames\":[\"emp_no\", \"birth_date\", \"first_name\", \"last_name\", \"gender\", \"hire_date\"], \"columnTypeNames\":[\"INT4\", \"DATE\", \"TEXT\", \"TEXT\", \"TEXT\", \"DATE\"], \"masked\":[false, false, true, true, false, false], \"sensitive\":[false, false, true, true, false, false], \"latency\":\"0.010567041s\", \"statement\":\"WITH result AS (\\nSELECT * FROM employee\\n) SELECT * FROM result LIMIT 1000;\"}], \"allowExport\":true}", "severity": "INFO"}') ON CONFLICT DO NOTHING;
INSERT INTO public.audit_log (id, created_ts, payload) VALUES (128, 1721635756, '{"method": "/bytebase.v1.AuthService/Login", "parent": "workspaces/6c86d081-379d-4366-be6f-481425e6f397", "request": "{\"email\":\"demo@example.com\", \"web\":true}", "resource": "demo@example.com", "severity": "INFO"}') ON CONFLICT DO NOTHING;
INSERT INTO public.audit_log (id, created_ts, payload) VALUES (129, 1726820034, '{"user": "users/101", "method": "/bytebase.v1.SQLService/Query", "parent": "projects/metadb-project", "request": "{\"name\":\"instances/bytebase-meta/databases/bbdev\",\"statement\":\"SELECT\\n issue.creator_id,\\n principal.email,\\n COUNT(issue.creator_id) AS amount\\nFROM issue\\nINNER JOIN principal\\nON issue.creator_id = principal.id\\nGROUP BY issue.creator_id, principal.email\\nORDER BY COUNT(issue.creator_id) DESC;\",\"limit\":1000,\"dataSourceId\":\"777072ed-539e-4cc2-a41e-6cc2917a7e7c\"}", "resource": "instances/bytebase-meta/databases/bbdev", "response": "{\"results\":[{\"columnNames\":[\"creator_id\",\"email\",\"amount\"],\"columnTypeNames\":[\"INT4\",\"TEXT\",\"INT8\"],\"masked\":[false,false,false],\"sensitive\":[false,false,false],\"latency\":\"0.021570708s\",\"statement\":\"WITH result AS (\\nSELECT\\n issue.creator_id,\\n principal.email,\\n COUNT(issue.creator_id) AS amount\\nFROM issue\\nINNER JOIN principal\\nON issue.creator_id = principal.id\\nGROUP BY issue.creator_id, principal.email\\nORDER BY COUNT(issue.creator_id) DESC\\n) SELECT * FROM result LIMIT 1000;\"}],\"allowExport\":true}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:62138", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;


--
Expand Down Expand Up @@ -277060,7 +277061,7 @@ INSERT INTO public.policy (id, row_status, creator_id, created_ts, updater_id, u
INSERT INTO public.policy (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, payload, resource_type, resource_id, inherit_from_parent) VALUES (106, 'NORMAL', 101, 1699029852, 101, 1720668656, 'bb.policy.masking-rule', '{"rules": [{"id": "9dda9145-895e-451a-99d8-16254c4eb287", "condition": {"expression": "environment_id == \"test\""}, "maskingLevel": "NONE"}, {"id": "d188a226-5ed6-45cc-82e3-baa890a87962", "condition": {"expression": "classification_level in [\"1\"]"}, "maskingLevel": "NONE"}, {"id": "76356d81-6231-4128-9be7-2c549fc505f5", "condition": {"expression": "classification_level in [\"2\", \"3\"]"}, "maskingLevel": "PARTIAL"}, {"id": "1ddc47c9-6ab6-4760-accd-947bc1a5f155", "condition": {"expression": "classification_level in [\"4\"]"}, "maskingLevel": "FULL"}]}', 'WORKSPACE', 0, false) ON CONFLICT DO NOTHING;
INSERT INTO public.policy (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, payload, resource_type, resource_id, inherit_from_parent) VALUES (122, 'NORMAL', 101, 1722758657, 101, 1722758657, 'bb.policy.data-source-query', '{"adminDataSourceRestriction": "FALLBACK"}', 'ENVIRONMENT', 101, false) ON CONFLICT DO NOTHING;
INSERT INTO public.policy (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, payload, resource_type, resource_id, inherit_from_parent) VALUES (123, 'NORMAL', 101, 1722758657, 101, 1722758657, 'bb.policy.data-source-query', '{"adminDataSourceRestriction": "FALLBACK"}', 'ENVIRONMENT', 102, false) ON CONFLICT DO NOTHING;
INSERT INTO public.policy (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, payload, resource_type, resource_id, inherit_from_parent) VALUES (119, 'NORMAL', 1, 1721635577, 1, 1726805202, 'bb.policy.iam', '{"bindings": [{"role": "roles/workspaceDBA", "members": ["users/102", "users/103", "users/109"]}, {"role": "roles/workspaceAdmin", "members": ["users/101", "users/1"]}, {"role": "roles/workspaceMember", "members": ["allUsers"]}]}', 'WORKSPACE', 0, false) ON CONFLICT DO NOTHING;
INSERT INTO public.policy (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, payload, resource_type, resource_id, inherit_from_parent) VALUES (119, 'NORMAL', 1, 1721635577, 1, 1726819741, 'bb.policy.iam', '{"bindings": [{"role": "roles/workspaceDBA", "members": ["users/102", "users/103", "users/109"]}, {"role": "roles/workspaceAdmin", "members": ["users/101", "users/1"]}, {"role": "roles/workspaceMember", "members": ["allUsers"]}]}', 'WORKSPACE', 0, false) ON CONFLICT DO NOTHING;


--
Expand All @@ -277072,12 +277073,12 @@ INSERT INTO public.principal (id, row_status, creator_id, created_ts, updater_id
INSERT INTO public.principal (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, name, email, password_hash, phone, mfa_config, profile) VALUES (101, 'NORMAL', 1, 1699026391, 1, 1699026391, 'END_USER', 'Demo', 'demo@example.com', '$2a$10$aKjyVRxwbzmNToxYLXgTn.cQZX9x8KI1LLu5U69zzn5wcaoagoBLG', '', '{}', '{}') ON CONFLICT DO NOTHING;
INSERT INTO public.principal (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, name, email, password_hash, phone, mfa_config, profile) VALUES (102, 'NORMAL', 1, 1699028630, 101, 1699028932, 'END_USER', 'dba1', 'dba1@example.com', '$2a$10$mjuC.ej22zhysY3ylsR00eqFGVPxctD4RMZN7mio7GjhTFg5o6nPG', '', '{}', '{}') ON CONFLICT DO NOTHING;
INSERT INTO public.principal (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, name, email, password_hash, phone, mfa_config, profile) VALUES (103, 'NORMAL', 1, 1699028631, 101, 1699028941, 'END_USER', 'dba2', 'dba2@example.com', '$2a$10$UIKJY.ziyCuB0fIG.AkuBOlcPoYtzvVZZfm4Uh3OrgbF0VLTneUbC', '', '{}', '{}') ON CONFLICT DO NOTHING;
INSERT INTO public.principal (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, name, email, password_hash, phone, mfa_config, profile) VALUES (104, 'NORMAL', 1, 1699028631, 101, 1699028955, 'END_USER', 'dev1', 'dev1@example.com', '$2a$10$hX4vTGH7Id6v9BWhHHtW9uHT.M/ANZ25owa5J9m1tSS5qzlSCkjSu', '', '{}', '{}') ON CONFLICT DO NOTHING;
INSERT INTO public.principal (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, name, email, password_hash, phone, mfa_config, profile) VALUES (105, 'NORMAL', 1, 1699028631, 101, 1699028964, 'END_USER', 'dev2', 'dev2@example.com', '$2a$10$Fst2F8T3GCRKsLoAh5937.qkFVwsbygmu2FKriu0B1nQave1VKXQC', '', '{}', '{}') ON CONFLICT DO NOTHING;
INSERT INTO public.principal (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, name, email, password_hash, phone, mfa_config, profile) VALUES (106, 'NORMAL', 1, 1699028631, 101, 1699028972, 'END_USER', 'dev3', 'dev3@example.com', '$2a$10$b6X5Pk/Ffe7YtDTrJcqtKuP.e9OmdH3Kq9i/WaTUO9225Pud6yd/6', '', '{}', '{}') ON CONFLICT DO NOTHING;
INSERT INTO public.principal (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, name, email, password_hash, phone, mfa_config, profile) VALUES (107, 'NORMAL', 1, 1699028631, 101, 1699028978, 'END_USER', 'dev4', 'dev4@example.com', '$2a$10$ikN0OjIzqoCuOtR21FRtTuTS5LenyJSdonyL.VOphI9LDTgOQ6NcC', '', '{}', '{}') ON CONFLICT DO NOTHING;
INSERT INTO public.principal (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, name, email, password_hash, phone, mfa_config, profile) VALUES (108, 'NORMAL', 1, 1699109310, 1, 1699109310, 'END_USER', 'qa1', 'qa1@example.com', '$2a$10$tgPwB2JdZlyu2MD/W.IxluFMI8bM9IPgYSQYaQEIBYT0SO23QM5Iu', '', '{}', '{}') ON CONFLICT DO NOTHING;
INSERT INTO public.principal (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, name, email, password_hash, phone, mfa_config, profile) VALUES (109, 'NORMAL', 1, 1712736378, 1, 1712736378, 'SERVICE_ACCOUNT', 'ci', 'ci@service.bytebase.com', '$2a$10$qePzDv6q5r0fKv8cB.blpunqLw./sjcNgqARe8sOsB/.1NtvypFpK', '', '{}', '{}') ON CONFLICT DO NOTHING;
INSERT INTO public.principal (id, row_status, creator_id, created_ts, updater_id, updated_ts, type, name, email, password_hash, phone, mfa_config, profile) VALUES (104, 'NORMAL', 1, 1699028631, 1, 1726820189, 'END_USER', 'dev1', 'dev1@example.com', '$2a$10$hX4vTGH7Id6v9BWhHHtW9uHT.M/ANZ25owa5J9m1tSS5qzlSCkjSu', '', '{}', '{"lastLoginTime": "2024-09-20T08:16:29.553490Z"}') ON CONFLICT DO NOTHING;


--
Expand Down Expand Up @@ -277321,6 +277322,15 @@ INSERT INTO public.query_history (id, row_status, creator_id, created_ts, projec
INSERT INTO public.query_history (id, row_status, creator_id, created_ts, project_id, database, statement, type, payload) VALUES (124, 'NORMAL', 101, 1720669329, 'project-sample', 'instances/prod-sample-instance/databases/hr_prod', 'SELECT * FROM employee;', 'QUERY', '{"duration": "0.008848s"}') ON CONFLICT DO NOTHING;
INSERT INTO public.query_history (id, row_status, creator_id, created_ts, project_id, database, statement, type, payload) VALUES (125, 'NORMAL', 101, 1720669334, 'project-sample', 'instances/prod-sample-instance/databases/hr_prod', 'SELECT * FROM salary;', 'QUERY', '{"duration": "0.009147s"}') ON CONFLICT DO NOTHING;
INSERT INTO public.query_history (id, row_status, creator_id, created_ts, project_id, database, statement, type, payload) VALUES (126, 'NORMAL', 101, 1720669353, 'project-sample', 'instances/prod-sample-instance/databases/hr_prod', 'SELECT * FROM employee;', 'QUERY', '{"duration": "0.011041s"}') ON CONFLICT DO NOTHING;
INSERT INTO public.query_history (id, row_status, creator_id, created_ts, project_id, database, statement, type, payload) VALUES (127, 'NORMAL', 101, 1726820034, 'metadb-project', 'instances/bytebase-meta/databases/bbdev', 'SELECT
issue.creator_id,
principal.email,
COUNT(issue.creator_id) AS amount
FROM issue
INNER JOIN principal
ON issue.creator_id = principal.id
GROUP BY issue.creator_id, principal.email
ORDER BY COUNT(issue.creator_id) DESC;', 'QUERY', '{"duration": "0.024319125s"}') ON CONFLICT DO NOTHING;


--
Expand Down Expand Up @@ -277365,7 +277375,7 @@ INSERT INTO public.setting (id, row_status, creator_id, created_ts, updater_id,
INSERT INTO public.setting (id, row_status, creator_id, created_ts, updater_id, updated_ts, name, value, description) VALUES (111, 'NORMAL', 1, 1699026378, 101, 1720669088, 'bb.workspace.data-classification', '{"configs":[{"id":"2b599739-41da-4c35-a9ff-4a73c6cfe32c", "title":"Classification Example", "levels":[{"id":"1", "title":"Level 1"}, {"id":"2", "title":"Level 2"}, {"id":"3", "title":"Level 3"}, {"id":"4", "title":"Level 4"}], "classification":{"1":{"id":"1", "title":"Basic"}, "1-1":{"id":"1-1", "title":"Basic", "levelId":"1"}, "1-2":{"id":"1-2", "title":"Assert", "levelId":"1"}, "1-3":{"id":"1-3", "title":"Contact", "levelId":"2"}, "1-4":{"id":"1-4", "title":"Health", "levelId":"4"}, "2":{"id":"2", "title":"Relationship"}, "2-1":{"id":"2-1", "title":"Social", "levelId":"1"}, "2-2":{"id":"2-2", "title":"Business", "levelId":"3"}}, "classificationFromConfig":true}]}', 'The data classification setting') ON CONFLICT DO NOTHING;
INSERT INTO public.setting (id, row_status, creator_id, created_ts, updater_id, updated_ts, name, value, description) VALUES (175, 'NORMAL', 1, 1726805202, 1, 1726805202, 'bb.workspace.scim', '{"token":"2dc3NMIruyrj0NuaJNOiPCZLLhJGpNr2"}', 'The SCIM sync') ON CONFLICT DO NOTHING;
INSERT INTO public.setting (id, row_status, creator_id, created_ts, updater_id, updated_ts, name, value, description) VALUES (176, 'NORMAL', 1, 1726805202, 1, 1726805202, 'bb.workspace.password-restriction', '{"minLength":8,"requireLetter":true}', 'The password validation') ON CONFLICT DO NOTHING;
INSERT INTO public.setting (id, row_status, creator_id, created_ts, updater_id, updated_ts, name, value, description) VALUES (113, 'NORMAL', 1, 1699026378, 1, 1726805201, 'bb.workspace.profile', '{"externalUrl":"https://demo.bytebase.com"}', '') ON CONFLICT DO NOTHING;
INSERT INTO public.setting (id, row_status, creator_id, created_ts, updater_id, updated_ts, name, value, description) VALUES (113, 'NORMAL', 1, 1699026378, 1, 1726819741, 'bb.workspace.profile', '{"externalUrl":"https://demo.bytebase.com"}', '') ON CONFLICT DO NOTHING;


--
Expand Down Expand Up @@ -290786,6 +290796,19 @@ GROUP BY
ir.releaser_emails
ORDER BY
month;', 'PROJECT_READ', '{}') ON CONFLICT DO NOTHING;
INSERT INTO public.worksheet (id, row_status, creator_id, created_ts, updater_id, updated_ts, project_id, database_id, name, statement, visibility, payload) VALUES (110, 'NORMAL', 101, 1726820093, 101, 1726820141, 104, 111, 'Issues created by user', '-- Issues created by user
SELECT
issue.creator_id,
principal.email,
COUNT(issue.creator_id) AS amount
FROM
issue
INNER JOIN principal ON issue.creator_id = principal.id
GROUP BY
issue.creator_id,
principal.email
ORDER BY
COUNT(issue.creator_id) DESC;', 'PROJECT_READ', '{}') ON CONFLICT DO NOTHING;


--
Expand All @@ -290812,7 +290835,7 @@ SELECT pg_catalog.setval('public.anomaly_id_seq', 101, true);
-- Name: audit_log_id_seq; Type: SEQUENCE SET; Schema: public; Owner: bbdev
--

SELECT pg_catalog.setval('public.audit_log_id_seq', 128, true);
SELECT pg_catalog.setval('public.audit_log_id_seq', 129, true);


--
Expand Down Expand Up @@ -290959,7 +290982,7 @@ SELECT pg_catalog.setval('public.plan_id_seq', 107, true);
-- Name: policy_id_seq; Type: SEQUENCE SET; Schema: public; Owner: bbdev
--

SELECT pg_catalog.setval('public.policy_id_seq', 127, true);
SELECT pg_catalog.setval('public.policy_id_seq', 131, true);


--
Expand Down Expand Up @@ -290987,7 +291010,7 @@ SELECT pg_catalog.setval('public.project_webhook_id_seq', 101, false);
-- Name: query_history_id_seq; Type: SEQUENCE SET; Schema: public; Owner: bbdev
--

SELECT pg_catalog.setval('public.query_history_id_seq', 126, true);
SELECT pg_catalog.setval('public.query_history_id_seq', 127, true);


--
Expand Down Expand Up @@ -291015,7 +291038,7 @@ SELECT pg_catalog.setval('public.role_id_seq', 101, true);
-- Name: setting_id_seq; Type: SEQUENCE SET; Schema: public; Owner: bbdev
--

SELECT pg_catalog.setval('public.setting_id_seq', 177, true);
SELECT pg_catalog.setval('public.setting_id_seq', 179, true);


--
Expand Down Expand Up @@ -291078,7 +291101,7 @@ SELECT pg_catalog.setval('public.vcs_id_seq', 102, true);
-- Name: worksheet_id_seq; Type: SEQUENCE SET; Schema: public; Owner: bbdev
--

SELECT pg_catalog.setval('public.worksheet_id_seq', 109, true);
SELECT pg_catalog.setval('public.worksheet_id_seq', 110, true);


--
Expand Down

0 comments on commit 623acd5

Please sign in to comment.