"value":"\n <p>If you work on software projects that use a database, you need a convenient way to connect, inspect, and query them.<\/p>\n\n<p>Some IDEs like PhpStorm have an integrated database client, which I've recently added to my Neovim setup and working with Docker and Docker Compose.<\/p>\n\n<h2 id=\"configuring-docker-compose\">Configuring Docker Compose<\/h2>\n\n<p>A local port needs to be exposed from the database container that Neovim can connect to.<\/p>\n\n<p>I usually do this with a <code>docker-compose.override.yaml<\/code> file:<\/p>\n\n<pre><code class=\"language-yaml\">services:\n database:\n ports:\n - 3307:3306\n<\/code><\/pre>\n\n<p>Docker Compose recognises this by default, extends the normal <code>docker-compose.yaml<\/code> file and adds a port forwarding to the <code>database<\/code> service.<\/p>\n\n<h2 id=\"configuring-neovim\">Configuring Neovim<\/h2>\n\n<p>The two plugins I'm using are tpope\/vim-dadbod and kristijanhusak\/vim-dadbod-ui, and should work with Vim and Neovim. Thanks to both of these project maintainers.<\/p>\n\n<p>Once installed, run <code>:DBUIAddconnection<\/code> to add a database connection.<\/p>\n\n<p>Here is an example connection string:<\/p>\n\n<pre><code>mysql:\/\/drupal:drupal@localhost:3307\/drupal?protocol=tcp\n<\/code><\/pre>\n\n<p>Using the local port mapping, this connects to a MySQL database within the <code>database<\/code> service.<\/p>\n\n<p>Then run <code>:DBUI<\/code> to toggle the UI and see a list of databases in the left-hand sidebar.<\/p>\n\n<p>You can enter <code><leader>R<\/code> to refresh databases or <code>r<\/code> to rename or update connection details for a specific database.<\/p>\n\n<p>Once connected, you can enter and save queries, using table and column name completion, which are executed every time the query is saved.<\/p>\n\n<p>I like not needing to switch contexts and leave my editor in order to query a database, and feel a lot more productive being able to write, execute and save queries within this UI.<\/p>\n\n<p>If you're a Vim or Neovim user, I'd suggest trying this setup and seeing if it works for you.<\/p>\n\n ",
"format":"full_html",
"processed":"\n <p>If you work on software projects that use a database, you need a convenient way to connect, inspect, and query them.<\/p>\n\n<p>Some IDEs like PhpStorm have an integrated database client, which I've recently added to my Neovim setup and working with Docker and Docker Compose.<\/p>\n\n<h2 id=\"configuring-docker-compose\">Configuring Docker Compose<\/h2>\n\n<p>A local port needs to be exposed from the database container that Neovim can connect to.<\/p>\n\n<p>I usually do this with a <code>docker-compose.override.yaml<\/code> file:<\/p>\n\n<pre><code class=\"language-yaml\">services:\n database:\n ports:\n - 3307:3306\n<\/code><\/pre>\n\n<p>Docker Compose recognises this by default, extends the normal <code>docker-compose.yaml<\/code> file and adds a port forwarding to the <code>database<\/code> service.<\/p>\n\n<h2 id=\"configuring-neovim\">Configuring Neovim<\/h2>\n\n<p>The two plugins I'm using are tpope\/vim-dadbod and kristijanhusak\/vim-dadbod-ui, and should work with Vim and Neovim. Thanks to both of these project maintainers.<\/p>\n\n<p>Once installed, run <code>:DBUIAddconnection<\/code> to add a database connection.<\/p>\n\n<p>Here is an example connection string:<\/p>\n\n<pre><code>mysql:\/\/drupal:drupal@localhost:3307\/drupal?protocol=tcp\n<\/code><\/pre>\n\n<p>Using the local port mapping, this connects to a MySQL database within the <code>database<\/code> service.<\/p>\n\n<p>Then run <code>:DBUI<\/code> to toggle the UI and see a list of databases in the left-hand sidebar.<\/p>\n\n<p>You can enter <code><leader>R<\/code> to refresh databases or <code>r<\/code> to rename or update connection details for a specific database.<\/p>\n\n<p>Once connected, you can enter and save queries, using table and column name completion, which are executed every time the query is saved.<\/p>\n\n<p>I like not needing to switch contexts and leave my editor in order to query a database, and feel a lot more productive being able to write, execute and save queries within this UI.<\/p>\n\n<p>If you're a Vim or Neovim user, I'd suggest trying this setup and seeing if it works for you.<\/p>\n\n ",