Skip to content

Laravel Migrations & Seeder Generator: Automatically generate your migrations from an existing database schema.

License

Notifications You must be signed in to change notification settings

webreca/laravel-reverse-migrator

Repository files navigation

How to Use Laravel Reverse Migrator Application

1. Clone your project

git clone https://github.com/webreca/laravel-reverse-migrator.git

2. Go to the folder application using cd command on your cmd or terminal

cd laravel-reverse-migrator

3. Run composer install on your cmd or terminal

composer install

4. Copy .env.example file to .env on the root folder. You can type copy .env.example .env if using command prompt Windows or cp .env.example .env if using terminal, Ubuntu

copy .env.example .env

5. Open your .env file and change the database name (DB_DATABASE) to whatever you have, username (DB_USERNAME) and password (DB_PASSWORD) field correspond to your configuration.

6. Run php artisan key:generate

php artisan key:generate

7. Run php artisan migrate

php artisan migrate

8. Run php artisan serve

php artisan serve

To create migrations for all the tables, run:

php artisan migrate:generate

You can specify the tables you wish to generate using:

php artisan migrate:generate --tables="table1,table2,table3,table4,table5"

You can also ignore tables with:

php artisan migrate:generate --ignore="table3,table4,table5"

Laravel Migrations Generator will first generate all the tables, columns and indexes, and afterwards setup all the foreign key constraints.

So make sure you include all the tables listed in the foreign keys so that they are present when the foreign keys are created.

You can also specify the connection name if you are not using your default connection with:

php artisan migrate:generate --connection="connection_name"

Squash Migrations

By default, Generator will generate multiple migration files for each table.

You can squash all migrations into a single file with:

php artisan migrate:generate --squash

Options

Run php artisan help migrate:generate for a list of options.

Options Description
-c, --connection[=CONNECTION] The database connection to use
-t, --tables[=TABLES] A list of tables or views you wish to generate migrations for separated by a comma: users,posts,comments
-i, --ignore[=IGNORE] A list of tables or views you wish to ignore, separated by a comma: users,posts,comments
-p, --path[=PATH] Where should the file be created?
-tp, --template-path[=TEMPLATE-PATH] The location of the template for this generator
--date[=DATE] Migrations will be created with specified date. Views and foreign keys will be created with + 1 second. Date should be in format supported by Carbon::parse
--table-filename[=TABLE-FILENAME] Define table migration filename, default pattern: [datetime]\_create_[name]_table.php
--view-filename[=VIEW-FILENAME] Define view migration filename, default pattern: [datetime]\_create_[name]_view.php
--proc-filename[=PROC-FILENAME] Define stored procedure filename, default pattern: [datetime]\_create_[name]_proc.php
--fk-filename[=FK-FILENAME] Define foreign key migration filename, default pattern: [datetime]\_add_foreign_keys_to_[name]_table.php
--log-with-batch[=LOG-WITH-BATCH] Log migrations with given batch number. We recommend using batch number 0 so that it becomes the first migration
--default-index-names Don't use DB index names for migrations
--default-fk-names Don't use DB foreign key names for migrations
--use-db-collation Generate migrations with existing DB collation
--skip-log Don't log into migrations table
--skip-vendor Don't generate vendor migrations
--skip-views Don't generate views
--skip-proc Don't generate stored procedures
--squash Generate all migrations into a single file
--with-has-table Check for the existence of a table using hasTable

SQLite Alter Foreign Key

The generator first generates all tables and then adds foreign keys to existing tables.

However, SQLite only supports foreign keys upon creation of the table and not when tables are altered. add_foreign_keys migrations will still be generated, however will get omitted if migrate to SQLite type database.

User-Defined Type Columns

The generator will recognize user-defined type from the schema, and then generate migration as

public function up()
{
    Schema::create('table', function (Blueprint $table) {
        ...
    });
    DB::statement("ALTER TABLE table ADD column custom_type NOT NULL");
}

Note that the new column is always added at the end of the created table which means the ordering of the column generated in migration will differ from what we have from the schema.

Supported database with user-defined types:

  • PostgreSQL
  • SQL Server

Generate Seeder From Database

[table_name]

Mandatory parameter which defines which table/s will be used for seed creation. Use CSV notation for multiple tables. Seed file will be generated for each table.

Examples:

php artisan iseed my_table
php artisan iseed my_table,another_table

Thank You

WEBRECA TECHNOLOGIES

drawing drawing

Webreca Technologies - New Delhi, India

Welcome to Webreca Technologies! We specialize in delivering top-notch, innovative web solutions to clients across the globe. Based in the heart of New Delhi, India, we are dedicated to providing cutting-edge technologies and creative digital solutions tailored to meet your unique business needs.


About Us

We are a dynamic web development agency based in New Delhi, offering comprehensive services in web design, development, and digital marketing. With a team of highly skilled professionals, we are passionate about creating websites that not only look great but also deliver exceptional user experiences and functionality.

Our mission is to empower businesses of all sizes to establish a strong online presence, improve engagement, and achieve their digital goals through high-performance web solutions.


Our Services

We offer a wide range of services to help your business grow in the digital landscape:

1. Custom Web Development

  • Build responsive, user-friendly websites tailored to your needs.
  • Expertise in HTML, CSS, JavaScript, React, Angular, Vue.js, and more.
  • CMS development (WordPress, Joomla, Drupal).

2. E-commerce Solutions

  • Development of secure and scalable online stores.
  • Integration with payment gateways (PayPal, Stripe, Razorpay, etc.).
  • Platforms: Shopify, WooCommerce, Magento, BigCommerce.

3. Web Design & UI/UX

  • Intuitive and visually appealing web designs.
  • User-centric designs that improve user engagement.
  • Wireframes, prototypes, and mockups using tools like Figma and Adobe XD.

4. SEO & Digital Marketing

  • Improve your website’s search engine ranking with our SEO services.
  • Social media management, PPC campaigns, email marketing.
  • Brand strategy and online reputation management.

5. Mobile App Development

  • Cross-platform mobile apps for Android and iOS.
  • Native apps, progressive web apps (PWAs), and hybrid solutions.

6. Web Maintenance & Support

  • Regular updates, backups, and security patches.
  • Ongoing support and troubleshooting.
  • Performance optimization for speed and scalability.

Why Choose Us?

  • Experienced Team: Our team consists of experienced developers, designers, and marketers who are passionate about bringing your ideas to life.

  • Tailored Solutions: We believe that every business is unique. We provide customized solutions that align with your business goals and target audience.

  • Cutting-edge Technology: We stay ahead of the curve by adopting the latest technologies and industry best practices to ensure your project is built for the future.

  • Client-Centric Approach: We value communication and transparency throughout the development process. Your satisfaction is our priority.

  • Competitive Pricing: We offer high-quality solutions at competitive prices, making us the perfect choice for businesses of all sizes.

  • Timely Delivery: We understand the importance of deadlines and ensure that projects are completed on time, without compromising quality.


Our Process

  1. Discovery & Planning: Understanding your requirements, goals, and target audience.
  2. Design & Prototyping: Creating wireframes, mockups, and prototypes to define the visual direction.
  3. Development: Building the website or application with the latest technologies.
  4. Quality Assurance: Testing across devices and browsers to ensure functionality and performance.
  5. Launch & Maintenance: Deploying the project and providing ongoing support and updates.

Technologies We Use

We work with a variety of technologies to create high-performance websites and applications:

  • Frontend: HTML5, CSS3, JavaScript, React, Angular, Vue.js
  • Backend: Node.js, Python (Django, Flask), PHP, Ruby on Rails
  • Databases: MySQL, MongoDB, PostgreSQL
  • CMS: WordPress, Joomla, Drupal
  • E-commerce: Shopify, WooCommerce, Magento, OpenCart
  • Mobile Apps: React Native, Flutter, Swift, Kotlin

Our Clients

We have worked with businesses of all sizes, from startups to large enterprises. Our diverse portfolio spans various industries, including e-commerce, healthcare, education, finance, and more.


Get in Touch

Are you ready to build your digital presence? Let’s talk!

  • 📧 Email: webreca@gmail.com
  • ☎️ Phone: +91-9999577620
  • 📍 Office Address: M-4, New Police Line, Kingsway Camp, New Delhi, India 110009

Follow us on social media for the latest updates:


Careers

We’re always looking for talented developers, designers, and marketers to join our growing team. If you're passionate about web development and want to work in a collaborative, innovative environment, check out our careers page for open positions.


License

This project is licensed under the MIT License.


Acknowledgments

We’d like to acknowledge our talented team, our loyal clients, and the technologies that empower us to deliver excellent digital experiences.

drawing


Thank you for considering us for your next project! We look forward to partnering with you.

About

Laravel Migrations & Seeder Generator: Automatically generate your migrations from an existing database schema.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages