Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
start working on #131
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Hofstetter committed Jun 25, 2020
1 parent a3f6862 commit 4b0a9e9
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
35 changes: 35 additions & 0 deletions backend/docs/notes
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,38 @@ dp_ipdevel=# select name, api_key from users;


mh@debian10:~/cert/do-portal$ curl -s 'http://portal-backend:8081/cp/1.0/organization_memberships' -H 'Connection: keep-alive' -H 'Accept: application/json, text/plain, */*' -H 'DNT: 1' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36' -H 'Origin: http://portal-frontend:8081' -H 'Referer: http://portal-frontend:8081/' -H 'Accept-Language: en-US,en;q=0.9,de;q=0.8,es;q=0.7' -H 'Cookie: rm=2|a1a427dfd4a5048a44184cf2d9326b53fc0bc3bff6964e522afdfcae54502bae6a768049289d0762edc4597184b18c76354a6b06d538c041f32792f8a2c0ca55' --compressed --insecure | jq .organization_memberships[].email
diff --git a/docs/03_RIPE.md b/docs/03_RIPE.md
index 1027df0..d3676db 100644
--- a/docs/03_RIPE.md
+++ b/docs/03_RIPE.md
@@ -59,3 +59,30 @@ pushd $(date -I)
popd
rm $(date -I)
```
+
+delete a row from fody.organisation_automatic
+--------------------------------------------
+
+do_portal=# select ripe_org_hdl from fody.organisation_automatic;
+do_portal=# delete from fody.organisation_automatic where ripe_org_hdl = 'ORG-RIZV1-RIPE';
+ERROR: update or delete on table "organisation_automatic" violates foreign key constraint "contact_automatic_organisation_automatic_id_fkey" on table "contact_automatic"
+DETAIL: Key (organisation_automatic_id)=(490229) is still referenced from table "contact_automatic".
+do_portal=# delete from fody.organisation where id = 490229;
+ERROR: column "id" does not exist
+LINE 1: delete from fody.organisation where id = 490229;
+ ^
+do_portal=# delete from fody.contact_automatic where organisation_automatic_id = 490229;
+DELETE 1
+do_portal=# delete from fody.organisation_automatic where ripe_org_hdl = 'ORG-RIZV1-RIPE';
+ERROR: update or delete on table "organisation_automatic" violates foreign key constraint "organisation_to_asn_automatic_organisation_automatic_id_fkey" on table "organisation_to_asn_automatic"
+DETAIL: Key (organisation_automatic_id)=(490229) is still referenced from table "organisation_to_asn_automatic".
+do_portal=# delete from fody.organisation_to_asn_automatic where organisation_automatic_id = 490229;
+DELETE 1
+do_portal=# delete from fody.organisation_automatic where ripe_org_hdl = 'ORG-RIZV1-RIPE';
+ERROR: update or delete on table "organisation_automatic" violates foreign key constraint "organisation_to_network_automati_organisation_automatic_id_fkey" on table "organisation_to_network_automatic"
+DETAIL: Key (organisation_automatic_id)=(490229) is still referenced from table "organisation_to_network_automatic".
+do_portal=# delete from fody.organisation_to_network_automatic where organisation_automatic_id = 490229;
+DELETE 7
+do_portal=# delete from fody.organisation_automatic where ripe_org_hdl = 'ORG-RIZV1-RIPE';
+DELETE 1
+
12 changes: 12 additions & 0 deletions backend/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,17 @@ def adduser(password, name, email):
click.echo('User {0} was registered successfully.'.format(email))



@cli.command()
@click.argument('delete_stale_ripe_handles', doit=False)
def delete_stale_ripe_handles(filename):
"""
do_portal=#
delete from fodyorg_x_organization where ripe_org_hdl not in
(select ripe_org_hdl from fody.organisation_automatic);
"""
pass


if __name__ == '__main__':
cli()

0 comments on commit 4b0a9e9

Please sign in to comment.