public.devices
Description
Labels
svc-portal
Columns
| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| device_id | uuid | false | public.iot_credentials public.orders public.app_update_logs public.device_app_versions | |||
| serial_number | varchar(64) | false | ||||
| client_id | varchar(50) | false | ||||
| device_name | varchar(255) | true | ||||
| device_code | varchar(50) | true | ||||
| public_key_pem | text | false | ||||
| merchant_id | integer | true | public.merchants | |||
| store_id | integer | true | public.stores | |||
| status | varchar(50) | false | ||||
| activation_code | varchar(12) | true | ||||
| activation_code_expires_at | timestamp with time zone | true | ||||
| activated_at | timestamp with time zone | true | ||||
| activated_by_user_id | varchar(36) | true | ||||
| created_at | timestamp with time zone | false | ||||
| updated_at | timestamp with time zone | false | ||||
| last_token_request_at | timestamp with time zone | true | ||||
| last_connected_at | timestamp with time zone | true | ||||
| staff_pin_hash | varchar(255) | true | ||||
| admin_pin_hash | varchar(255) | true | ||||
| is_deactive | boolean | false | false |
Viewpoints
| Name | Definition |
|---|---|
| Merchant Hierarchy | Multi-tenant hierarchy — PSP → Merchant → Store → Staff/Devices |
Constraints
| Name | Type | Definition |
|---|---|---|
| devices_merchant_id_fkey | FOREIGN KEY | FOREIGN KEY (merchant_id) REFERENCES merchants(id) ON DELETE RESTRICT |
| devices_store_id_fkey | FOREIGN KEY | FOREIGN KEY (store_id) REFERENCES stores(id) ON DELETE RESTRICT |
| devices_pkey | PRIMARY KEY | PRIMARY KEY (device_id) |
Indexes
| Name | Definition |
|---|---|
| devices_pkey | CREATE UNIQUE INDEX devices_pkey ON public.devices USING btree (device_id) |
| ix_devices_activation_code | CREATE INDEX ix_devices_activation_code ON public.devices USING btree (activation_code) |
| ix_devices_client_id | CREATE UNIQUE INDEX ix_devices_client_id ON public.devices USING btree (client_id) |
| ix_devices_merchant_id | CREATE INDEX ix_devices_merchant_id ON public.devices USING btree (merchant_id) |
| ix_devices_serial_number | CREATE UNIQUE INDEX ix_devices_serial_number ON public.devices USING btree (serial_number) |
| ix_devices_status | CREATE INDEX ix_devices_status ON public.devices USING btree (status) |
| ix_devices_store_id | CREATE INDEX ix_devices_store_id ON public.devices USING btree (store_id) |
Relations
Generated by tbls