{ "id": "458f314e-df26-4036-ad02-c44b68107eee", "prevId": "9ccf335b-2099-4113-aaae-a18f4594cab0", "version": "7", "dialect": "postgresql", "tables": { "public.account": { "name": "account", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "default": "uuid_generate_v4()" }, "account_id": { "name": "account_id", "type": "text", "primaryKey": false, "notNull": true }, "provider_id": { "name": "provider_id", "type": "text", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "uuid", "primaryKey": false, "notNull": true }, "access_token": { "name": "access_token", "type": "text", "primaryKey": false, "notNull": false }, "refresh_token": { "name": "refresh_token", "type": "text", "primaryKey": false, "notNull": false }, "id_token": { "name": "id_token", "type": "text", "primaryKey": false, "notNull": false }, "access_token_expires_at": { "name": "access_token_expires_at", "type": "timestamp", "primaryKey": false, "notNull": false }, "refresh_token_expires_at": { "name": "refresh_token_expires_at", "type": "timestamp", "primaryKey": false, "notNull": false }, "scope": { "name": "scope", "type": "text", "primaryKey": false, "notNull": false }, "password": { "name": "password", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { "account_user_id_user_id_fk": { "name": "account_user_id_user_id_fk", "tableFrom": "account", "tableTo": "user", "columnsFrom": ["user_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.analytics_login_events": { "name": "analytics_login_events", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuid_generate_v4()" }, "user_id": { "name": "user_id", "type": "uuid", "primaryKey": false, "notNull": true }, "logged_in_at": { "name": "logged_in_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": { "idx_analytics_login_events_logged_in_at": { "name": "idx_analytics_login_events_logged_in_at", "columns": [ { "expression": "logged_in_at", "isExpression": false, "asc": true, "nulls": "last", "opclass": "timestamptz_ops" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "idx_analytics_login_events_user_id": { "name": "idx_analytics_login_events_user_id", "columns": [ { "expression": "user_id", "isExpression": false, "asc": true, "nulls": "last", "opclass": "uuid_ops" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "analytics_login_events_user_id_fkey": { "name": "analytics_login_events_user_id_fkey", "tableFrom": "analytics_login_events", "tableTo": "user", "columnsFrom": ["user_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "analytics_login_events_user_id_unique": { "name": "analytics_login_events_user_id_unique", "nullsNotDistinct": false, "columns": ["user_id"] } }, "policies": { "Enable delete for users based on user_id": { "name": "Enable delete for users based on user_id", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"], "using": "(auth.uid() = user_id)" }, "Users can insert their own login events": { "name": "Users can insert their own login events", "as": "PERMISSIVE", "for": "INSERT", "to": ["authenticated"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.apps_poll": { "name": "apps_poll", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "question": { "name": "question", "type": "text", "primaryKey": false, "notNull": false }, "authorId": { "name": "authorId", "type": "uuid", "primaryKey": false, "notNull": false }, "isPublic": { "name": "isPublic", "type": "boolean", "primaryKey": false, "notNull": false }, "status": { "name": "status", "type": "varchar", "primaryKey": false, "notNull": false, "default": "'draft'" }, "expiration": { "name": "expiration", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "courseId": { "name": "courseId", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "apps_poll_authorId_fkey": { "name": "apps_poll_authorId_fkey", "tableFrom": "apps_poll", "tableTo": "groupmember", "columnsFrom": ["authorId"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "apps_poll_courseId_fkey": { "name": "apps_poll_courseId_fkey", "tableFrom": "apps_poll", "tableTo": "course", "columnsFrom": ["courseId"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Delete only your own poll": { "name": "Delete only your own poll", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"], "using": "(auth.uid() = ( SELECT groupmember.profile_id\n FROM groupmember\n WHERE (groupmember.id = apps_poll.\"authorId\")))" }, "Update only your own": { "name": "Update only your own", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] }, "User must be a course member to INSERT": { "name": "User must be a course member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "User must be course member to SELECT": { "name": "User must be course member to SELECT", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.apps_poll_option": { "name": "apps_poll_option", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "apps_poll_option_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "poll_id": { "name": "poll_id", "type": "uuid", "primaryKey": false, "notNull": false }, "label": { "name": "label", "type": "varchar", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "apps_poll_option_poll_id_fkey": { "name": "apps_poll_option_poll_id_fkey", "tableFrom": "apps_poll_option", "tableTo": "apps_poll", "columnsFrom": ["poll_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "User must be a course member to INSERT": { "name": "User must be a course member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"], "withCheck": "is_user_in_course_group_or_admin(( SELECT groupmember.group_id\n FROM groupmember\n WHERE (groupmember.id = ( SELECT apps_poll.\"authorId\"\n FROM apps_poll\n WHERE (apps_poll.id = apps_poll_option.poll_id)\n LIMIT 1))\n LIMIT 1))" }, "User must be a course member to UPDATE": { "name": "User must be a course member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] }, "User must be a teacher to DELETE": { "name": "User must be a teacher to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "User must be course member to SELECT": { "name": "User must be course member to SELECT", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.apps_poll_submission": { "name": "apps_poll_submission", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "apps_poll_submision_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "poll_option_id": { "name": "poll_option_id", "type": "bigint", "primaryKey": false, "notNull": false }, "selected_by_id": { "name": "selected_by_id", "type": "uuid", "primaryKey": false, "notNull": false }, "poll_id": { "name": "poll_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "apps_poll_submission_poll_id_fkey": { "name": "apps_poll_submission_poll_id_fkey", "tableFrom": "apps_poll_submission", "tableTo": "apps_poll", "columnsFrom": ["poll_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "apps_poll_submission_poll_option_id_fkey": { "name": "apps_poll_submission_poll_option_id_fkey", "tableFrom": "apps_poll_submission", "tableTo": "apps_poll_option", "columnsFrom": ["poll_option_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "apps_poll_submission_selected_by_id_fkey": { "name": "apps_poll_submission_selected_by_id_fkey", "tableFrom": "apps_poll_submission", "tableTo": "groupmember", "columnsFrom": ["selected_by_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Authenticated users can read": { "name": "Authenticated users can read", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "(auth.uid() IS NOT NULL)" }, "Delete your own submission": { "name": "Delete your own submission", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "Enable insert for authenticated users only": { "name": "Enable insert for authenticated users only", "as": "PERMISSIVE", "for": "INSERT", "to": ["authenticated"] }, "Update your own submission": { "name": "Update your own submission", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.community_answer": { "name": "community_answer", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "extensions.gen_random_uuid()" }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "question_id": { "name": "question_id", "type": "bigint", "primaryKey": false, "notNull": false }, "body": { "name": "body", "type": "varchar", "primaryKey": false, "notNull": false }, "author_id": { "name": "author_id", "type": "bigint", "primaryKey": false, "notNull": false }, "votes": { "name": "votes", "type": "bigint", "primaryKey": false, "notNull": false }, "author_profile_id": { "name": "author_profile_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "community_answer_author_id_fkey": { "name": "community_answer_author_id_fkey", "tableFrom": "community_answer", "tableTo": "organizationmember", "columnsFrom": ["author_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "community_answer_author_profile_id_fkey": { "name": "community_answer_author_profile_id_fkey", "tableFrom": "community_answer", "tableTo": "profile", "columnsFrom": ["author_profile_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "community_answer_question_id_fkey": { "name": "community_answer_question_id_fkey", "tableFrom": "community_answer", "tableTo": "community_question", "columnsFrom": ["question_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Authenticated users can SELECT": { "name": "Authenticated users can SELECT", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "(auth.uid() IS NOT NULL)" }, "Delete your own answer": { "name": "Delete your own answer", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "Enable insert for authenticated users only": { "name": "Enable insert for authenticated users only", "as": "PERMISSIVE", "for": "INSERT", "to": ["authenticated"] }, "Update your own answer": { "name": "Update your own answer", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.community_question": { "name": "community_question", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "community_question_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "title": { "name": "title", "type": "varchar", "primaryKey": false, "notNull": false }, "body": { "name": "body", "type": "text", "primaryKey": false, "notNull": false }, "author_id": { "name": "author_id", "type": "bigint", "primaryKey": false, "notNull": false }, "votes": { "name": "votes", "type": "bigint", "primaryKey": false, "notNull": false, "default": "'0'" }, "organization_id": { "name": "organization_id", "type": "uuid", "primaryKey": false, "notNull": false }, "slug": { "name": "slug", "type": "text", "primaryKey": false, "notNull": false }, "author_profile_id": { "name": "author_profile_id", "type": "uuid", "primaryKey": false, "notNull": false }, "course_id": { "name": "course_id", "type": "uuid", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { "community_question_author_id_fkey": { "name": "community_question_author_id_fkey", "tableFrom": "community_question", "tableTo": "organizationmember", "columnsFrom": ["author_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "community_question_author_profile_id_fkey": { "name": "community_question_author_profile_id_fkey", "tableFrom": "community_question", "tableTo": "profile", "columnsFrom": ["author_profile_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "community_question_course_id_fkey": { "name": "community_question_course_id_fkey", "tableFrom": "community_question", "tableTo": "course", "columnsFrom": ["course_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "community_question_organization_id_fkey": { "name": "community_question_organization_id_fkey", "tableFrom": "community_question", "tableTo": "organization", "columnsFrom": ["organization_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Authenticated users can SELECT": { "name": "Authenticated users can SELECT", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "(auth.uid() IS NOT NULL)" }, "Delete your own question": { "name": "Delete your own question", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "Enable insert for authenticated users only": { "name": "Enable insert for authenticated users only", "as": "PERMISSIVE", "for": "INSERT", "to": ["authenticated"] }, "Update your own question": { "name": "Update your own question", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.course": { "name": "course", "schema": "", "columns": { "title": { "name": "title", "type": "varchar", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "varchar", "primaryKey": false, "notNull": true }, "overview": { "name": "overview", "type": "varchar", "primaryKey": false, "notNull": false, "default": "'Welcome to this amazing course 🚀 '" }, "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuid_generate_v4()" }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "group_id": { "name": "group_id", "type": "uuid", "primaryKey": false, "notNull": false }, "is_template": { "name": "is_template", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "logo": { "name": "logo", "type": "text", "primaryKey": false, "notNull": true, "default": "''" }, "slug": { "name": "slug", "type": "varchar", "primaryKey": false, "notNull": false }, "metadata": { "name": "metadata", "type": "jsonb", "primaryKey": false, "notNull": true, "default": "'{\"goals\":\"\",\"description\":\"\",\"requirements\":\"\"}'::jsonb" }, "cost": { "name": "cost", "type": "bigint", "primaryKey": false, "notNull": false, "default": "'0'" }, "currency": { "name": "currency", "type": "varchar", "primaryKey": false, "notNull": true, "default": "'USD'" }, "banner_image": { "name": "banner_image", "type": "text", "primaryKey": false, "notNull": false }, "is_published": { "name": "is_published", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "is_certificate_downloadable": { "name": "is_certificate_downloadable", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "certificate_theme": { "name": "certificate_theme", "type": "text", "primaryKey": false, "notNull": false }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "default": "'ACTIVE'" }, "type": { "name": "type", "type": "COURSE_TYPE", "typeSchema": "public", "primaryKey": false, "notNull": false, "default": "'LIVE_CLASS'" }, "version": { "name": "version", "type": "COURSE_VERSION", "typeSchema": "public", "primaryKey": false, "notNull": true, "default": "'V1'" } }, "indexes": {}, "foreignKeys": { "course_group_id_fkey": { "name": "course_group_id_fkey", "tableFrom": "course", "tableTo": "group", "columnsFrom": ["group_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "course_slug_key": { "name": "course_slug_key", "nullsNotDistinct": false, "columns": ["slug"] } }, "policies": { "Enable access to all users if PUBLIC or to course members when ": { "name": "Enable access to all users if PUBLIC or to course members when ", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "(is_published OR is_user_in_course_group_or_admin(group_id))" }, "User must be an org member to DELETE": { "name": "User must be an org member to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "User must be an org member to INSERT": { "name": "User must be an org member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "User must be an org member to UPDATE": { "name": "User must be an org member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.course_newsfeed": { "name": "course_newsfeed", "schema": "", "columns": { "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "author_id": { "name": "author_id", "type": "uuid", "primaryKey": false, "notNull": false }, "content": { "name": "content", "type": "text", "primaryKey": false, "notNull": false }, "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "course_id": { "name": "course_id", "type": "uuid", "primaryKey": false, "notNull": false }, "reaction": { "name": "reaction", "type": "jsonb", "primaryKey": false, "notNull": false, "default": "'{\"clap\":[],\"smile\":[],\"thumbsup\":[],\"thumbsdown\":[]}'::jsonb" }, "is_pinned": { "name": "is_pinned", "type": "boolean", "primaryKey": false, "notNull": true, "default": false } }, "indexes": {}, "foreignKeys": { "course_newsfeed_author_id_fkey": { "name": "course_newsfeed_author_id_fkey", "tableFrom": "course_newsfeed", "tableTo": "groupmember", "columnsFrom": ["author_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "course_newsfeed_course_id_fkey": { "name": "course_newsfeed_course_id_fkey", "tableFrom": "course_newsfeed", "tableTo": "course", "columnsFrom": ["course_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Delete your own comment": { "name": "Delete your own comment", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"], "using": "(auth.uid() = ( SELECT groupmember.profile_id\n FROM groupmember\n WHERE (groupmember.id = course_newsfeed.author_id)))" }, "Update only your own": { "name": "Update only your own", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] }, "User must be a course member to INSERT": { "name": "User must be a course member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "User must be a course member to SELECT": { "name": "User must be a course member to SELECT", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.course_newsfeed_comment": { "name": "course_newsfeed_comment", "schema": "", "columns": { "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "author_id": { "name": "author_id", "type": "uuid", "primaryKey": false, "notNull": false }, "content": { "name": "content", "type": "text", "primaryKey": false, "notNull": false }, "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "course_newsfeed_comment_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "course_newsfeed_id": { "name": "course_newsfeed_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "course_newsfeed_comment_author_id_fkey": { "name": "course_newsfeed_comment_author_id_fkey", "tableFrom": "course_newsfeed_comment", "tableTo": "groupmember", "columnsFrom": ["author_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "course_newsfeed_comment_course_newsfeed_id_fkey": { "name": "course_newsfeed_comment_course_newsfeed_id_fkey", "tableFrom": "course_newsfeed_comment", "tableTo": "course_newsfeed", "columnsFrom": ["course_newsfeed_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "course_newsfeed_comment_id_key": { "name": "course_newsfeed_comment_id_key", "nullsNotDistinct": false, "columns": ["id"] } }, "policies": { "Delete your own": { "name": "Delete your own", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"], "using": "(auth.uid() = ( SELECT groupmember.profile_id\n FROM groupmember\n WHERE (groupmember.id = course_newsfeed_comment.author_id)))" }, "Update only your own": { "name": "Update only your own", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] }, "User must be a course member to INSERT": { "name": "User must be a course member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "User must be a course member to SELECT": { "name": "User must be a course member to SELECT", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.currency": { "name": "currency", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "currency_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "name": { "name": "name", "type": "varchar", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.exercise": { "name": "exercise", "schema": "", "columns": { "title": { "name": "title", "type": "varchar", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "varchar", "primaryKey": false, "notNull": false }, "lesson_id": { "name": "lesson_id", "type": "uuid", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuid_generate_v4()" }, "due_by": { "name": "due_by", "type": "timestamp", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "exercise_lesson_id_fkey": { "name": "exercise_lesson_id_fkey", "tableFrom": "exercise", "tableTo": "lesson", "columnsFrom": ["lesson_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Enable read access for all users": { "name": "Enable read access for all users", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "true" }, "User must be an org member to DELETE": { "name": "User must be an org member to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "User must be an org member to INSERT": { "name": "User must be an org member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "User must be an org member to UPDATE": { "name": "User must be an org member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.group": { "name": "group", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuid_generate_v4()" }, "name": { "name": "name", "type": "varchar", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "organization_id": { "name": "organization_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "group_organization_id_fkey": { "name": "group_organization_id_fkey", "tableFrom": "group", "tableTo": "organization", "columnsFrom": ["organization_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Enable insert for authenticated users only": { "name": "Enable insert for authenticated users only", "as": "PERMISSIVE", "for": "INSERT", "to": ["authenticated"], "withCheck": "true" }, "Enable read access for all users": { "name": "Enable read access for all users", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"] }, "Only org admins can delete": { "name": "Only org admins can delete", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "Only org admins can update": { "name": "Only org admins can update", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.group_attendance": { "name": "group_attendance", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "group_attendance_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "course_id": { "name": "course_id", "type": "uuid", "primaryKey": false, "notNull": false }, "student_id": { "name": "student_id", "type": "uuid", "primaryKey": false, "notNull": false }, "is_present": { "name": "is_present", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "lesson_id": { "name": "lesson_id", "type": "uuid", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { "group_attendance_course_id_fkey": { "name": "group_attendance_course_id_fkey", "tableFrom": "group_attendance", "tableTo": "course", "columnsFrom": ["course_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "group_attendance_student_id_fkey": { "name": "group_attendance_student_id_fkey", "tableFrom": "group_attendance", "tableTo": "groupmember", "columnsFrom": ["student_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "User must be a course member to INSERT": { "name": "User must be a course member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"], "withCheck": "is_user_in_course_group_or_admin(( SELECT course.group_id\n FROM course\n WHERE (course.id = group_attendance.course_id)\n LIMIT 1))" }, "User must be a course member to SELECT": { "name": "User must be a course member to SELECT", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"] }, "User must be a course member to UPDATE": { "name": "User must be a course member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] }, "User must be an org member to DELETE": { "name": "User must be an org member to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.groupmember": { "name": "groupmember", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuid_generate_v4()" }, "group_id": { "name": "group_id", "type": "uuid", "primaryKey": false, "notNull": true }, "role_id": { "name": "role_id", "type": "bigint", "primaryKey": false, "notNull": true }, "profile_id": { "name": "profile_id", "type": "uuid", "primaryKey": false, "notNull": false }, "email": { "name": "email", "type": "varchar", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "assigned_student_id": { "name": "assigned_student_id", "type": "varchar", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "groupmember_group_id_fkey": { "name": "groupmember_group_id_fkey", "tableFrom": "groupmember", "tableTo": "group", "columnsFrom": ["group_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "groupmember_profile_id_fkey": { "name": "groupmember_profile_id_fkey", "tableFrom": "groupmember", "tableTo": "profile", "columnsFrom": ["profile_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "groupmember_role_id_fkey": { "name": "groupmember_role_id_fkey", "tableFrom": "groupmember", "tableTo": "role", "columnsFrom": ["role_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "unique_entries": { "name": "unique_entries", "nullsNotDistinct": false, "columns": ["group_id", "profile_id", "email"] }, "unique_group_email": { "name": "unique_group_email", "nullsNotDistinct": false, "columns": ["group_id", "email"] }, "unique_group_profile": { "name": "unique_group_profile", "nullsNotDistinct": false, "columns": ["group_id", "profile_id"] } }, "policies": { "Enable insert for authenticated users only": { "name": "Enable insert for authenticated users only", "as": "PERMISSIVE", "for": "INSERT", "to": ["authenticated"], "withCheck": "true" }, "Enable read access for all users": { "name": "Enable read access for all users", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"] }, "User must be an org member to DELETE": { "name": "User must be an org member to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "User must be an org member to UPDATE": { "name": "User must be an org member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.lesson": { "name": "lesson", "schema": "", "columns": { "note": { "name": "note", "type": "varchar", "primaryKey": false, "notNull": false }, "video_url": { "name": "video_url", "type": "varchar", "primaryKey": false, "notNull": false }, "slide_url": { "name": "slide_url", "type": "varchar", "primaryKey": false, "notNull": false }, "course_id": { "name": "course_id", "type": "uuid", "primaryKey": false, "notNull": true }, "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuid_generate_v4()" }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "title": { "name": "title", "type": "varchar", "primaryKey": false, "notNull": true }, "public": { "name": "public", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "lesson_at": { "name": "lesson_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "teacher_id": { "name": "teacher_id", "type": "uuid", "primaryKey": false, "notNull": false }, "is_complete": { "name": "is_complete", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "call_url": { "name": "call_url", "type": "text", "primaryKey": false, "notNull": false }, "order": { "name": "order", "type": "bigint", "primaryKey": false, "notNull": false }, "is_unlocked": { "name": "is_unlocked", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "videos": { "name": "videos", "type": "jsonb", "primaryKey": false, "notNull": false, "default": "'[]'::jsonb" }, "section_id": { "name": "section_id", "type": "uuid", "primaryKey": false, "notNull": false }, "documents": { "name": "documents", "type": "jsonb", "primaryKey": false, "notNull": false, "default": "'[]'::jsonb" } }, "indexes": {}, "foreignKeys": { "lesson_course_id_fkey": { "name": "lesson_course_id_fkey", "tableFrom": "lesson", "tableTo": "course", "columnsFrom": ["course_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "lesson_teacher_id_fkey": { "name": "lesson_teacher_id_fkey", "tableFrom": "lesson", "tableTo": "profile", "columnsFrom": ["teacher_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "public_lesson_section_id_fkey": { "name": "public_lesson_section_id_fkey", "tableFrom": "lesson", "tableTo": "lesson_section", "columnsFrom": ["section_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "cascade" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Enable read access for all users": { "name": "Enable read access for all users", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "true" }, "User must be an org member to DELETE": { "name": "User must be an org member to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "User must be an org member to INSERT": { "name": "User must be an org member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "User must be an org member to UPDATE": { "name": "User must be an org member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.lesson_comment": { "name": "lesson_comment", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "lesson_comment_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "lesson_id": { "name": "lesson_id", "type": "uuid", "primaryKey": false, "notNull": false }, "groupmember_id": { "name": "groupmember_id", "type": "uuid", "primaryKey": false, "notNull": false }, "comment": { "name": "comment", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "lesson_comment_groupmember_id_fkey": { "name": "lesson_comment_groupmember_id_fkey", "tableFrom": "lesson_comment", "tableTo": "groupmember", "columnsFrom": ["groupmember_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "lesson_comment_lesson_id_fkey": { "name": "lesson_comment_lesson_id_fkey", "tableFrom": "lesson_comment", "tableTo": "lesson", "columnsFrom": ["lesson_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Delete only your own comment": { "name": "Delete only your own comment", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"], "using": "(auth.uid() = ( SELECT groupmember.profile_id\n FROM groupmember\n WHERE (groupmember.id = lesson_comment.groupmember_id)))" }, "Enable read access for all users": { "name": "Enable read access for all users", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"] }, "Update only your own": { "name": "Update only your own", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] }, "User must be in course group to INSERT": { "name": "User must be in course group to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.lesson_completion": { "name": "lesson_completion", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "lesson_completion_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "lesson_id": { "name": "lesson_id", "type": "uuid", "primaryKey": false, "notNull": false }, "profile_id": { "name": "profile_id", "type": "uuid", "primaryKey": false, "notNull": false }, "is_complete": { "name": "is_complete", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "lesson_completion_lesson_id_fkey": { "name": "lesson_completion_lesson_id_fkey", "tableFrom": "lesson_completion", "tableTo": "lesson", "columnsFrom": ["lesson_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, "lesson_completion_profile_id_fkey": { "name": "lesson_completion_profile_id_fkey", "tableFrom": "lesson_completion", "tableTo": "profile", "columnsFrom": ["profile_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "unique_lesson_profile": { "name": "unique_lesson_profile", "nullsNotDistinct": false, "columns": ["lesson_id", "profile_id"] } }, "policies": { "Enable read access for all users": { "name": "Enable read access for all users", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "true" }, "User must be an course member or Admin to perform ALL operation": { "name": "User must be an course member or Admin to perform ALL operation", "as": "PERMISSIVE", "for": "ALL", "to": ["public"] }, "User must be an org member to DELETE": { "name": "User must be an org member to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "User must be an org member to UPDATE": { "name": "User must be an org member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.lesson_language": { "name": "lesson_language", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "lesson_language_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "content": { "name": "content", "type": "text", "primaryKey": false, "notNull": false }, "lesson_id": { "name": "lesson_id", "type": "uuid", "primaryKey": false, "notNull": false, "default": "gen_random_uuid()" }, "locale": { "name": "locale", "type": "LOCALE", "typeSchema": "public", "primaryKey": false, "notNull": false, "default": "'en'" } }, "indexes": {}, "foreignKeys": { "public_lesson_language_lesson_id_fkey": { "name": "public_lesson_language_lesson_id_fkey", "tableFrom": "lesson_language", "tableTo": "lesson", "columnsFrom": ["lesson_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "cascade" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Enable read access for all users": { "name": "Enable read access for all users", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "true" }, "User must be an org member to DELETE": { "name": "User must be an org member to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "User must be an org member to INSERT": { "name": "User must be an org member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "User must be an org member to UPDATE": { "name": "User must be an org member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.lesson_language_history": { "name": "lesson_language_history", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "lesson_language_id": { "name": "lesson_language_id", "type": "integer", "primaryKey": false, "notNull": false }, "old_content": { "name": "old_content", "type": "text", "primaryKey": false, "notNull": false }, "new_content": { "name": "new_content", "type": "text", "primaryKey": false, "notNull": false }, "timestamp": { "name": "timestamp", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "CURRENT_TIMESTAMP" } }, "indexes": {}, "foreignKeys": { "public_lesson_language_history_lesson_language_id_fkey": { "name": "public_lesson_language_history_lesson_language_id_fkey", "tableFrom": "lesson_language_history", "tableTo": "lesson_language", "columnsFrom": ["lesson_language_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "cascade" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Authenticated users can SELECT": { "name": "Authenticated users can SELECT", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "(auth.uid() IS NOT NULL)" }, "User must be an org member to DELETE": { "name": "User must be an org member to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "User must be an org member to INSERT": { "name": "User must be an org member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "User must be an org member to UPDATE": { "name": "User must be an org member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.lesson_section": { "name": "lesson_section", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "title": { "name": "title", "type": "varchar", "primaryKey": false, "notNull": false }, "order": { "name": "order", "type": "bigint", "primaryKey": false, "notNull": false, "default": "'0'" }, "course_id": { "name": "course_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "public_lesson_section_course_id_fkey": { "name": "public_lesson_section_course_id_fkey", "tableFrom": "lesson_section", "tableTo": "course", "columnsFrom": ["course_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "cascade" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Enable read access for all users": { "name": "Enable read access for all users", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "true" }, "User must be an org member to DELETE": { "name": "User must be an org member to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "User must be an org member to INSERT": { "name": "User must be an org member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "User must be an org member to UPDATE": { "name": "User must be an org member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.option": { "name": "option", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "option_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "label": { "name": "label", "type": "varchar", "primaryKey": false, "notNull": true }, "is_correct": { "name": "is_correct", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "question_id": { "name": "question_id", "type": "bigint", "primaryKey": false, "notNull": true }, "value": { "name": "value", "type": "uuid", "primaryKey": false, "notNull": false, "default": "extensions.gen_random_uuid()" }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": { "option_question_id_fkey": { "name": "option_question_id_fkey", "tableFrom": "option", "tableTo": "question", "columnsFrom": ["question_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Allow authenticated users to SELECT": { "name": "Allow authenticated users to SELECT", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "(auth.uid() IS NOT NULL)" }, "User must be an org member to DELETE": { "name": "User must be an org member to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "User must be an org member to INSERT": { "name": "User must be an org member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "User must be an org member to UPDATE": { "name": "User must be an org member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.organization": { "name": "organization", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuid_generate_v4()" }, "name": { "name": "name", "type": "varchar", "primaryKey": false, "notNull": true }, "siteName": { "name": "siteName", "type": "text", "primaryKey": false, "notNull": false }, "avatar_url": { "name": "avatar_url", "type": "text", "primaryKey": false, "notNull": false }, "settings": { "name": "settings", "type": "jsonb", "primaryKey": false, "notNull": false, "default": "'{}'::jsonb" }, "landingpage": { "name": "landingpage", "type": "jsonb", "primaryKey": false, "notNull": false, "default": "'{}'::jsonb" }, "theme": { "name": "theme", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "timezone('utc'::text, now())" }, "customization": { "name": "customization", "type": "json", "primaryKey": false, "notNull": true, "default": "'{\"apps\":{\"poll\":true,\"comments\":true},\"course\":{\"grading\":true,\"newsfeed\":true},\"dashboard\":{\"exercise\":true,\"community\":true,\"bannerText\":\"\",\"bannerImage\":\"\"}}'::json" }, "is_restricted": { "name": "is_restricted", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "customCode": { "name": "customCode", "type": "text", "primaryKey": false, "notNull": false }, "customDomain": { "name": "customDomain", "type": "text", "primaryKey": false, "notNull": false }, "favicon": { "name": "favicon", "type": "text", "primaryKey": false, "notNull": false }, "isCustomDomainVerified": { "name": "isCustomDomainVerified", "type": "boolean", "primaryKey": false, "notNull": false, "default": false } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "organization_siteName_key": { "name": "organization_siteName_key", "nullsNotDistinct": false, "columns": ["siteName"] }, "organization_customDomain_key": { "name": "organization_customDomain_key", "nullsNotDistinct": false, "columns": ["customDomain"] } }, "policies": { "Authenticated users can delete": { "name": "Authenticated users can delete", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"], "using": "(auth.uid() IS NOT NULL)" }, "Enable insert for authenticated users only": { "name": "Enable insert for authenticated users only", "as": "PERMISSIVE", "for": "INSERT", "to": ["authenticated"] }, "Enable read access for all users": { "name": "Enable read access for all users", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"] }, "User must be admin to UPDATE": { "name": "User must be admin to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.organization_contacts": { "name": "organization_contacts", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "organization_contacts_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": false }, "phone": { "name": "phone", "type": "text", "primaryKey": false, "notNull": false }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": false }, "message": { "name": "message", "type": "text", "primaryKey": false, "notNull": false }, "organization_id": { "name": "organization_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "organization_contacts_organization_id_fkey": { "name": "organization_contacts_organization_id_fkey", "tableFrom": "organization_contacts", "tableTo": "organization", "columnsFrom": ["organization_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Enable read access for all users": { "name": "Enable read access for all users", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"], "withCheck": "true" } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.organization_emaillist": { "name": "organization_emaillist", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "organization_emaillist_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": false }, "organization_id": { "name": "organization_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "organization_emaillist_organization_id_fkey": { "name": "organization_emaillist_organization_id_fkey", "tableFrom": "organization_emaillist", "tableTo": "organization", "columnsFrom": ["organization_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Enable read access for all users": { "name": "Enable read access for all users", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"], "withCheck": "true" } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.organization_plan": { "name": "organization_plan", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "organization_plan_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "activated_at": { "name": "activated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "org_id": { "name": "org_id", "type": "uuid", "primaryKey": false, "notNull": false }, "plan_name": { "name": "plan_name", "type": "PLAN", "typeSchema": "public", "primaryKey": false, "notNull": false }, "is_active": { "name": "is_active", "type": "boolean", "primaryKey": false, "notNull": false }, "deactivated_at": { "name": "deactivated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "payload": { "name": "payload", "type": "jsonb", "primaryKey": false, "notNull": false }, "triggered_by": { "name": "triggered_by", "type": "bigint", "primaryKey": false, "notNull": false }, "provider": { "name": "provider", "type": "text", "primaryKey": false, "notNull": false, "default": "'lmz'" }, "subscription_id": { "name": "subscription_id", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": { "idx_organization_plan_org_id": { "name": "idx_organization_plan_org_id", "columns": [ { "expression": "org_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "organization_plan_org_id_fkey": { "name": "organization_plan_org_id_fkey", "tableFrom": "organization_plan", "tableTo": "organization", "columnsFrom": ["org_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "organization_plan_triggered_by_fkey": { "name": "organization_plan_triggered_by_fkey", "tableFrom": "organization_plan", "tableTo": "organizationmember", "columnsFrom": ["triggered_by"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "organization_plan_subscription_id_key": { "name": "organization_plan_subscription_id_key", "nullsNotDistinct": false, "columns": ["subscription_id"] } }, "policies": { "Enable read access for all users": { "name": "Enable read access for all users", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "true" }, "User must be an org member to DELETE": { "name": "User must be an org member to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "User must be an org member to INSERT": { "name": "User must be an org member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "User must be an org member to UPDATE": { "name": "User must be an org member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.organizationmember": { "name": "organizationmember", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "organizationmember_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "organization_id": { "name": "organization_id", "type": "uuid", "primaryKey": false, "notNull": true }, "role_id": { "name": "role_id", "type": "bigint", "primaryKey": false, "notNull": true }, "profile_id": { "name": "profile_id", "type": "uuid", "primaryKey": false, "notNull": false }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": false }, "verified": { "name": "verified", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "timezone('utc'::text, now())" } }, "indexes": { "idx_organizationmember_profile_id": { "name": "idx_organizationmember_profile_id", "columns": [ { "expression": "profile_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "idx_organizationmember_organization_id": { "name": "idx_organizationmember_organization_id", "columns": [ { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "idx_organizationmember_profile_org": { "name": "idx_organizationmember_profile_org", "columns": [ { "expression": "profile_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "organization_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "organizationmember_organization_id_fkey": { "name": "organizationmember_organization_id_fkey", "tableFrom": "organizationmember", "tableTo": "organization", "columnsFrom": ["organization_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "organizationmember_profile_id_fkey": { "name": "organizationmember_profile_id_fkey", "tableFrom": "organizationmember", "tableTo": "profile", "columnsFrom": ["profile_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "organizationmember_role_id_fkey": { "name": "organizationmember_role_id_fkey", "tableFrom": "organizationmember", "tableTo": "role", "columnsFrom": ["role_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Allow authenticated users to read.": { "name": "Allow authenticated users to read.", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "(auth.uid() IS NOT NULL)" }, "Enable insert for authenticated users only": { "name": "Enable insert for authenticated users only", "as": "PERMISSIVE", "for": "INSERT", "to": ["authenticated"] }, "Only admin can delete": { "name": "Only admin can delete", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "Only admin can update": { "name": "Only admin can update", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] }, "Only user can update their account via email": { "name": "Only user can update their account via email", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] }, "User must be an admin to INSERT or allow if no existing member": { "name": "User must be an admin to INSERT or allow if no existing member", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.profile": { "name": "profile", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true }, "fullname": { "name": "fullname", "type": "text", "primaryKey": false, "notNull": true }, "username": { "name": "username", "type": "text", "primaryKey": false, "notNull": true }, "avatar_url": { "name": "avatar_url", "type": "text", "primaryKey": false, "notNull": false, "default": "'https://tapaozmyjsuykgerrfkt.supabase.co/storage/v1/object/public/avatars/avatar.png'" }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "email": { "name": "email", "type": "varchar", "primaryKey": false, "notNull": false }, "can_add_course": { "name": "can_add_course", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "role": { "name": "role", "type": "varchar", "primaryKey": false, "notNull": false }, "goal": { "name": "goal", "type": "varchar", "primaryKey": false, "notNull": false }, "source": { "name": "source", "type": "varchar", "primaryKey": false, "notNull": false }, "metadata": { "name": "metadata", "type": "json", "primaryKey": false, "notNull": false }, "telegram_chat_id": { "name": "telegram_chat_id", "type": "bigint", "primaryKey": false, "notNull": false }, "is_email_verified": { "name": "is_email_verified", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "verified_at": { "name": "verified_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "locale": { "name": "locale", "type": "LOCALE", "typeSchema": "public", "primaryKey": false, "notNull": false, "default": "'en'" }, "is_restricted": { "name": "is_restricted", "type": "boolean", "primaryKey": false, "notNull": true, "default": false } }, "indexes": { "idx_profile_id": { "name": "idx_profile_id", "columns": [ { "expression": "id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "idx_profile_email": { "name": "idx_profile_email", "columns": [ { "expression": "email", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "profile_id_fkey": { "name": "profile_id_fkey", "tableFrom": "profile", "tableTo": "user", "columnsFrom": ["id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "profile_username_key": { "name": "profile_username_key", "nullsNotDistinct": false, "columns": ["username"] }, "profile_email_key": { "name": "profile_email_key", "nullsNotDistinct": false, "columns": ["email"] } }, "policies": { "Only auth users can read profile": { "name": "Only auth users can read profile", "as": "PERMISSIVE", "for": "SELECT", "to": ["anon", "authenticated"], "using": "true" }, "Public profiles are viewable by everyone.": { "name": "Public profiles are viewable by everyone.", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"] }, "User can only delete their profiles": { "name": "User can only delete their profiles", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "Users can insert their own profile.": { "name": "Users can insert their own profile.", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "Users can update own profile.": { "name": "Users can update own profile.", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.question": { "name": "question", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "question_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "question_type_id": { "name": "question_type_id", "type": "bigint", "primaryKey": false, "notNull": true }, "title": { "name": "title", "type": "varchar", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "exercise_id": { "name": "exercise_id", "type": "uuid", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "uuid", "primaryKey": false, "notNull": false, "default": "extensions.gen_random_uuid()" }, "points": { "name": "points", "type": "double precision", "primaryKey": false, "notNull": false }, "order": { "name": "order", "type": "bigint", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "question_exercise_id_fkey": { "name": "question_exercise_id_fkey", "tableFrom": "question", "tableTo": "exercise", "columnsFrom": ["exercise_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, "question_question_type_id_fkey": { "name": "question_question_type_id_fkey", "tableFrom": "question", "tableTo": "question_type", "columnsFrom": ["question_type_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Allow authenticated users to SELECT": { "name": "Allow authenticated users to SELECT", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "(auth.uid() IS NOT NULL)" }, "User must be an org member to DELETE": { "name": "User must be an org member to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "User must be an org member to INSERT": { "name": "User must be an org member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "User must be an org member to UPDATE": { "name": "User must be an org member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.question_answer": { "name": "question_answer", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "question_answer_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "answers": { "name": "answers", "type": "varchar[]", "primaryKey": false, "notNull": false }, "question_id": { "name": "question_id", "type": "bigint", "primaryKey": false, "notNull": true }, "open_answer": { "name": "open_answer", "type": "text", "primaryKey": false, "notNull": false }, "group_member_id": { "name": "group_member_id", "type": "uuid", "primaryKey": false, "notNull": true }, "submission_id": { "name": "submission_id", "type": "uuid", "primaryKey": false, "notNull": false }, "point": { "name": "point", "type": "bigint", "primaryKey": false, "notNull": false, "default": "'0'" } }, "indexes": {}, "foreignKeys": { "question_answer_group_member_id_fkey": { "name": "question_answer_group_member_id_fkey", "tableFrom": "question_answer", "tableTo": "groupmember", "columnsFrom": ["group_member_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "question_answer_question_id_fkey": { "name": "question_answer_question_id_fkey", "tableFrom": "question_answer", "tableTo": "question", "columnsFrom": ["question_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, "question_answer_submission_id_fkey": { "name": "question_answer_submission_id_fkey", "tableFrom": "question_answer", "tableTo": "submission", "columnsFrom": ["submission_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Only authenticated users can select.": { "name": "Only authenticated users can select.", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "(auth.uid() IS NOT NULL)" }, "User must be an course member to DELETE": { "name": "User must be an course member to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "User must be an course member to INSERT": { "name": "User must be an course member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "User must be an course member to UPDATE": { "name": "User must be an course member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.question_type": { "name": "question_type", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "question_type_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "label": { "name": "label", "type": "varchar", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "typename": { "name": "typename", "type": "varchar", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Enable read access for all users": { "name": "Enable read access for all users", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "true" } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.quiz": { "name": "quiz", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "extensions.gen_random_uuid()" }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "title": { "name": "title", "type": "text", "primaryKey": false, "notNull": false }, "questions": { "name": "questions", "type": "json", "primaryKey": false, "notNull": false }, "timelimit": { "name": "timelimit", "type": "varchar", "primaryKey": false, "notNull": false, "default": "'10s'" }, "theme": { "name": "theme", "type": "varchar", "primaryKey": false, "notNull": false, "default": "'standard'" }, "organization_id": { "name": "organization_id", "type": "uuid", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { "quiz_organization_id_fkey": { "name": "quiz_organization_id_fkey", "tableFrom": "quiz", "tableTo": "organization", "columnsFrom": ["organization_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Authenticated users can SELECT": { "name": "Authenticated users can SELECT", "as": "PERMISSIVE", "for": "SELECT", "to": ["authenticated"], "using": "true" } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.quiz_play": { "name": "quiz_play", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "play_quiz_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "quiz_id": { "name": "quiz_id", "type": "uuid", "primaryKey": false, "notNull": false }, "players": { "name": "players", "type": "json", "primaryKey": false, "notNull": false, "default": "'[]'::json" }, "started": { "name": "started", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "currentQuestionId": { "name": "currentQuestionId", "type": "bigint", "primaryKey": false, "notNull": false, "default": "'0'" }, "showCurrentQuestionAnswer": { "name": "showCurrentQuestionAnswer", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "isLastQuestion": { "name": "isLastQuestion", "type": "boolean", "primaryKey": false, "notNull": false }, "step": { "name": "step", "type": "text", "primaryKey": false, "notNull": false, "default": "'CONNECT_TO_PLAY'" }, "studentStep": { "name": "studentStep", "type": "text", "primaryKey": false, "notNull": false, "default": "'PIN_SETUP'" }, "pin": { "name": "pin", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "quiz_play_quiz_id_fkey": { "name": "quiz_play_quiz_id_fkey", "tableFrom": "quiz_play", "tableTo": "quiz", "columnsFrom": ["quiz_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "quiz_play_pin_key": { "name": "quiz_play_pin_key", "nullsNotDistinct": false, "columns": ["pin"] } }, "policies": { "Authenticated users can SELECT": { "name": "Authenticated users can SELECT", "as": "PERMISSIVE", "for": "SELECT", "to": ["authenticated"], "using": "true" } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.role": { "name": "role", "schema": "", "columns": { "type": { "name": "type", "type": "varchar", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "varchar", "primaryKey": false, "notNull": false }, "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "role_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Enable read access for all users": { "name": "Enable read access for all users", "as": "PERMISSIVE", "for": "SELECT", "to": ["public"], "using": "true" } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.session": { "name": "session", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuid_generate_v4()" }, "expires_at": { "name": "expires_at", "type": "timestamp", "primaryKey": false, "notNull": true }, "token": { "name": "token", "type": "text", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true }, "ip_address": { "name": "ip_address", "type": "text", "primaryKey": false, "notNull": false }, "user_agent": { "name": "user_agent", "type": "text", "primaryKey": false, "notNull": false }, "user_id": { "name": "user_id", "type": "uuid", "primaryKey": false, "notNull": true }, "impersonated_by": { "name": "impersonated_by", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "session_user_id_user_id_fk": { "name": "session_user_id_user_id_fk", "tableFrom": "session", "tableTo": "user", "columnsFrom": ["user_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "session_token_unique": { "name": "session_token_unique", "nullsNotDistinct": false, "columns": ["token"] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.submission": { "name": "submission", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuid_generate_v4()" }, "reviewer_id": { "name": "reviewer_id", "type": "bigint", "primaryKey": false, "notNull": false }, "status_id": { "name": "status_id", "type": "bigint", "primaryKey": false, "notNull": false, "default": "'1'" }, "total": { "name": "total", "type": "bigint", "primaryKey": false, "notNull": false, "default": "'0'" }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "exercise_id": { "name": "exercise_id", "type": "uuid", "primaryKey": false, "notNull": true }, "submitted_by": { "name": "submitted_by", "type": "uuid", "primaryKey": false, "notNull": false }, "course_id": { "name": "course_id", "type": "uuid", "primaryKey": false, "notNull": false }, "feedback": { "name": "feedback", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "submission_course_id_fkey": { "name": "submission_course_id_fkey", "tableFrom": "submission", "tableTo": "course", "columnsFrom": ["course_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, "submission_exercise_id_fkey": { "name": "submission_exercise_id_fkey", "tableFrom": "submission", "tableTo": "exercise", "columnsFrom": ["exercise_id"], "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, "submission_status_id_fkey": { "name": "submission_status_id_fkey", "tableFrom": "submission", "tableTo": "submissionstatus", "columnsFrom": ["status_id"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, "submission_submitted_by_fkey": { "name": "submission_submitted_by_fkey", "tableFrom": "submission", "tableTo": "groupmember", "columnsFrom": ["submitted_by"], "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Only authenticated users can SELECT": { "name": "Only authenticated users can SELECT", "as": "PERMISSIVE", "for": "SELECT", "to": ["authenticated"], "using": "true" }, "User must be a course member to DELETE": { "name": "User must be a course member to DELETE", "as": "PERMISSIVE", "for": "DELETE", "to": ["public"] }, "User must be a course member to INSERT": { "name": "User must be a course member to INSERT", "as": "PERMISSIVE", "for": "INSERT", "to": ["public"] }, "User must be a course member to UPDATE": { "name": "User must be a course member to UPDATE", "as": "PERMISSIVE", "for": "UPDATE", "to": ["public"] } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.submissionstatus": { "name": "submissionstatus", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "submission_status_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "label": { "name": "label", "type": "varchar", "primaryKey": false, "notNull": true }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": { "Authenticated users can SELECT": { "name": "Authenticated users can SELECT", "as": "PERMISSIVE", "for": "SELECT", "to": ["authenticated"], "using": "true" } }, "checkConstraints": {}, "isRLSEnabled": false }, "public.test_tenant": { "name": "test_tenant", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "details": { "name": "details", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.user": { "name": "user", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "uuid_generate_v4()" }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": true }, "email_verified": { "name": "email_verified", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "image": { "name": "image", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "role": { "name": "role", "type": "text", "primaryKey": false, "notNull": false }, "banned": { "name": "banned", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "ban_reason": { "name": "ban_reason", "type": "text", "primaryKey": false, "notNull": false }, "ban_expires": { "name": "ban_expires", "type": "timestamp", "primaryKey": false, "notNull": false }, "is_anonymous": { "name": "is_anonymous", "type": "boolean", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "user_email_unique": { "name": "user_email_unique", "nullsNotDistinct": false, "columns": ["email"] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.verification": { "name": "verification", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "identifier": { "name": "identifier", "type": "text", "primaryKey": false, "notNull": true }, "value": { "name": "value", "type": "text", "primaryKey": false, "notNull": true }, "expires_at": { "name": "expires_at", "type": "timestamp", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.video_transcripts": { "name": "video_transcripts", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "video_transcripts_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "muse_svid": { "name": "muse_svid", "type": "text", "primaryKey": false, "notNull": false }, "transcript": { "name": "transcript", "type": "text", "primaryKey": false, "notNull": false }, "downloaded": { "name": "downloaded", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "link": { "name": "link", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.waitinglist": { "name": "waitinglist", "schema": "", "columns": { "id": { "name": "id", "type": "bigint", "primaryKey": true, "notNull": true, "identity": { "type": "byDefault", "name": "waitinglist_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "9223372036854775807", "cache": "1", "cycle": false } }, "email": { "name": "email", "type": "varchar", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "constraint_name": { "name": "constraint_name", "nullsNotDistinct": false, "columns": ["email"] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false } }, "enums": { "public.COURSE_TYPE": { "name": "COURSE_TYPE", "schema": "public", "values": ["SELF_PACED", "LIVE_CLASS"] }, "public.COURSE_VERSION": { "name": "COURSE_VERSION", "schema": "public", "values": ["V1", "V2"] }, "public.LOCALE": { "name": "LOCALE", "schema": "public", "values": ["en", "hi", "fr", "pt", "de", "vi", "ru", "es", "pl", "da"] }, "public.PLAN": { "name": "PLAN", "schema": "public", "values": ["EARLY_ADOPTER", "ENTERPRISE", "BASIC"] } }, "schemas": {}, "sequences": {}, "roles": {}, "policies": {}, "views": { "public.dash_org_stats": { "columns": { "org_id": { "name": "org_id", "type": "uuid", "primaryKey": false, "notNull": false }, "no_of_courses": { "name": "no_of_courses", "type": "bigint", "primaryKey": false, "notNull": false }, "enrolled_students": { "name": "enrolled_students", "type": "bigint", "primaryKey": false, "notNull": false } }, "definition": "SELECT gp.organization_id AS org_id, count(DISTINCT course.id) AS no_of_courses, count(DISTINCT gm.profile_id) AS enrolled_students FROM course JOIN \"group\" gp ON gp.id = course.group_id LEFT JOIN groupmember gm ON gm.group_id = gp.id AND gm.role_id = 3 WHERE course.status = 'ACTIVE'::text GROUP BY gp.organization_id", "name": "dash_org_stats", "schema": "public", "isExisting": false, "materialized": false }, "public.lesson_versions": { "columns": { "old_content": { "name": "old_content", "type": "text", "primaryKey": false, "notNull": false }, "new_content": { "name": "new_content", "type": "text", "primaryKey": false, "notNull": false }, "timestamp": { "name": "timestamp", "type": "timestamp", "primaryKey": false, "notNull": false }, "locale": { "name": "locale", "type": "LOCALE", "typeSchema": "public", "primaryKey": false, "notNull": false }, "lesson_id": { "name": "lesson_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "definition": "SELECT llh.old_content, llh.new_content, llh.\"timestamp\", ll.locale, ll.lesson_id FROM lesson_language_history llh JOIN lesson_language ll ON ll.id = llh.lesson_language_id", "name": "lesson_versions", "schema": "public", "isExisting": false, "materialized": false } }, "_meta": { "columns": {}, "schemas": {}, "tables": {} } }