soft DELETE, saved in events_deleted table
This commit is contained in:
parent
816d3e7ece
commit
dda78efdd1
2 changed files with 15 additions and 0 deletions
|
@ -391,6 +391,9 @@ class EventResource(BaseEvent):
|
|||
def on_delete(self, req, resp, id):
|
||||
db = db_connect()
|
||||
cur = db.cursor()
|
||||
cur.execute("""INSERT INTO events_deleted SELECT events_id, createdate, lastupdate, events_type, events_what, events_when, events_geo, events_tags
|
||||
FROM events e
|
||||
WHERE e.events_id = %s;""", (id,));
|
||||
cur.execute("""DELETE FROM events WHERE events_id = %s;""", (id,));
|
||||
db.commit()
|
||||
cur.close()
|
||||
|
|
12
setup.sql
12
setup.sql
|
@ -35,6 +35,18 @@ CREATE TABLE events (
|
|||
);
|
||||
|
||||
|
||||
CREATE TABLE events_deleted (
|
||||
events_id uuid,
|
||||
createdate timestamp without time zone,
|
||||
lastupdate timestamp without time zone,
|
||||
events_type text,
|
||||
events_what text,
|
||||
events_when tstzrange,
|
||||
events_geo text,
|
||||
events_tags jsonb
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: geo; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue