<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: deekeej</title>
    <description>The latest articles on DEV Community by deekeej (@deekeej).</description>
    <link>https://dev.to/deekeej</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4249918%2F20648d64-15b4-47ee-b0e7-34be63653d63.jpg</url>
      <title>DEV Community: deekeej</title>
      <link>https://dev.to/deekeej</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/deekeej"/>
    <language>en</language>
    <item>
      <title>Paste your CREATE TABLE statements, get an ER diagram (no sign-up)</title>
      <dc:creator>deekeej</dc:creator>
      <pubDate>Tue, 17 Nov 2026 15:10:00 +0000</pubDate>
      <link>https://dev.to/deekeej/paste-your-create-table-statements-get-an-er-diagram-no-sign-up-2gcj</link>
      <guid>https://dev.to/deekeej/paste-your-create-table-statements-get-an-er-diagram-no-sign-up-2gcj</guid>
      <description>&lt;p&gt;You already have your schema as SQL. Drawing it again by hand, box by box, is the part nobody enjoys. Here is a way to skip it: paste the &lt;code&gt;CREATE TABLE&lt;/code&gt; statements and let the diagram draw itself.&lt;/p&gt;

&lt;p&gt;I'm the maker of Systemap, a diagram editor that runs in the browser. This post walks through its SQL import. You can follow along without an account.&lt;/p&gt;

&lt;h2&gt;
  
  
  The schema
&lt;/h2&gt;

&lt;p&gt;A small issue tracker: users, projects, issues and comments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;    &lt;span class="kt"&gt;uuid&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;  &lt;span class="kt"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="kt"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;UNIQUE&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;projects&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;   &lt;span class="kt"&gt;uuid&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="kt"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;issues&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;          &lt;span class="kt"&gt;bigserial&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;project_id&lt;/span&gt;  &lt;span class="kt"&gt;uuid&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;REFERENCES&lt;/span&gt; &lt;span class="nf"&gt;projects&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;assignee_id&lt;/span&gt; &lt;span class="kt"&gt;uuid&lt;/span&gt; &lt;span class="k"&gt;REFERENCES&lt;/span&gt; &lt;span class="nf"&gt;users&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;title&lt;/span&gt;       &lt;span class="kt"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;comments&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;        &lt;span class="kt"&gt;bigserial&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;issue_id&lt;/span&gt;  &lt;span class="kt"&gt;bigint&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;REFERENCES&lt;/span&gt; &lt;span class="nf"&gt;issues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;author_id&lt;/span&gt; &lt;span class="kt"&gt;uuid&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;body&lt;/span&gt;      &lt;span class="kt"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look at &lt;code&gt;comments.author_id&lt;/code&gt;. It points at a user, but nobody wrote the &lt;code&gt;REFERENCES&lt;/code&gt;. We'll fix that in the diagram.&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 1.&lt;/strong&gt; Open &lt;a href="http://www.systemap.app" rel="noopener noreferrer"&gt;www.systemap.app&lt;/a&gt; and click &lt;strong&gt;Try it now&lt;/strong&gt;. No sign-up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2.&lt;/strong&gt; In the &lt;strong&gt;Page&lt;/strong&gt; panel on the right, under &lt;strong&gt;Create&lt;/strong&gt;, click &lt;strong&gt;Import SQL&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3.&lt;/strong&gt; Paste the statements and click &lt;strong&gt;Replace page with this schema&lt;/strong&gt;, then &lt;strong&gt;Close&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Each table becomes a box with its columns. Each &lt;code&gt;REFERENCES&lt;/code&gt; becomes a 1:N relationship line. With the schema above you get four tables and three lines.&lt;/p&gt;

&lt;p&gt;One thing to know: import replaces what is on the page. Start on a new page if you want to keep a drawing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The foreign key your SQL forgot
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;comments.author_id&lt;/code&gt; has no line, because the SQL never declared one.&lt;/p&gt;

&lt;p&gt;Double-click the &lt;code&gt;comments&lt;/code&gt; table, start typing in the &lt;strong&gt;References&lt;/strong&gt; field of &lt;code&gt;author_id&lt;/code&gt;, and pick &lt;code&gt;users.id&lt;/code&gt; from the list. The primary keys on the page come first. The line draws itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you can do with it
&lt;/h2&gt;

&lt;p&gt;Save the diagram as a PNG for a design doc or a pull request. That works without an account. Sharing a link or exporting a video needs a free account.&lt;/p&gt;

&lt;p&gt;The 40-second video version of this walkthrough: &lt;a href="https://youtu.be/D763_Yt2GLI" rel="noopener noreferrer"&gt;https://youtu.be/D763_Yt2GLI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If your schema imports wrong, tell me in the comments which statement broke. The import targets PostgreSQL syntax today.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>database</category>
      <category>postgres</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
