oliverdavies.uk/content/node.b475d325-7c60-4115-b465-f1d691ab75b0.json
2025-05-14 00:36:23 +01:00

100 lines
No EOL
6.2 KiB
JSON

{
"uuid": [
{
"value": "b475d325-7c60-4115-b465-f1d691ab75b0"
}
],
"langcode": [
{
"value": "en"
}
],
"type": [
{
"target_id": "daily_email",
"target_type": "node_type",
"target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7"
}
],
"revision_timestamp": [
{
"value": "2025-05-11T09:00:50+00:00"
}
],
"revision_uid": [
{
"target_type": "user",
"target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849"
}
],
"revision_log": [],
"status": [
{
"value": true
}
],
"uid": [
{
"target_type": "user",
"target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849"
}
],
"title": [
{
"value": "Managing databases with Neovim and Docker\n"
}
],
"created": [
{
"value": "2022-12-10T00:00:00+00:00"
}
],
"changed": [
{
"value": "2025-05-11T09:00:50+00:00"
}
],
"promote": [
{
"value": false
}
],
"sticky": [
{
"value": false
}
],
"default_langcode": [
{
"value": true
}
],
"revision_translation_affected": [
{
"value": true
}
],
"path": [
{
"alias": "\/daily\/2022\/12\/10\/managing-databases-with-neovim-and-docker",
"langcode": "en"
}
],
"body": [
{
"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>&lt;leader&gt;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>&lt;leader&gt;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 ",
"summary": null
}
],
"feeds_item": [
{
"imported": "1970-01-01T00:33:45+00:00",
"guid": null,
"hash": "795dc7516651db80b6d0231ec717952b",
"target_type": "feeds_feed",
"target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76"
}
]
}