Skip to content

Add DB schema for company membership mapping (keycloak_user_id, company_id, role)** #13

@JulienLouisSchneider

Description

@JulienLouisSchneider

Issue 3 — Add DB schema for company membership mapping (keycloak_user_id, company_id, role)

Description

Introduce a minimal “membership” storage in Postgres so the backend can map a Keycloak user (sub) to a company and role. This replaces storing identity data (password/email) in this service.

Checklist

  • Create a migration (whatever mechanism the project uses) to add a new table (recommended) company_members:

    • id bigserial primary key

    • keycloak_user_id text not null unique

    • company_id bigint not null references companies(id)

    • role text not null (company_owner|company_admin|member)

    • created_at, updated_at

    • index on (company_id)

  • Add role constants in internal/customer/user (or a new membership package).

  • (Optional but recommended) add a constraint to prevent invalid roles.

  • Ensure migrations run in Docker Compose workflow.

Acceptance Criteria

  • Table exists and is queryable via psql.

  • Can insert a membership row and fetch it by keycloak_user_id.

  • keycloak_user_id is unique (no duplicates).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions