The First Seed
The SDK has no sign-up. Everyone who works in an installation is a partner. The first person who can sign in is written by ui5:tenant: the operator's admin, with a login and the roles of the upper levels. From there, people are seated in the Partners app, where every change runs the app's checks.
A seeder still earns its place for demo and training data: a training system that should open with a whole department in it, or a development database with realistic people. It is not how a production installation gets its first users.
Where it runs
Every database of an installation — development, test, production — is built by the same commands: migrate, ui5:intake, ui5:sync, ui5:tenant. A seeder comes after them, on the databases that want demo data, and never on production.
What must exist first
- The operator and the platform owner.
ui5:intakewrites them. - The synced catalog.
ui5:syncwrites the roles, the abilities and the relationship types (employed_byamong them) that the seeder refers to. - The tenant.
ui5:tenantwrites it, withoperator_forand the first admin.
What each person needs
| What | Where | Why |
|---|---|---|
| The person | sdk_partners, type Person | It is what the SDK authorizes. |
| A login | users, with partner_id set | Without the link, every request answers 403. |
| Role assignments | sdk_role_assignments | They open the apps. Partners and Settings need local_admin; the Launchpad needs no role. |
| Membership | sdk_partner_relationships, employed_by (or acts_for for someone working by commission), primary | Not needed to sign in. Without it, primaryOrgPartner() and everything scoped to the actor's organisation return nothing. |
Every relationship and assignment follows two rules:
- Someone granted it. Each row names the partner who granted it (
assigned_by_partner_id, required). In a seeder, name the first admin or the operator as the author. - It is time-bound.
valid_fromdefaults to now andvalid_untilto9999-12-31 23:59:59. Set them when an assignment has to start or end on a date.
The system level grants nothing. A person's system_level decides which settings scope they may write. It does not open a single app. Access comes only from role and ability grants. A seeded admin who sees an empty navigation rail is almost always missing the role assignment.
The pattern
A demo seeder writes, for every person, the rows in the table above — the person, the membership, the role assignments, the login — and stays safe to run again:
- Key every row on something stable, usually the email, and write with
updateOrInsertorfirstOrCreate. The seeder can then run again after a correction. - Seed demo data only. The interface for partners is the Partners app, not code. Every change made there runs the app's checks, such as the rule that a person has only one primary membership or that a rung of the ladder has one holder. Raw inserts skip those checks, which is fine for demo data and only there.
- Login objects: the seeder can create them with initial passwords. It can also leave them to the Partners app, which creates them with a password change required at the first sign-in.
After the seed
Everyone else is created in the Partners app — first by the admin ui5:tenant seated, then by the local admins they appoint: partners, memberships, logins and roles.
A hand-written seeder is right for one company. Doing it for every customer is a different job. It means scoping a finished solution against what the customer needs, then fit-to-standard, training, sign-off and go-live, and it calls for a method. Pragmatiqu IT's method for that, from discovery to go-live, is part of Platform.