Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add force-autoid config. #668

Open
wants to merge 3 commits into
base: 4.x
Choose a base branch
from
Open

Add force-autoid config. #668

wants to merge 3 commits into from

Conversation

dereuromark
Copy link
Member

@dereuromark dereuromark commented Dec 12, 2023

With the

'Migrations.unsigned_primary_keys'

we introduced some issues around baking a fresh snapshot.
The autoid gets cancelled with the slightest issue for ALL tables, making it super hard to clean that up.

I would like to propose a force-autoid config that allows to overwrite the "detected" one for those that want/need it.

I didnt quite figure out the proper twig syntax
Apprently this doesnt do it:

set autoId = forceAutoId OR not Migration.hasAutoIdIncompatiblePrimaryKey(tables['add'] + tables['remove'])

Any ideas?

Even setting it to

{% set autoId = true %}

doesnt work, is there some weird extra cache involved?


Alternatively, we could see if hasAutoIdIncompatiblePrimaryKey() could be applied per table, instead of per file.

Refs cakephp/bake#962

@dereuromark
Copy link
Member Author

Something is really wrong here
Even if I set 'Migrations.unsigned_primary_keys' tofalse it still prints the same thing.
As if that config doesnt have any effect anymore.

@ndm2
Copy link
Contributor

ndm2 commented Dec 12, 2023

I don't have time currently to get into the migrations stuff again, but you're talking about snapshots, and there is no change in the snapshot template, only in the diff template, which doesn't even receive the option, as it's only been added to the snapshot command.

@dereuromark
Copy link
Member Author

Thx, that explains it, I will recheck tomorrow

@markstory
Copy link
Member

Alternatively, we could see if hasAutoIdIncompatiblePrimaryKey() could be applied per table, instead of per file.

Isn't this the better option for end users? Instead of having to learn more flags to get the correct results, they can just use the default behavior which doesn't retain state between tables. That seems like a good improvement with less complexity exposed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants