verbb / tablemaker

A user-definable table field type for Craft CMS
MIT License
40 stars 32 forks source link

Migration of existing Craft 2 table maker field type #16

Closed jamesmacwhite closed 2 years ago

jamesmacwhite commented 5 years ago

It doesn't look like the Craft 3 version handles existing Craft 2 Table Maker fields when coming from a migration. Is this something that could be possible?

In an existing Craft 2 project we use the Table Maker field within a body matrix block on various entries. It would be nice to have this data migrated.

Thanks,

jamesmacwhite commented 5 years ago

Looks like the Table Maker Craft 3 plugin is pretty much the same as the Craft 2 version data structure wise. For anyone coming from Craft 2, here's a content migration will update the field type for you:

https://gist.github.com/jamesmacwhite/02f23169d2967100cb0ce675d7e1a95e

Any previous settings should be maintained and table maker data should be present.

martinsmith commented 5 years ago

Hello, how do I use the migration script?

jamesmacwhite commented 5 years ago

@martinsmith Is it a content migration

https://docs.craftcms.com/v3/extend/migrations.html

Content migrations are an extension of the migration feature in Craft 3.

martinsmith commented 5 years ago

Hi, i'm not sure? In the CP I see this

image
martinsmith commented 5 years ago

On the front end I see "Impossible to access an attribute ("table") on a null variable."

jamesmacwhite commented 5 years ago

Content migrations need to be executed either via CI or manually through Craft CLI.

https://docs.craftcms.com/v3/extend/migrations.html#executing-migrations.

martinsmith commented 5 years ago

Thanks... so I created a .php file containing your code on my desktop. I've CD'd to my Craft project.. I entered ./craft migrate/up --plugin=tablemaker but I get -bash: ./craft: Permission denied.

martinsmith commented 5 years ago

Getting closer... now getting "Invalid plugin handle: tablemaker"

jamesmacwhite commented 5 years ago

For content migrations, you don't specify the plugin, you can simply run:

./craft migrate/up or ./craft migrate/all

martinsmith commented 5 years ago

Sorry, this isn't working for me. I get the following error in Terminal:

Exception 'craft\errors\DbConnectException' with message 'Craft CMS can’t connect to the database with the credentials in config/db.php.'

in /Users/Martin/Desktop/vic3/httpdocs/vendor/craftcms/cms/src/db/Connection.php:179

jamesmacwhite commented 5 years ago

At this point that's an error from Craft itself not related to anything with this plugin or the migration. Craft CLI cannot connect to the DB config specified. You might want to ask in the Craft Discord for further help, as this is Craft setup issue:

https://docs.craftcms.com/v3/ https://craftcms.com/community

engram-design commented 2 years ago

This is waaaay out of date now, but thanks to your own fixes @jamesmacwhite these have been rolled in for the next release.