What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hi, I have a question regarding the IndexGenerator. When we run the IndexGenerator it will create so

Posts: 69 πŸ§‘πŸ»β€πŸš€ - Cadet

Hi, I have a question regarding the IndexGenerator.
When we run the IndexGenerator it will create some schema definition files in Pyz/Zed/IndexGenerator/Persistence/Propel/Schema where missing indices will be defined.
However when you run the IndexGenerator once again, it will delete those files. I assume this happens, because IndexGenerator will find the indices already exist in the database and hence no additional files are required.
So far we used to put the generated files under version control, but I think there is a misunderstanding on our end.
How is the intended way to use the IndexGenerator? Would it be the intended way to copy the schema files or their content into the specific module folders the files belong to?
Happy about any advice πŸ™‚

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • Posts: 118 πŸ§‘πŸ»β€πŸš€ - Cadet

    If you track your migration files that should not be an issue

  • Posts: 69 πŸ§‘πŸ»β€πŸš€ - Cadet

    How would tracking migration files help here?

  • Posts: 118 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited December 2021

    As far as I understood, the index generator scans the database for missing indexes and creates schema files for them. Once these schema files are created you can create a migration that includes the respective changes that need to get applied to the tables. Once this migration is created you won't need the schema files any more.
    If you track the migrations, your good

  • Posts: 69 πŸ§‘πŸ»β€πŸš€ - Cadet

    But when you run the IndexGenerator again, the files will be removed. Hence subsequently generated migration will also delete the indices.

  • Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

    The Index Generator does not scan the database, but only the schema files. We use it in a CI job, that not even has a running database service.

  • Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

    The files are removed, because the generated index is already copied/merged to src/Orm/Propel/MDE/Schema probably

  • Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

    The files in src/Pyz/Zed/IndexGenerator/Persistence/Propel/Schema are also in our repository and are not ignored

  • Posts: 69 πŸ§‘πŸ»β€πŸš€ - Cadet

    My main question is, if the generated files should remain in the folder or moved around.

  • Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

    They remain in the folder (src/Pyz/Zed/IndexGenerator/Persistence/Propel/Schema) in our project. It does not make any difference, since vendor/bin/console propel:schema:copy will iterate over all schema files from all modules, merge them and copy the result to src/Orm/Propel/MDE/Schema.

  • Posts: 69 πŸ§‘πŸ»β€πŸš€ - Cadet

    But this folder is excluded from VC by default.

  • Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

    You mean src/Orm/Propel/MDE/Schema?

  • Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

    This makes sense, since these are only generated files, based on what you have in your modules. Think of it as a representation of your database schema on the filesystem.

  • Posts: 69 πŸ§‘πŸ»β€πŸš€ - Cadet

    Yes and so it does not solve the issue.

  • Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

    Did you already try the script I posted?

  • Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

    We had the exact same issue and this is our solution

Welcome!

It looks like you're new here. Sign in or register to get started.