Skip to content

Instantly share code, notes, and snippets.

@reosarevok
Last active December 2, 2021 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reosarevok/67bc8f1cc09b589cd76612ac5783ca50 to your computer and use it in GitHub Desktop.
Save reosarevok/67bc8f1cc09b589cd76612ac5783ca50 to your computer and use it in GitHub Desktop.
edit_note_change
CREATE TYPE edit_note_status AS ENUM ('deleted', 'edited');
CREATE TABLE edit_note_change
(
id SERIAL, -- PK
status edit_note_status,
edit_note INTEGER NOT NULL, -- references edit_note.id
changing_editor INTEGER NOT NULL, -- references editor.id
change_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
old_note TEXT NOT NULL,
new_note TEXT NOT NULL,
reason TEXT NOT NULL DEFAULT '',
);
@Freso
Copy link

Freso commented Dec 2, 2021

Would it make sense to allow reason to be NULL for cases where no reason was provided? Or is it better to just have an empty string?

@reosarevok
Copy link
Author

I'd rather have an empty string, but I'll change to TEXT NOT NULL DEFAULT ''

@mwiencek
Copy link

mwiencek commented Dec 2, 2021

Maybe change_by_admin ought to be the ID of the editor who changed the note instead? Since it might be useful sometimes to know which admin changed something.

@reosarevok
Copy link
Author

Ok, we considered that as an option but wasn't sure if needed, but I guess it can't hurt :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment