This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Hi, Is there a quick way/command to create migration files for existing tables?

I'm working on a project where I had to migrate an old site, with lots on data and tables. In many cases I copied tables or views from the old database to the new one so now I have 8 plugins and lots of tables without migration files.

Is there a way to create them automatically?

Last updated

No, you'll need to do this manually.

mjauvin said:

No, you'll need to do this manually.

Thank you.

Maybe try this?

https://www.google.com/amp/s/5balloons.info/create-migration-files-from-existing-database-in-laravel/amp/

mjauvin said:

Maybe try this?

https://www.google.com/amp/s/5balloons.info/create-migration-files-from-existing-database-in-laravel/amp/

This is looks promising thank you. I was about to try to extend/modify the builder plugin. I figured out that if I send null value to createOrUpdateTable($newSchema, $existingSchema, $newTableName); for existingSchema parameter, from generateCreateOrUpdateMigration() I'm almost there (I mean to create them with one click from buidler). Just need to avoid the actual table creation...

Last updated

This >mjauvin said:

Maybe try this?

https://www.google.com/amp/s/5balloons.info/create-migration-files-from-existing-database-in-laravel/amp/

This needed some composer updates, did all, now I'm getting: Missing vendor files, try running "composer install" or use the Wizard installer.

I guess it removed carbon 1 and installed carbon 2.

Did you install october with composer?

mjauvin said:

Did you install october with composer?

Nope, I realized that was the problem. I got evertyhing removed, left only with the laravel package...

See here for switching to a composer install.

Note: To use composer with an October instance that has been installed using the Wizard installation, simply copy the tests/ directory and composer.json file from GitHub into your October instance and then run composer install.

mjauvin said:

See here for switching to a composer install.

Note: To use composer with an October instance that has been installed using the Wizard installation, simply copy the tests/ directory and composer.json file from GitHub into your October instance and then run composer install.

Thank you. I had to move on and decided to create the migration files half manually... I already have them now. But I appreciate your help.

Last updated

1-10 of 10

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.