Sign inSign up

ogulcanaydogan/db-seeder

By ogulcanaydogan

Updated 7 months ago

Seed databases with test data from SQL or JSON files

Image
0

893

ogulcanaydogan/db-seeder repository overview

DB Seeder

Seed databases with test/development data from SQL or JSON files.

Quick Start

docker run \
  -e DB_HOST=db -e DB_NAME=myapp -e DB_USER=postgres -e DB_PASSWORD=secret \
  -v $(pwd)/seeds:/seeds \
  ogulcanaydogan/db-seeder

Features

  • PostgreSQL and MySQL support
  • Seed from SQL files or JSON fixtures
  • Ordered execution by filename
  • Idempotent seeding (skip if data exists)
  • Dry-run mode

Environment Variables

VariableDescriptionDefault
DB_TYPEDatabase type (postgresql/mysql)postgresql
DB_HOSTDatabase hostlocalhost
DB_NAMEDatabase name-
DB_USERDatabase user-
DB_PASSWORDDatabase password-
SEEDS_DIRDirectory with seed files/seeds

Docker Compose Example

services:
  seed:
    image: ogulcanaydogan/db-seeder
    depends_on:
      db:
        condition: service_healthy
    environment:
      - DB_HOST=db
      - DB_NAME=myapp
      - DB_USER=postgres
      - DB_PASSWORD=secret
    volumes:
      - ./seeds:/seeds

License

MIT

Tag summary

Content type

Image

Digest

sha256:dd023126f

Size

60 MB

Last updated

7 months ago

docker pull ogulcanaydogan/db-seeder