-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathclean-test-data.sql
78 lines (63 loc) · 2.81 KB
/
clean-test-data.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
update users
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and (email like '%@test.apidoc.me' or email like '%@test.apibuilder.io');
update organizations
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and (key like 'a-public-%'
or key like 'z-test-%');
update memberships
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and organization_guid in (select guid from organizations where deleted_at is not null);
update membership_requests
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and organization_guid in (select guid from organizations where deleted_at is not null);
update organization_domains
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and organization_guid in (select guid from organizations where deleted_at is not null);
update subscriptions
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and organization_guid in (select guid from organizations where deleted_at is not null);
update applications
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and organization_guid in (select guid from organizations where deleted_at is not null);
update application_moves
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and application_guid in (select guid from applications where deleted_at is not null);
update attributes
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and name like 'z-test%';
update organization_attribute_values
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and value like 'z-test%';
update changes
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and application_guid in (select guid from applications where deleted_at is not null);
delete from search.items
where application_guid in (select guid from applications where deleted_at is not null);
update versions
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and application_guid in (select guid from applications where deleted_at is not null);
update watches
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and application_guid in (select guid from applications where deleted_at is not null);
update generators.services
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and uri like 'http://test.generator.%';
update generators.generators
set deleted_at=now(), deleted_by_guid = created_by_guid
where deleted_at is null
and service_guid in (select guid from generators.services where deleted_at is not null);