-
Notifications
You must be signed in to change notification settings - Fork 116
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
Feature request: add feature flag to disable adding entry to phinxlog table on snapshot generation #556
Comments
I saw that you had your version as 2.4.2. We're unlikely to do any additional feature work on 2.x and any additions` will be done on 3.x (cake 4) instead. |
So you're looking to create a 'phantom' migration? A migration that both exists as a file but doesn't exist in the database log of migrations that have been run? Would you also expect that this flag/option would result in the generated migration snapshot be run in the next I also think that even with the current behavior of |
Yes, this is exactly correct 😄 I know it sounds strange, but the reason for this is that my unit tests are configured to run this "migration" to set up the test database prior to running. I have an extremely large database, and it is easier to do it this way than to manage all my fields in my fixture files. It is very convenient for the test runner to just detect a single migration file and ensure the table structure is up-to-date. The trouble is, once I generate this file with the bake command, then move it to the
OK, thank you.
I will look into this as a solution, thanks! |
Update: I'm now using the 3.x version of the plugin and this feature would still be a wonderful thing to have for my workflow, on several projects. It could be as simple as a Folks in the community have suggested solutions involving rollbacks and also special checks that would disable the test migration in certain scenarios, but none of those solutions meet my true base use case, which is I just want to generate a single migration file containing nothing but my schema, and then exit. So, since the feature is still nice-to-have on the active development version (3.x), can we consider this feature request again please? 😸 |
Anyone able to make a PR here? |
This is a (multiple allowed):
bug
enhancement
feature-discussion (RFC)
CakePHP Version: 3.10.4
Migrations plugin version: 2.4.2
Bake plugin version (if relevant): 1.12.0
Database server (MySQL, SQLite, Postgres): MySQL Community Server (GPL) 5.7.37 x86_64
PHP Version: 7.4.29
Platform / OS: Devilbox (XAMPP-like Docker container) running on macOS Big Sur 11.6.1
What you did
./bin/cake bake migration_snapshot MySnapshot
Expected Behavior
I would like for the entry in the phinxlog table to not be generated, if possible. Perhaps via a CLI switch to bake (
--no-phinxlog
)Actual Behavior
As specified in the docs, once the snapshot is generated a new entry is added to phinxlog and it is marked as migrated.
That's nice for most, but my workflow is to immediately move the generated migration out of the main directory to another one because it is specifically generated for the unit tests. So when I then run
./bin/cake migrations status
I get** MISSING **
next to it.I would prefer to be able to specify not to generate the phinxlog table entry, if possible. I checked the docs and I do not see support for any such flag.
The text was updated successfully, but these errors were encountered: