Should we add the migrations to the git repository
Today, we had a question and discussion here, about the adding of the migrations to the git repository.
Whats the statement of spryker or the other devs here?
src/Orm/Propel/* ?
Best Answer
-
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,056 ⚖️ - Guardians (admin)
Heyhey @marco.kaiser ,
does this docs page answer your question?
So currently the following seems to be the way to go (at least what is intended by Spryker):
1. We normally do not work with migrations during project development (they’re generated from scratch each time on project install)
2. when project goes live, migrations has to be enabled and pushed to repo
Is the linked docs-page helpful? If not, what would have helped you better in that case?
All the best,
Florian3
Answers
-
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,056 ⚖️ - Guardians (admin)
Heyhey @marco.kaiser ,
does this docs page answer your question?
So currently the following seems to be the way to go (at least what is intended by Spryker):
1. We normally do not work with migrations during project development (they’re generated from scratch each time on project install)
2. when project goes live, migrations has to be enabled and pushed to repo
Is the linked docs-page helpful? If not, what would have helped you better in that case?
All the best,
Florian3 -
Perfect, thats fits. :)
1 -
I have an additional question to the migration files, how to handle tasks like removing customers, permissions or any kind of data from the database. How should we handle such requests?
1 -
Hi, @marco.kaiser !
From my experience, live projects are using some sort of data ans structure migrations.
OOTB Spryker provides Propel migrations as a tool to make this work.
My recommendation:
- make sure on production you do not run propel:install, rather only
migrate
andmodel:build.
- make sure to create an initial migration to create full DB.
- upon every DB change, you have to create a migration and commit it.
- there's no need to merge multiple migrations from different commits, though keeping migrations in one file for a single commit/feature makes code-review easier.
- when some data migration or raw import is required, then you create another manual Propel migration.
- Also I would recommend creating separate data and structure migrations, including a comment and a link to a ticket into data migrations.
Warning! you have to carefully check each released code to assure that only correct Propel migrations are committed.
3 - make sure on production you do not run propel:install, rather only
-
But in contrast to the documentation you mentioned @fsmeier, the code in the suite (production install recipe) exactly does this "migration:delete". We for example have projects where we do not commit the migrations at all and do every deployment with "delete existing migrations, generate diff, apply diff" and it works well so far.
0 -
sebastian.wagner enrolled to Back End Development Basics Spryker Solution Partner Posts: 9 🧑🏻🚀 - Cadet
@s.kroll so your table
propel_migrations
now contains timestamps where no php migration files exist for?0 -
@sebastian.wagner exactly.
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 69 Spryker News
- 896 Developer Corner
- 758 Spryker Development
- 83 Spryker Dev Environment
- 361 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 23 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 68 Spryker Safari Questions
- 50 Random