<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sqlite | Nerdpress.org</title>
	<atom:link href="https://nerdpress.org/category/db/sqlite/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerdpress.org</link>
	<description>...dev, tech problems and solutions.</description>
	<lastBuildDate>Wed, 09 Aug 2023 09:51:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Sqlite Administration in IntelliJ IDE</title>
		<link>https://nerdpress.org/2021/05/17/sqlite-administration-in-intellij-ide/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Mon, 17 May 2021 05:51:21 +0000</pubDate>
				<category><![CDATA[IDE]]></category>
		<category><![CDATA[Sqlite]]></category>
		<category><![CDATA[IntelliJ Ultimate]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=3050</guid>

					<description><![CDATA[<p>Sometime ago I tried to use Adminer in Docker to administrate a sqlite database, which was not as easy as expected.If you are a happy user of IntelliJ IDE like PHPStorm or IntelliJ Ultimate like me :) then i would nowadays recommend to use the built-in database tool of your IntelliJ IDE for Sqlite administration &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2021/05/17/sqlite-administration-in-intellij-ide/" class="more-link">Continue reading<span class="screen-reader-text"> "Sqlite Administration in IntelliJ IDE"</span></a></p>
The post <a href="https://nerdpress.org/2021/05/17/sqlite-administration-in-intellij-ide/">Sqlite Administration in IntelliJ IDE</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>Sometime ago I tried to use <a href="https://nerdpress.org/2019/10/23/adminer-for-sqlite-in-docker/" target="_blank" rel="noreferrer noopener">Adminer in Docker</a> to administrate a sqlite database, which was not as easy as expected.<br />If you are a happy user of IntelliJ IDE like PHPStorm or IntelliJ Ultimate like me :) then i would nowadays recommend to use the built-in database tool of your IntelliJ IDE for Sqlite administration instead.<br />Even in dockerized context.</p>



<span id="more-3050"></span>



<p>A Sqlite database is only one file, which you surely have access to.<br />So just add a Database configuration to your IDE and point it to the Sqlite file.<br />Click on the Database flyout on the left side then on the + (Plus) and add a Sqlite configuration.<br />(IntelliJ has good documentation on <a href="https://www.jetbrains.com/help/idea/connecting-to-a-database.html#connect-to-sqlite-database" target="_blank" rel="noreferrer noopener">Sqlite Database connection</a> as well of course)</p>



<figure class="wp-block-image size-large"><a href="https://nerdpress.org/wp-content/uploads/2021/05/IntelliJ_Sqlite_Database.png"><img fetchpriority="high" decoding="async" width="1024" height="563" src="https://nerdpress.org/wp-content/uploads/2021/05/IntelliJ_Sqlite_Database-1024x563.png" alt="" class="wp-image-3051" srcset="https://nerdpress.org/wp-content/uploads/2021/05/IntelliJ_Sqlite_Database-1024x563.png 1024w, https://nerdpress.org/wp-content/uploads/2021/05/IntelliJ_Sqlite_Database-300x165.png 300w, https://nerdpress.org/wp-content/uploads/2021/05/IntelliJ_Sqlite_Database-768x422.png 768w, https://nerdpress.org/wp-content/uploads/2021/05/IntelliJ_Sqlite_Database.png 1257w" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /></a></figure>



<p>Then you are ready to go.<br />The UI of the database structure is quite good.<br />You can browse the tables by doublelick on the table in the database structure view.<br />Also you can edit values in the table view.<br />Note: <em>When the DB was created inside the Docker container you probably dont own the DB from the host and you wont be able write to it.<br />While developing just change permissions on the host, if necessary.</em></p>



<p>You can also open a <strong>Database Console</strong> window where you can test queries.<br />This is particular better than using Adminer because these test queries are persisted and will still be there the next day.<br />You can add multiple database consoles and reopen them from &#8220;Scratches and Consoles&#8221; in your Project menu.</p>



<figure class="wp-block-image size-large"><a href="https://nerdpress.org/wp-content/uploads/2021/05/IntelliJ_Database_Console.png"><img decoding="async" width="1024" height="447" src="https://nerdpress.org/wp-content/uploads/2021/05/IntelliJ_Database_Console-1024x447.png" alt="" class="wp-image-3052" srcset="https://nerdpress.org/wp-content/uploads/2021/05/IntelliJ_Database_Console-1024x447.png 1024w, https://nerdpress.org/wp-content/uploads/2021/05/IntelliJ_Database_Console-300x131.png 300w, https://nerdpress.org/wp-content/uploads/2021/05/IntelliJ_Database_Console-768x335.png 768w, https://nerdpress.org/wp-content/uploads/2021/05/IntelliJ_Database_Console.png 1434w" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /></a></figure>



<p>So no Adminer needed. Sqlite is just a file, dude.<br />No hassles with docker-compose anymore for DB administration and still using Docker for the app. :)</p>



<p><strong>Update 09.08.2023:</strong><br />JetBrains has now also uploaded a nice Youtube Video Tutorial on how to deal with Sqlite databases in IntelliJ IDEs like f.e. PHPStorm:<br /><a href="https://www.youtube.com/watch?v=Qw_JniULJBI" target="_blank" rel="noopener" title="">Working with SQLite Databases in any JetBrains IDE</a></p>



<p>I learned that you can now Drag and Drop Sqlite database files into the DataBase Pane and the IDE connects it directly, nice!</p>



<p></p>The post <a href="https://nerdpress.org/2021/05/17/sqlite-administration-in-intellij-ide/">Sqlite Administration in IntelliJ IDE</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Adminer for Sqlite in Docker</title>
		<link>https://nerdpress.org/2019/10/23/adminer-for-sqlite-in-docker/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Wed, 23 Oct 2019 08:02:47 +0000</pubDate>
				<category><![CDATA[docker]]></category>
		<category><![CDATA[Sqlite]]></category>
		<category><![CDATA[adminer]]></category>
		<category><![CDATA[docker-compose]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2889</guid>

					<description><![CDATA[<p>Recently i wanted to use Sqlite with Adminer in Docker and it turned out to be not so easy. I actually thought i could just declare Adminer in a docker-compose.yml file with a volume mounted, similar as i would do for adminer with mysql. Update: Today i would rather use the IntelliJ Database Tool for &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2019/10/23/adminer-for-sqlite-in-docker/" class="more-link">Continue reading<span class="screen-reader-text"> "Adminer for Sqlite in Docker"</span></a></p>
The post <a href="https://nerdpress.org/2019/10/23/adminer-for-sqlite-in-docker/">Adminer for Sqlite in Docker</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>Recently i wanted to use Sqlite with <a aria-label="Adminer (opens in a new tab)" href="https://www.adminer.org/" target="_blank" rel="noreferrer noopener">Adminer</a> in Docker and it turned out to be not so easy.<br /> I actually thought i could just declare Adminer in a docker-compose.yml file with a volume mounted, similar as i would do for adminer with mysql.</p>



<p><strong>Update</strong>: Today i would rather use the <a href="https://nerdpress.org/2021/05/17/sqlite-administration-in-intellij-ide/">IntelliJ Database Tool for Sqlite administration</a>.</p>



<p>But since Adminer is a popular hacking target they introduced a <a href="https://www.adminer.org/en/password/" target="_blank" rel="noreferrer noopener" aria-label="feature (opens in a new tab)">feature</a> that does not allow to run adminer without a password, out of the box.<br /> Sqlite database usually runs without password and dang, workaround needed!</p>



<span id="more-2889"></span>



<p>So we need to add a plugin to adminer that allows password-less login and extend the official Adminer Docker image to include the plugin.</p>



<p>We add a script that loads the official password-less-login plugin and copy it to the plugins-enabled folder of the Adminer image</p>



<p>login-password-less.php:</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:100%"><div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
&lt;?php
require_once(&#039;plugins/login-password-less.php&#039;);

/** Set allowed password
 * @param string result of password_hash
 */
return new AdminerLoginPasswordLess(
    $password_hash = password_hash(&quot;admin&quot;, PASSWORD_DEFAULT)
);
</pre></div></div>
</div>



<p>Dockerfile:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
FROM adminer
USER root
COPY login-password-less.php /var/www/html/plugins-enabled/login-password-less.php
#USER adminer # we run as root because of permissions problems on db file with the volume
</pre></div>


<p>In docker-compose.yml:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; title: ; notranslate">
version: &quot;3&quot;
services:
  app:
    build: ./php
      - mailcatcher
    volumes:
      - &quot;../:/app:rw&quot;
      - &quot;./php/cli/php.ini:/etc/php/7.3/cli/php.ini:ro&quot;
      - &quot;./php/fpm/php.ini:/etc/php/7.3/fpm/php.ini:ro&quot;

  nginx:
    build: ./nginx
    depends_on:
      - app
    command: /bin/sh -c &quot;nginx -g &#039;daemon off;&#039;&quot;
    volumes:
      - &quot;..:/app:rw&quot;
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
    ports:
      - &#039;8088:80&#039;

  adminer:
    build: ./adminer
    restart: unless-stopped
    volumes:
      - &quot;..:/app:rw&quot;
    ports:
      - 8080:8080
</pre></div>


<p>File tree:</p>



<ul class="wp-block-list"><li>adminer<br />&#8211; Dockerfile<br />&#8211; login-password-less.php</li><li>nginx<br />&#8230;</li><li>php<br />&#8230;</li><li>docker-compose.yml</li></ul>



<p><em>Note that since docker-compose.yml version 3 the volumes_from directive was removed in favor of top level volumes to share volumes across images. However this implementation is imho rather weird, so i jut duplicated the volumes declaration in the App container and Adminer container.<br /> Feels rather wrong but thats all i could come up with. Any advice here is welcome.</em></p>



<p>Now that this is done we can open the Sqlite3 database with the pseudo-password &#8220;admin&#8221; and manage the database.</p>



<p>After all you could also just copy the one-file Adminer with plugin to the php container and run it from within the php container. Just adjust your Nginx config to allow calling the file directly and take care to not deploy Adminer to live.<br /> There is also a project that bundles the plugin with Adminer to one file: <a href="https://github.com/FrancoisCapon/LoginToASqlite3DatabaseWithoutCredentialsWithAdminer" target="_blank" rel="noreferrer noopener">https://github.com/FrancoisCapon/LoginToASqlite3DatabaseWithoutCredentialsWithAdminer/blob/master/build-adminer-4-sqlite3-into-one-file.sh</a></p>The post <a href="https://nerdpress.org/2019/10/23/adminer-for-sqlite-in-docker/">Adminer for Sqlite in Docker</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
