Organizations & Plans
Overview
This domain contains a single table, organization, the top-level tenant boundary of the system.
Every major table carries an organization_id to keep customer data separated. Plan quotas are not
stored in a separate table — they live in the max_channel and plan_limits (JSONB) columns of
this table.
Table organization
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | INTEGER | NOT NULL | nextval (serial) | Primary key of the organization |
logo | TEXT | NULL | – | URL/path of the organization logo |
name | TEXT | NOT NULL | – | Organization name |
status | CommonStatus (enum) | NOT NULL | – | Organization status (active, inactive, delete, etc.) |
max_channel | INTEGER | NOT NULL | 5 | Maximum number of LINE OA channels this organization may create |
created_date | TIMESTAMPTZ(3) | NOT NULL | CURRENT_TIMESTAMP | Creation timestamp |
created_by | INTEGER | NOT NULL | 0 | User id of the creator |
updated_date | TIMESTAMPTZ(3) | NULL | – | Last update timestamp (Prisma @updatedAt) |
updated_by | INTEGER | NULL | 0 | User id of the last editor |
deleted_date | TIMESTAMPTZ(3) | NULL | – | Soft-delete timestamp (NULL = not deleted) |
plan_limits | JSONB | NULL | – | Per-organization quota overrides; NULL = use platform defaults |
Notes
plan_limitsis a column, not a table. It was added later via manual SQL (manual-sql/7.plan_limits.sql) withALTER TABLE organization ADD COLUMN IF NOT EXISTS plan_limits JSONB, so it does not appear inschema.prisma.- The
plan_limitspayload is a JSON object with these keys (example: the 1Moby platform organization atid = 1):{"maxSegments":-1,"maxActiveWorkflows":-1,"maxTemplates":-1,"maxAttributes":-1,"autoRefresh":true}where-1means unlimited. Platform defaults live in cms-api atsrc/plan-limits/plan-limits.constant.ts. - The channel quota is not part of
plan_limits; it still uses themax_channelcolumn. - An index on
deleted_datesupports queries that exclude soft-deleted rows. - This table is referenced by the
organization_idforeign key fromuser,line_oa,campaign,tracking_log,friend_track_campaignandorganization_module. - Tables
admin_planandadmin_audit_logdo not exist anywhere in the system — verified againstschema.prisma, the preprod pg_dump and all manual SQL files.