Align admin, community, search, library, learning and course management with the mockup. Add saved courses, download history, public community feed, instructor directory, backend search, course views, admin content tools and community moderation. Harden API and Nginx for production.
25 lines
1.1 KiB
SQL
25 lines
1.1 KiB
SQL
-- Course view counters shown in the catalogue and in the management screen.
|
|
alter table courses
|
|
add column if not exists view_count integer not null default 0;
|
|
|
|
-- Courses saved by a learner. Stored server-side so the list follows the account.
|
|
create table if not exists saved_courses (
|
|
user_id uuid not null references users(id) on delete cascade,
|
|
course_id uuid not null references courses(id) on delete cascade,
|
|
created_at timestamptz not null default now(),
|
|
primary key (user_id, course_id)
|
|
);
|
|
|
|
create index if not exists saved_courses_course_index on saved_courses (course_id);
|
|
|
|
-- Download history for the "Meus downloads" screen. It replaces the previous
|
|
-- browser-only list, so the history follows the account across devices.
|
|
create table if not exists download_history (
|
|
user_id uuid not null references users(id) on delete cascade,
|
|
asset_id uuid not null references assets(id) on delete cascade,
|
|
downloaded_at timestamptz not null default now(),
|
|
primary key (user_id, asset_id)
|
|
);
|
|
|
|
create index if not exists download_history_user_index on download_history (user_id, downloaded_at desc);
|