Skip to content

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 ​

  1. The operator and the platform owner. ui5:intake writes them.
  2. The synced catalog. ui5:sync writes the roles, the abilities and the relationship types (employed_by among them) that the seeder refers to.
  3. The tenant. ui5:tenant writes it, with operator_for and the first admin.

What each person needs ​

WhatWhereWhy
The personsdk_partners, type PersonIt is what the SDK authorizes.
A loginusers, with partner_id setWithout the link, every request answers 403.
Role assignmentssdk_role_assignmentsThey open the apps. Partners and Settings need local_admin; the Launchpad needs no role.
Membershipsdk_partner_relationships, employed_by (or acts_for for someone working by commission), primaryNot 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_from defaults to now and valid_until to 9999-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 updateOrInsert or firstOrCreate. 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.