{ "id": "6f89b3d4-d99d-451a-862b-01b7a4470e70", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", "tables": { "public.hs_account": { "name": "hs_account", "schema": "", "columns": { "userId": { "name": "userId", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "provider": { "name": "provider", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "providerAccountId": { "name": "providerAccountId", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "refresh_token": { "name": "refresh_token", "type": "text", "primaryKey": false, "notNull": false }, "access_token": { "name": "access_token", "type": "text", "primaryKey": false, "notNull": false }, "expires_at": { "name": "expires_at", "type": "integer", "primaryKey": false, "notNull": false }, "token_type": { "name": "token_type", "type": "varchar(255)", "primaryKey": false, "notNull": false }, "scope": { "name": "scope", "type": "varchar(255)", "primaryKey": false, "notNull": false }, "id_token": { "name": "id_token", "type": "text", "primaryKey": false, "notNull": false }, "session_state": { "name": "session_state", "type": "varchar(255)", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "hs_account_userId_hs_user_id_fk": { "name": "hs_account_userId_hs_user_id_fk", "tableFrom": "hs_account", "tableTo": "hs_user", "columnsFrom": [ "userId" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.hs_session": { "name": "hs_session", "schema": "", "columns": { "sessionToken": { "name": "sessionToken", "type": "varchar(255)", "primaryKey": true, "notNull": true }, "userId": { "name": "userId", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "expires": { "name": "expires", "type": "timestamp", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { "hs_session_userId_hs_user_id_fk": { "name": "hs_session_userId_hs_user_id_fk", "tableFrom": "hs_session", "tableTo": "hs_user", "columnsFrom": [ "userId" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.hs_user": { "name": "hs_user", "schema": "", "columns": { "id": { "name": "id", "type": "varchar(255)", "primaryKey": true, "notNull": true }, "email": { "name": "email", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "first_name": { "name": "first_name", "type": "varchar(255)", "primaryKey": false, "notNull": false }, "last_name": { "name": "last_name", "type": "varchar(255)", "primaryKey": false, "notNull": false }, "password": { "name": "password", "type": "varchar(255)", "primaryKey": false, "notNull": false }, "emailVerified": { "name": "emailVerified", "type": "timestamp", "primaryKey": false, "notNull": false }, "image": { "name": "image", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.hs_verificationToken": { "name": "hs_verificationToken", "schema": "", "columns": { "identifier": { "name": "identifier", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "token": { "name": "token", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "expires": { "name": "expires", "type": "timestamp", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.hs_experiment": { "name": "hs_experiment", "schema": "", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "identity": { "type": "always", "name": "hs_experiment_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "2147483647", "cache": "1", "cycle": false } }, "study_id": { "name": "study_id", "type": "integer", "primaryKey": false, "notNull": true }, "title": { "name": "title", "type": "varchar(256)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "version": { "name": "version", "type": "integer", "primaryKey": false, "notNull": true, "default": 1 }, "status": { "name": "status", "type": "experiment_status", "typeSchema": "public", "primaryKey": false, "notNull": true, "default": "'draft'" }, "steps": { "name": "steps", "type": "jsonb", "primaryKey": false, "notNull": false, "default": "'[]'::jsonb" }, "created_by": { "name": "created_by", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "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 } }, "indexes": {}, "foreignKeys": { "hs_experiment_study_id_hs_study_id_fk": { "name": "hs_experiment_study_id_hs_study_id_fk", "tableFrom": "hs_experiment", "tableTo": "hs_study", "columnsFrom": [ "study_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "hs_experiment_created_by_hs_user_id_fk": { "name": "hs_experiment_created_by_hs_user_id_fk", "tableFrom": "hs_experiment", "tableTo": "hs_user", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.hs_participant": { "name": "hs_participant", "schema": "", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "identity": { "type": "always", "name": "hs_participant_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "2147483647", "cache": "1", "cycle": false } }, "study_id": { "name": "study_id", "type": "integer", "primaryKey": false, "notNull": true }, "identifier": { "name": "identifier", "type": "varchar(256)", "primaryKey": false, "notNull": false }, "email": { "name": "email", "type": "varchar(256)", "primaryKey": false, "notNull": false }, "first_name": { "name": "first_name", "type": "varchar(256)", "primaryKey": false, "notNull": false }, "last_name": { "name": "last_name", "type": "varchar(256)", "primaryKey": false, "notNull": false }, "notes": { "name": "notes", "type": "text", "primaryKey": false, "notNull": false }, "status": { "name": "status", "type": "participant_status", "typeSchema": "public", "primaryKey": false, "notNull": true, "default": "'active'" }, "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 } }, "indexes": {}, "foreignKeys": { "hs_participant_study_id_hs_study_id_fk": { "name": "hs_participant_study_id_hs_study_id_fk", "tableFrom": "hs_participant", "tableTo": "hs_study", "columnsFrom": [ "study_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.hs_study": { "name": "hs_study", "schema": "", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "identity": { "type": "always", "name": "hs_study_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "2147483647", "cache": "1", "cycle": false } }, "title": { "name": "title", "type": "varchar(256)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "created_by": { "name": "created_by", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "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 } }, "indexes": {}, "foreignKeys": { "hs_study_created_by_hs_user_id_fk": { "name": "hs_study_created_by_hs_user_id_fk", "tableFrom": "hs_study", "tableTo": "hs_user", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.hs_study_activity": { "name": "hs_study_activity", "schema": "", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "identity": { "type": "always", "name": "hs_study_activity_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "2147483647", "cache": "1", "cycle": false } }, "study_id": { "name": "study_id", "type": "integer", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "activity_type", "typeSchema": "public", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "hs_study_activity_study_id_hs_study_id_fk": { "name": "hs_study_activity_study_id_hs_study_id_fk", "tableFrom": "hs_study_activity", "tableTo": "hs_study", "columnsFrom": [ "study_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "hs_study_activity_user_id_hs_user_id_fk": { "name": "hs_study_activity_user_id_hs_user_id_fk", "tableFrom": "hs_study_activity", "tableTo": "hs_user", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.hs_study_invitation": { "name": "hs_study_invitation", "schema": "", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "identity": { "type": "always", "name": "hs_study_invitation_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "2147483647", "cache": "1", "cycle": false } }, "study_id": { "name": "study_id", "type": "integer", "primaryKey": false, "notNull": true }, "email": { "name": "email", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "role": { "name": "role", "type": "study_role", "typeSchema": "public", "primaryKey": false, "notNull": true }, "token": { "name": "token", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "status": { "name": "status", "type": "invitation_status", "typeSchema": "public", "primaryKey": false, "notNull": true, "default": "'pending'" }, "expires_at": { "name": "expires_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true }, "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 }, "created_by": { "name": "created_by", "type": "varchar(255)", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { "hs_study_invitation_study_id_hs_study_id_fk": { "name": "hs_study_invitation_study_id_hs_study_id_fk", "tableFrom": "hs_study_invitation", "tableTo": "hs_study", "columnsFrom": [ "study_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "hs_study_invitation_created_by_hs_user_id_fk": { "name": "hs_study_invitation_created_by_hs_user_id_fk", "tableFrom": "hs_study_invitation", "tableTo": "hs_user", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "hs_study_invitation_token_unique": { "name": "hs_study_invitation_token_unique", "nullsNotDistinct": false, "columns": [ "token" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.hs_study_member": { "name": "hs_study_member", "schema": "", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "identity": { "type": "always", "name": "hs_study_member_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "2147483647", "cache": "1", "cycle": false } }, "study_id": { "name": "study_id", "type": "integer", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "role": { "name": "role", "type": "study_role", "typeSchema": "public", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "hs_study_member_study_id_hs_study_id_fk": { "name": "hs_study_member_study_id_hs_study_id_fk", "tableFrom": "hs_study_member", "tableTo": "hs_study", "columnsFrom": [ "study_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "hs_study_member_user_id_hs_user_id_fk": { "name": "hs_study_member_user_id_hs_user_id_fk", "tableFrom": "hs_study_member", "tableTo": "hs_user", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.hs_study_metadata": { "name": "hs_study_metadata", "schema": "", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "identity": { "type": "always", "name": "hs_study_metadata_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "2147483647", "cache": "1", "cycle": false } }, "study_id": { "name": "study_id", "type": "integer", "primaryKey": false, "notNull": true }, "key": { "name": "key", "type": "varchar(256)", "primaryKey": false, "notNull": true }, "value": { "name": "value", "type": "text", "primaryKey": false, "notNull": 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 } }, "indexes": {}, "foreignKeys": { "hs_study_metadata_study_id_hs_study_id_fk": { "name": "hs_study_metadata_study_id_hs_study_id_fk", "tableFrom": "hs_study_metadata", "tableTo": "hs_study", "columnsFrom": [ "study_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.hs_permissions": { "name": "hs_permissions", "schema": "", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "identity": { "type": "always", "name": "hs_permissions_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "2147483647", "cache": "1", "cycle": false } }, "code": { "name": "code", "type": "varchar(50)", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "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()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "hs_permissions_code_unique": { "name": "hs_permissions_code_unique", "nullsNotDistinct": false, "columns": [ "code" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.hs_role_permissions": { "name": "hs_role_permissions", "schema": "", "columns": { "role_id": { "name": "role_id", "type": "integer", "primaryKey": false, "notNull": true }, "permission_id": { "name": "permission_id", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "hs_role_permissions_role_id_hs_roles_id_fk": { "name": "hs_role_permissions_role_id_hs_roles_id_fk", "tableFrom": "hs_role_permissions", "tableTo": "hs_roles", "columnsFrom": [ "role_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "hs_role_permissions_permission_id_hs_permissions_id_fk": { "name": "hs_role_permissions_permission_id_hs_permissions_id_fk", "tableFrom": "hs_role_permissions", "tableTo": "hs_permissions", "columnsFrom": [ "permission_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": { "hs_role_permissions_role_id_permission_id_pk": { "name": "hs_role_permissions_role_id_permission_id_pk", "columns": [ "role_id", "permission_id" ] } }, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.hs_roles": { "name": "hs_roles", "schema": "", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "identity": { "type": "always", "name": "hs_roles_id_seq", "schema": "public", "increment": "1", "startWith": "1", "minValue": "1", "maxValue": "2147483647", "cache": "1", "cycle": false } }, "code": { "name": "code", "type": "varchar(50)", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "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()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "hs_roles_code_unique": { "name": "hs_roles_code_unique", "nullsNotDistinct": false, "columns": [ "code" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.hs_user_roles": { "name": "hs_user_roles", "schema": "", "columns": { "user_id": { "name": "user_id", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "role_id": { "name": "role_id", "type": "integer", "primaryKey": false, "notNull": true }, "study_id": { "name": "study_id", "type": "integer", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "hs_user_roles_user_id_hs_user_id_fk": { "name": "hs_user_roles_user_id_hs_user_id_fk", "tableFrom": "hs_user_roles", "tableTo": "hs_user", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "hs_user_roles_role_id_hs_roles_id_fk": { "name": "hs_user_roles_role_id_hs_roles_id_fk", "tableFrom": "hs_user_roles", "tableTo": "hs_roles", "columnsFrom": [ "role_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "hs_user_roles_study_id_hs_study_id_fk": { "name": "hs_user_roles_study_id_hs_study_id_fk", "tableFrom": "hs_user_roles", "tableTo": "hs_study", "columnsFrom": [ "study_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": { "hs_user_roles_user_id_role_id_study_id_pk": { "name": "hs_user_roles_user_id_role_id_study_id_pk", "columns": [ "user_id", "role_id", "study_id" ] } }, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false } }, "enums": { "public.activity_type": { "name": "activity_type", "schema": "public", "values": [ "study_created", "study_updated", "study_deleted", "ownership_transferred", "member_added", "member_removed", "member_role_changed", "participant_added", "participant_updated", "participant_removed", "experiment_created", "experiment_updated", "experiment_deleted", "trial_started", "trial_completed", "trial_cancelled", "invitation_sent", "invitation_accepted", "invitation_declined", "invitation_expired", "invitation_revoked", "consent_form_added", "consent_form_signed", "metadata_updated", "data_exported" ] }, "public.experiment_status": { "name": "experiment_status", "schema": "public", "values": [ "draft", "active", "archived" ] }, "public.invitation_status": { "name": "invitation_status", "schema": "public", "values": [ "pending", "accepted", "declined", "expired", "revoked" ] }, "public.participant_status": { "name": "participant_status", "schema": "public", "values": [ "active", "inactive", "completed", "withdrawn" ] }, "public.study_activity_type": { "name": "study_activity_type", "schema": "public", "values": [ "member_added", "member_role_changed", "study_updated", "participant_added", "participant_updated", "invitation_sent", "invitation_accepted", "invitation_declined", "invitation_expired", "invitation_revoked" ] }, "public.study_role": { "name": "study_role", "schema": "public", "values": [ "owner", "admin", "principal_investigator", "wizard", "researcher", "observer" ] } }, "schemas": {}, "sequences": {}, "roles": {}, "policies": {}, "views": {}, "_meta": { "columns": {}, "schemas": {}, "tables": {} } }