Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tyler36/ddev-db-init
Automatically run SQL-like files when initializing the DDEV database service
https://github.com/tyler36/ddev-db-init
database mysql postgresql sql
Last synced: about 5 hours ago
JSON representation
Automatically run SQL-like files when initializing the DDEV database service
- Host: GitHub
- URL: https://github.com/tyler36/ddev-db-init
- Owner: tyler36
- License: apache-2.0
- Created: 2022-06-22T07:59:34.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-21T09:10:51.000Z (7 months ago)
- Last Synced: 2024-03-21T10:50:48.862Z (6 months ago)
- Topics: database, mysql, postgresql, sql
- Language: Shell
- Homepage:
- Size: 92.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tyler36/ddev-db-init
[![tests](https://github.com/tyler36/ddev-db-init/actions/workflows/tests.yml/badge.svg)](https://github.com/tyler36/ddev-db-init/actions/workflows/tests.yml) ![project is maintained](https://img.shields.io/maintenance/yes/2025.svg)
- [Introduction](#introduction)
- [Getting Started](#getting-started)
- [What does this add-on do and add?](#what-does-this-add-on-do-and-add)
- [Guides](#guides)
- [Reset the DDEV database service](#reset-the-ddev-database-service)
- [Supported SQL-files](#supported-sql-files)
- [Postgres](#postgres)
- [MariaDB](#mariadb)
- [MySQL](#mysql)
- [TODO](#todo)## Introduction
This add-on will automatically load SQL-like files into the DDEV database container when starting a project with no database initialized. See [offical Queues documentation](https://laravel.com/docs/9.x/queues) for more details.
This can be used to:
- configure the database service
- add additional databases
- populate the databaseIn addition, this makes it easy to
- reset the database service using `ddev export` and `ddev delete`
- configure the database of a cloud service such as Gitpod## Getting Started
This add-on requires DDEV v1.19.3 or higher.
- Install the DDEV db-init add-on:
```shell
ddev get tyler36/ddev-db-init
ddev restart
```## What does this add-on do and add?
1. Checks to make sure the DDEV version is adequate.
2. Adds `.ddev/docker-compose.db-init.yaml`, which mounts a ddev folder into the database container.## Guides
## Reset the DDEV database service
- Create a backup of the current database.
```shell
ddev export-db --gzip=false -f db.sql
```- Move the file into `.ddev/db-init`.
```shell
mv db.sql ./.ddev/db-init
```- Destroy the DDEV database (you created a backup, didn't you?).
```shell
ddev delete -Oy
```- Recreate the DDEV services.
```shell
ddev start
```## Supported SQL-files
### Postgres
- *.sql
- *.sql.gz
- *.shSee [Initialization Scripts](https://hub.docker.com/_/postgres) for further information.
### MariaDB
- *.sh,
- *.sql
- *.sql.gz
- *.sql.xz
- *.sql.zstSee [Initializing a fresh instance](https://hub.docker.com/_/mariadb) for further information.
### MySQL
- *.sh,
- *.sql
- *.sql.gzSee [Initializing a fresh instance](https://hub.docker.com/_/mysql) for further information.
## TODO
- [ ] Confirm MariaDb support
- [ ] Confirm MySQL support**Contributed and maintained by [tyler36](https://github.com/tyler36)**