Files
huike-back/htykc_models/migrations/2026-04-27-193400_create_clazz_leave_request/up.sql
T
weli c5134c9356 feat(org): enforce tenant isolation in ws/kc with leave and stats APIs
Add org_id schema migrations and service-level filtering for teacher-student and class workflows, then cover org-context behavior with focused unit/e2e tests for leave and hour statistics.

Made-with: Cursor
2026-04-27 20:12:02 +08:00

35 lines
986 B
SQL

create table clazz_leave_request
(
id varchar not null,
org_id varchar not null,
clazz_id varchar not null
constraint clazz_leave_request_clazz_id_fk
references clazz (id),
student_id varchar not null,
teacher_id varchar,
leave_type varchar not null,
reason varchar,
request_status varchar not null default 'PENDING',
created_at timestamp not null default now(),
created_by varchar,
reviewed_at timestamp,
reviewed_by varchar,
is_delete boolean not null default false
);
create unique index clazz_leave_request_id_uindex
on clazz_leave_request (id);
alter table clazz_leave_request
add constraint clazz_leave_request_pk
primary key (id);
create index idx_clazz_leave_request_org_id
on clazz_leave_request (org_id);
create index idx_clazz_leave_request_clazz_id
on clazz_leave_request (clazz_id);
create index idx_clazz_leave_request_student_id
on clazz_leave_request (student_id);