Page MenuHomePhorge

Always run the seeder when horizon starts
AbandonedPublic

Authored by mollekopf on Dec 10 2024, 3:06 PM.
Tags
None
Referenced Files
F18262484: D5058.id14476.diff
Sat, Jan 25, 4:29 PM
F18261480: D5058.id.diff
Sat, Jan 25, 2:57 PM
Unknown Object (File)
Fri, Jan 24, 2:59 PM
Unknown Object (File)
Fri, Jan 24, 9:23 AM
Unknown Object (File)
Thu, Jan 23, 1:51 PM
Unknown Object (File)
Wed, Jan 22, 7:40 PM
Unknown Object (File)
Tue, Jan 14, 4:00 AM
Unknown Object (File)
Sat, Jan 4, 6:26 AM
Subscribers

Details

Reviewers
machniak
Group Reviewers
Restricted Project
Summary

But make sure we take into existing entries into account.

This enables us to add new entries to the seeder, so they will be
automatically created in existing deployments on horizon restart (or
when triggering the seeder manually).

This is better than using migrations because:

  • We avoid issues from seeder and migrations both trying to create the same entries.
  • We don't mix database layout and content changes. Content changes as migration can be problematic if the state that the migration expects wasn't actually created by the migration.

Seeders at least must take into account being rerun, where it makes
sense a seeder can also update already created entries with new
configuration values.

Diff Detail

Repository
rK kolab
Branch
dev/mollekopf
Lint
Lint Skipped
Unit
No Test Coverage
Build Status
Buildable 52420
Build 18590: arc lint + arc unit

Event Timeline

mollekopf created this revision.
mollekopf added a reviewer: Restricted Project.Dec 10 2024, 3:06 PM

TODO:

  • FIgure out if this is actually compatible with existing deployments
  • Do we have to use withEnvTenantContext in various places?
machniak subscribed.
machniak added inline comments.
config.prod/src/database/seeds/AdminSeeder.php
155

We use tenant_id when looking for SKUs above, we should do the same here.

156

This part about SKUs and packages is problematic. Let's say you installed Kolab and changed packages definitions. We should not force 'kolab' package, should we? How about we skip package creation if any package exist (any name)? Maybe it's not a problem with SKUs, I'm not sure.

217

We should check for the package existence separately from the domain existence.

config.prod/src/database/seeds/ImapAdminSeeder.php
29

$user->save();

config.prod/src/database/seeds/PassportSeeder.php
21

We should probably add user_id=null check to WHERE. In case in the future users will be registering their own clients. I don't think 'name' is a unique column.