DEV Community

Cover image for Getting migration and seeder files from connected DB using db_craft
MD Shahin Mia Robin
MD Shahin Mia Robin

Posted on

2 1

Getting migration and seeder files from connected DB using db_craft

DB-Craft

DB-Craft is a package for CodeIgniter 4 that provides convenient commands to generate migration and seeder files from a connected database.

Installation

You can install the DB-Craft package via Composer by running the following command:

composer require robinncode/db_craft
Enter fullscreen mode Exit fullscreen mode

Dependencies

DB-Craft has the following dependencies:

  • PHP: ^7.0.* || ^8.0.*

  • CodeIgniter/Framework: ^4.0.*

Usage

DB-Craft comes with the following commands:
Generate Migration Files

To generate all migration files from the connected database, run the following command:

php spark get:migration
Enter fullscreen mode Exit fullscreen mode

To generate migration files for a specific table, run the following command:

php spark get:migration table_name 
Enter fullscreen mode Exit fullscreen mode

Replace table_name with the name of the specific table for which you want to generate migration files.
Generate Seeder Files

To generate all seeder files from the connected database, run the following command:

php spark get:seed
Enter fullscreen mode Exit fullscreen mode

To generate seeder files for a specific table with table data, run the following command:

php spark get:seed table_name
Enter fullscreen mode Exit fullscreen mode

Replace table_name with the name of the specific table for which you want to generate seeder files.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay