From cead140467cbce104c0f4f3f538f3253257a19b0 Mon Sep 17 00:00:00 2001 From: Erik Moeller Date: Tue, 6 Oct 2020 23:09:49 -0700 Subject: [PATCH] Update database diagram using MySQL Workshop --- .gitattributes | 1 + docs/development/tips_and_tricks.rst | 6 +- docs/diagrams/README.md | 6 +- docs/diagrams/securedrop-database.mwb | 3 + docs/diagrams/securedrop-database.png | 4 +- docs/diagrams/securedrop-database.tex | 132 -------------------------- 6 files changed, 14 insertions(+), 138 deletions(-) create mode 100644 docs/diagrams/securedrop-database.mwb delete mode 100644 docs/diagrams/securedrop-database.tex diff --git a/.gitattributes b/.gitattributes index 8fc699955..dc946bf30 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,3 +4,4 @@ *.svg filter=lfs diff=lfs merge=lfs -text *.vsdx filter=lfs diff=lfs merge=lfs -text *.jpg filter=lfs diff=lfs merge=lfs -text +*.mwb filter=lfs diff=lfs merge=lfs -text diff --git a/docs/development/tips_and_tricks.rst b/docs/development/tips_and_tricks.rst index 9f3451f6d..01b352ed4 100644 --- a/docs/development/tips_and_tricks.rst +++ b/docs/development/tips_and_tricks.rst @@ -131,7 +131,9 @@ Note that the ``cat`` example above will also add the ATHS info for the Architecture Diagrams --------------------- -Some helpful diagrams for getting a sense of the SecureDrop application architecture are stored `here -`_, including a high-level view of the SecureDrop database structure: +Some helpful diagrams for getting a sense of the SecureDrop application +architecture are stored `here `_, +including a high-level view of the SecureDrop database structure: .. image:: ../diagrams/securedrop-database.png + :width: 100% diff --git a/docs/diagrams/README.md b/docs/diagrams/README.md index 111f509b1..9790b2c7c 100644 --- a/docs/diagrams/README.md +++ b/docs/diagrams/README.md @@ -16,8 +16,10 @@ an entry here: `SecureDrop-visio.png`. For context, see [#274][]. - `SecureDrop-0.3-DFD.png`: A WIP DFD (data flow diagram) created for SecureDrop 0.3. WIP. -- `securedrop-database.png`: A diagram of the tables and columns in the securedrop app's SQLite database. -- `securedrop-database.tex`: TeX used to generate the `securedrop-database.png` figure. +- `securedrop-database.png`: An entity relationship diagram of the + SecureDrop SQLite database +- `securedrop-database.mwb`: MySQL Workshop file used to generate + and update the diagram - `SecureDrop_DataFlow.png`: Data flow diagram for SecureDrop. - `SecureDrop_DataFlow.draw`: XML used to generate with [Draw.io][]. [SecureDrop website FAQ]: https://securedrop.org/faq#how_works diff --git a/docs/diagrams/securedrop-database.mwb b/docs/diagrams/securedrop-database.mwb new file mode 100644 index 000000000..5c304cfdc --- /dev/null +++ b/docs/diagrams/securedrop-database.mwb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d36c99ff381a1cb591f2e1e0de6423e78740083783ddaf4d45fef971643b13fd +size 13526 diff --git a/docs/diagrams/securedrop-database.png b/docs/diagrams/securedrop-database.png index 678146c9d..d474e2650 100644 --- a/docs/diagrams/securedrop-database.png +++ b/docs/diagrams/securedrop-database.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0f88eca143da9e80d7ab1da63b76a16a761cb9947066162fae3c89f2a3b13fb7 -size 297645 +oid sha256:372369e881c6c48c7e4c1d90acce7635f73f6afd43f54037365f1a72042fdf85 +size 190085 diff --git a/docs/diagrams/securedrop-database.tex b/docs/diagrams/securedrop-database.tex deleted file mode 100644 index 43836aa93..000000000 --- a/docs/diagrams/securedrop-database.tex +++ /dev/null @@ -1,132 +0,0 @@ -\documentclass{minimal} -\pdfpagewidth 10.75in -\pdfpageheight 10.75in - -\usepackage{pgf} -\usepackage{tikz} - -\usepackage[utf8]{inputenc} -\usetikzlibrary{arrows,automata} -\usetikzlibrary{positioning} - -\tikzset{ - state/.style={ - rectangle, - draw=black, very thick, - minimum height=1em, - text centered}, -} - -\begin{document} - -\begin{tikzpicture}[rotate=90] - - \node[state] (SOURCES) - {\begin{tabular}{l} - \textbf{sources} \texttt{Source(Base)}\\\\ - \parbox{4.4cm}{\begin{itemize} - \item id (\texttt{integer, primary key}) - \item filesystem\_id (\texttt{string(96), unique}) - \item journalist\_designation (\texttt{string(255)}) - \item flagged (\texttt{boolean}) - \item last\_updated (\texttt{datetime}) - \item pending (\texttt{boolean}) - \item interaction\_count (\texttt{integer}) - \end{itemize} - }\\[4em] - \end{tabular}}; - - \node[state, - right of=SOURCES, - node distance=6cm, - text width=5cm] (JOURNALISTS) - {\begin{tabular}{l} - \textbf{journalists} \texttt{Journalist(Base)}\\ \\ - \parbox{5cm}{\begin{itemize} - \item id (\texttt{integer, primary key}) - \item username (\texttt{string(255)}) - \item pw\_salt (\texttt{binary(32)}) - \item pw\_hash (\texttt{binary(256)}) - \item is\_admin (\texttt{boolean}) - \item otp\_secret (\texttt{string(16)}) - \item is\_totp (\texttt{boolean}) - \item hotp\_counter (\texttt{integer}) - \item last\_token (\texttt{string(6)}) - \item created\_on (\texttt{datetime}) - \item last\_access (\texttt{datetime}) - \end{itemize} - }\\[4em] - \end{tabular}}; - - \node[state, - right of=JOURNALISTS, - node distance=6cm, - text width=5.1cm] (JOURNALISTLOGINATTEMPTS) - {\begin{tabular}{l} - \textbf{journalist\_login\_attempt} \\ - \texttt{JournalistLoginAttempt(Base)}\\ \\ - \parbox{5cm}{\begin{itemize} - \item id (\texttt{integer, primary key}) - \item journalist\_id (\texttt{integer, foreign key(journalists.id)}) - \item timestamp (\texttt{datetime}) - \end{itemize} - }\\[1em] - \end{tabular}}; - - \node[state, - below of=SOURCES, - node distance=7cm, - text width=5.1cm] (SUBMISSIONS) - {\begin{tabular}{l} - \textbf{submissions} \texttt{Submission(Base)}\\ \\ - \parbox{5cm}{\begin{itemize} - \item id (\texttt{integer, primary key}) - \item source\_id (\texttt{integer, foreign key(sources.id)}) - \item filename (\texttt{string(255)}) - \item size (\texttt{integer}) - \item downloaded (\texttt{boolean}) - \end{itemize} - }\\[1em] - \end{tabular}}; - - \node[state, - below of=SUBMISSIONS, - node distance=5.3cm, - text width=5.1cm] (SOURCESTAR) - {\begin{tabular}{l} - \textbf{source\_stars} \texttt{SourceStar(Base)}\\ \\ - \parbox{5cm}{\begin{itemize} - \item id (\texttt{integer, primary key}) - \item source\_id (\texttt{integer, foreign key(sources.id)}) - \item starred (\texttt{boolean}) - \end{itemize} - }\\[1em] - \end{tabular}}; - - \node[state, - below of=JOURNALISTS, - node distance=7cm, - text width=5.1cm] (REPLIES) - {\begin{tabular}{l} - \textbf{replies} \texttt{Reply(Base)}\\ \\ - \parbox{5cm}{\begin{itemize} - \item id (\texttt{integer, primary key}) - \item journalist\_id (\texttt{integer, foreign key(journalists.id)}) - \item source\_id (\texttt{integer, foreign key(sources.id)}) - \item filename (\texttt{string(255)}) - \item size (\texttt{integer}) - \end{itemize} - }\\[4em] - \end{tabular}}; - - \path - (SOURCES) edge (JOURNALISTS) - (JOURNALISTS) edge (JOURNALISTLOGINATTEMPTS) - (SOURCES) edge[bend right=45] (SOURCESTAR) - (SOURCES) edge (SUBMISSIONS) - (REPLIES) edge (SOURCES) - (REPLIES) edge (JOURNALISTS); - -\end{tikzpicture} - -\end{document} \ No newline at end of file