Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Refactor video effective date and optimize DB indexes (#1361)
Richie McIlroya0e007c961be
diff --git a/apps/web/actions/spaces/get-user-videos.ts b/apps/web/actions/spaces/get-user-videos.tsindex 937d19d74..ed5f19a95 100644--- a/apps/web/actions/spaces/get-user-videos.ts+++ b/apps/web/actions/spaces/get-user-videos.ts@@ -38,12 +38,7 @@ export async function getUserVideos(spaceId: Space.SpaceIdOrOrganisationId) {ownerName: users.name,folderName: folders.name,folderColor: folders.color,- effectiveDate: sql<string>`- COALESCE(- JSON_UNQUOTE(JSON_EXTRACT(${videos.metadata}, '$.customCreatedAt')),- ${videos.createdAt}- )- `,+ effectiveDate: videos.effectiveCreatedAt,hasActiveUpload: sql`${videoUploads.videoId} IS NOT NULL`.mapWith(Boolean,),@@ -81,12 +76,7 @@ export async function getUserVideos(spaceId: Space.SpaceIdOrOrganisationId) {folders.spaceId,videos.folderId,)- .orderBy(- desc(sql`COALESCE(- JSON_UNQUOTE(JSON_EXTRACT(${videos.metadata}, '$.customCreatedAt')),- ${videos.createdAt}- )`),- )+ .orderBy(desc(videos.effectiveCreatedAt)): await db().select(selectFields).from(videos)@@ -118,12 +108,7 @@ export async function getUserVideos(spaceId: Space.SpaceIdOrOrganisationId) {folders.spaceId,videos.folderId,)- .orderBy(- desc(sql`COALESCE(- JSON_UNQUOTE(JSON_EXTRACT(${videos.metadata}, '$.customCreatedAt')),- ${videos.createdAt}- )`),- );+ .orderBy(desc(videos.effectiveCreatedAt));const processedVideoData = videoData.map((video) => {const { effectiveDate: _effectiveDate, ...videoWithoutEffectiveDate } =diff --git a/apps/web/app/(org)/dashboard/caps/page.tsx b/apps/web/app/(org)/dashboard/caps/page.tsxindex f31fb1e2d..c274c8b66 100644--- a/apps/web/app/(org)/dashboard/caps/page.tsx+++ b/apps/web/app/(org)/dashboard/caps/page.tsx@@ -164,12 +164,7 @@ export default async function CapsPage(props: PageProps<"/dashboard/caps">) {)`,ownerName: users.name,- effectiveDate: sql<string>`- COALESCE(- JSON_UNQUOTE(JSON_EXTRACT(${videos.metadata}, '$.customCreatedAt')),- ${videos.createdAt}- )- `,+ effectiveDate: videos.effectiveCreatedAt,hasPassword: sql`${videos.password} IS NOT NULL`.mapWith(Boolean),hasActiveUpload: sql`${videoUploads.videoId} IS NOT NULL`.mapWith(Boolean,@@ -198,12 +193,7 @@ export default async function CapsPage(props: PageProps<"/dashboard/caps">) {videos.orgId,users.name,)- .orderBy(- desc(sql`COALESCE(- JSON_UNQUOTE(JSON_EXTRACT(${videos.metadata}, '$.customCreatedAt')),- ${videos.createdAt}- )`),- )+ .orderBy(desc(videos.effectiveCreatedAt)).limit(limit).offset(offset);diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsxindex 079ce13d8..6c9064120 100644--- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsx+++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsx@@ -192,7 +192,7 @@ export default async function SharedCapsPage(props: {totalComments: sql<number>`COUNT(DISTINCT CASE WHEN ${comments.type} = 'text' THEN ${comments.id} END)`,totalReactions: sql<number>`COUNT(DISTINCT CASE WHEN ${comments.type} = 'emoji' THEN ${comments.id} END)`,ownerName: users.name,- effectiveDate: sql<string>`COALESCE(JSON_UNQUOTE(JSON_EXTRACT(${videos.metadata}, '$.customCreatedAt')), ${videos.createdAt})`,+ effectiveDate: videos.effectiveCreatedAt,hasActiveUpload: sql`${videoUploads.videoId} IS NOT NULL`.mapWith(Boolean,),@@ -218,11 +218,7 @@ export default async function SharedCapsPage(props: {videos.metadata,users.name,)- .orderBy(- desc(- sql`COALESCE(JSON_UNQUOTE(JSON_EXTRACT(${videos.metadata}, '$.customCreatedAt')), ${videos.createdAt})`,- ),- )+ .orderBy(desc(videos.effectiveCreatedAt)).limit(limit).offset(offset),db()@@ -292,7 +288,7 @@ export default async function SharedCapsPage(props: {totalComments: sql<number>`COUNT(DISTINCT CASE WHEN ${comments.type} = 'text' THEN ${comments.id} END)`,totalReactions: sql<number>`COUNT(DISTINCT CASE WHEN ${comments.type} = 'emoji' THEN ${comments.id} END)`,ownerName: users.name,- effectiveDate: sql<string>`COALESCE(JSON_UNQUOTE(JSON_EXTRACT(${videos.metadata}, '$.customCreatedAt')), ${videos.createdAt})`,+ effectiveDate: videos.effectiveCreatedAt,hasActiveUpload: sql`${videoUploads.videoId} IS NOT NULL`.mapWith(Boolean,),@@ -317,11 +313,7 @@ export default async function SharedCapsPage(props: {users.name,videos.duration,)- .orderBy(- desc(- sql`COALESCE(JSON_UNQUOTE(JSON_EXTRACT(${videos.metadata}, '$.customCreatedAt')), ${videos.createdAt})`,- ),- )+ .orderBy(desc(videos.effectiveCreatedAt)).limit(limit).offset(offset),db()diff --git a/apps/web/lib/folder.ts b/apps/web/lib/folder.tsindex 18e8a44c6..ab7f7a325 100644--- a/apps/web/lib/folder.ts+++ b/apps/web/lib/folder.ts@@ -197,12 +197,7 @@ export const getVideosByFolderId = Effect.fn(function* (`,ownerName: users.name,- effectiveDate: sql<string>`- COALESCE(- JSON_UNQUOTE(JSON_EXTRACT(${videos.metadata}, '$.customCreatedAt')),- ${videos.createdAt}- )- `,+ effectiveDate: videos.effectiveCreatedAt,hasPassword: sql`${videos.password} IS NOT NULL`.mapWith(Boolean),hasActiveUpload: sql`${videoUploads.videoId} IS NOT NULL`.mapWith(Boolean,@@ -240,12 +235,7 @@ export const getVideosByFolderId = Effect.fn(function* (videos.metadata,users.name,)- .orderBy(- desc(sql`COALESCE(- JSON_UNQUOTE(JSON_EXTRACT(${videos.metadata}, '$.customCreatedAt')),- ${videos.createdAt}- )`),- ),+ .orderBy(desc(videos.effectiveCreatedAt)),);// Fetch shared spaces data for all videosdiff --git a/packages/database/migrations/0007_public_toxin.sql b/packages/database/migrations/0007_public_toxin.sqlnew file mode 100644index 000000000..af7bbe973--- /dev/null+++ b/packages/database/migrations/0007_public_toxin.sql@@ -0,0 +1,21 @@+ALTER TABLE `accounts` DROP INDEX `accounts_id_unique`;--> statement-breakpoint+ALTER TABLE `folders` DROP INDEX `folders_id_unique`;--> statement-breakpoint+ALTER TABLE `organization_invites` DROP INDEX `organization_invites_id_unique`;--> statement-breakpoint+ALTER TABLE `organization_members` DROP INDEX `organization_members_id_unique`;--> statement-breakpoint+ALTER TABLE `organizations` DROP INDEX `organizations_id_unique`;--> statement-breakpoint+ALTER TABLE `sessions` DROP INDEX `sessions_id_unique`;--> statement-breakpoint+ALTER TABLE `sessions` DROP INDEX `sessions_sessionToken_unique`;--> statement-breakpoint+ALTER TABLE `users` DROP INDEX `users_id_unique`;--> statement-breakpoint+ALTER TABLE `users` DROP INDEX `users_email_unique`;--> statement-breakpoint+ALTER TABLE `videos` DROP INDEX `videos_id_unique`;--> statement-breakpoint+DROP INDEX `user_id_idx` ON `organization_members`;--> statement-breakpoint+DROP INDEX `owner_id_idx` ON `organizations`;--> statement-breakpoint+DROP INDEX `id_idx` ON `videos`;--> statement-breakpoint+ALTER TABLE `videos` ADD `effectiveCreatedAt` datetime GENERATED ALWAYS AS (COALESCE(+ STR_TO_DATE(JSON_UNQUOTE(JSON_EXTRACT(`metadata`, '$.customCreatedAt')), '%Y-%m-%dT%H:%i:%s.%fZ'),+ STR_TO_DATE(JSON_UNQUOTE(JSON_EXTRACT(`metadata`, '$.customCreatedAt')), '%Y-%m-%dT%H:%i:%sZ'),+ `createdAt`+ )) STORED;--> statement-breakpoint+CREATE INDEX `owner_id_tombstone_idx` ON `organizations` (`ownerId`,`tombstoneAt`);--> statement-breakpoint+CREATE INDEX `org_owner_folder_idx` ON `videos` (`orgId`,`ownerId`,`folderId`);--> statement-breakpoint+CREATE INDEX `org_effective_created_idx` ON `videos` (`orgId`,`effectiveCreatedAt`);\ No newline at end of filediff --git a/packages/database/migrations/0008_fat_ender_wiggin.sql b/packages/database/migrations/0008_fat_ender_wiggin.sqlnew file mode 100644index 000000000..0aa430b03--- /dev/null+++ b/packages/database/migrations/0008_fat_ender_wiggin.sql@@ -0,0 +1,16 @@+ALTER TABLE `auth_api_keys` DROP INDEX `auth_api_keys_id_unique`;--> statement-breakpoint+ALTER TABLE `comments` DROP INDEX `comments_id_unique`;--> statement-breakpoint+ALTER TABLE `notifications` DROP INDEX `notifications_id_unique`;--> statement-breakpoint+ALTER TABLE `s3_buckets` DROP INDEX `s3_buckets_id_unique`;--> statement-breakpoint+ALTER TABLE `shared_videos` DROP INDEX `shared_videos_id_unique`;--> statement-breakpoint+ALTER TABLE `space_members` DROP INDEX `space_members_id_unique`;--> statement-breakpoint+ALTER TABLE `space_videos` DROP INDEX `space_videos_id_unique`;--> statement-breakpoint+ALTER TABLE `spaces` DROP INDEX `spaces_id_unique`;--> statement-breakpoint+DROP INDEX `video_id_idx` ON `comments`;--> statement-breakpoint+DROP INDEX `recipient_id_idx` ON `notifications`;--> statement-breakpoint+DROP INDEX `video_id_idx` ON `shared_videos`;--> statement-breakpoint+DROP INDEX `space_id_idx` ON `space_members`;--> statement-breakpoint+DROP INDEX `space_id_user_id_idx` ON `space_members`;--> statement-breakpoint+DROP INDEX `space_id_idx` ON `space_videos`;--> statement-breakpoint+CREATE INDEX `video_type_created_idx` ON `comments` (`videoId`,`type`,`createdAt`,`id`);--> statement-breakpoint+CREATE INDEX `space_id_folder_id_idx` ON `space_videos` (`spaceId`,`folderId`);\ No newline at end of filediff --git a/packages/database/migrations/0008_secondary_index_cleanup.sql b/packages/database/migrations/0008_secondary_index_cleanup.sqlnew file mode 100644index 000000000..a24ba2c54--- /dev/null+++ b/packages/database/migrations/0008_secondary_index_cleanup.sql@@ -0,0 +1,31 @@+ALTER TABLE `shared_videos`+ DROP INDEX `shared_videos_id_unique`,+ DROP INDEX `video_id_idx`;++ALTER TABLE `comments`+ DROP INDEX `comments_id_unique`,+ DROP INDEX `video_id_idx`,+ ADD INDEX `video_type_created_idx` (`videoId`, `type`, `createdAt`, `id`);++ALTER TABLE `notifications`+ DROP INDEX `notifications_id_unique`,+ DROP INDEX `recipient_id_idx`;++ALTER TABLE `s3_buckets`+ DROP INDEX `s3_buckets_id_unique`;++ALTER TABLE `auth_api_keys`+ DROP INDEX `auth_api_keys_id_unique`;++ALTER TABLE `spaces`+ DROP INDEX `spaces_id_unique`;++ALTER TABLE `space_members`+ DROP INDEX `space_members_id_unique`,+ DROP INDEX `space_id_idx`,+ DROP INDEX `space_id_user_id_idx`;++ALTER TABLE `space_videos`+ DROP INDEX `space_videos_id_unique`,+ DROP INDEX `space_id_idx`,+ ADD INDEX `space_id_folder_id_idx` (`spaceId`, `folderId`);diff --git a/packages/database/migrations/meta/0007_snapshot.json b/packages/database/migrations/meta/0007_snapshot.jsonnew file mode 100644index 000000000..85d7b65f9--- /dev/null+++ b/packages/database/migrations/meta/0007_snapshot.json@@ -0,0 +1,1906 @@+{+ "version": "5",+ "dialect": "mysql",+ "id": "d5cc82ff-f127-4f0c-a31d-d859447ae2a2",+ "prevId": "6d2d7a90-ea14-49e5-a758-aecf609d1ba7",+ "tables": {+ "accounts": {+ "name": "accounts",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider": {+ "name": "provider",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "providerAccountId": {+ "name": "providerAccountId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "expires_in": {+ "name": "expires_in",+ "type": "int",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "id_token": {+ "name": "id_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "refresh_token_expires_in": {+ "name": "refresh_token_expires_in",+ "type": "int",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "scope": {+ "name": "scope",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "token_type": {+ "name": "token_type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "tempColumn": {+ "name": "tempColumn",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "user_id_idx": {+ "name": "user_id_idx",+ "columns": ["userId"],+ "isUnique": false+ },+ "provider_account_id_idx": {+ "name": "provider_account_id_idx",+ "columns": ["providerAccountId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "accounts_id": {+ "name": "accounts_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "auth_api_keys": {+ "name": "auth_api_keys",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(36)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "auth_api_keys_id": {+ "name": "auth_api_keys_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {+ "auth_api_keys_id_unique": {+ "name": "auth_api_keys_id_unique",+ "columns": ["id"]+ }+ },+ "checkConstraint": {}+ },+ "comments": {+ "name": "comments",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "varchar(6)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "timestamp": {+ "name": "timestamp",+ "type": "float",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "authorId": {+ "name": "authorId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "videoId": {+ "name": "videoId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "parentCommentId": {+ "name": "parentCommentId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "video_id_idx": {+ "name": "video_id_idx",+ "columns": ["videoId"],+ "isUnique": false+ },+ "author_id_idx": {+ "name": "author_id_idx",+ "columns": ["authorId"],+ "isUnique": false+ },+ "parent_comment_id_idx": {+ "name": "parent_comment_id_idx",+ "columns": ["parentCommentId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "comments_id": {+ "name": "comments_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {+ "comments_id_unique": {+ "name": "comments_id_unique",+ "columns": ["id"]+ }+ },+ "checkConstraint": {}+ },+ "folders": {+ "name": "folders",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "color": {+ "name": "color",+ "type": "varchar(16)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'normal'"+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdById": {+ "name": "createdById",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "parentId": {+ "name": "parentId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "spaceId": {+ "name": "spaceId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": ["organizationId"],+ "isUnique": false+ },+ "created_by_id_idx": {+ "name": "created_by_id_idx",+ "columns": ["createdById"],+ "isUnique": false+ },+ "parent_id_idx": {+ "name": "parent_id_idx",+ "columns": ["parentId"],+ "isUnique": false+ },+ "space_id_idx": {+ "name": "space_id_idx",+ "columns": ["spaceId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "folders_id": {+ "name": "folders_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "imported_videos": {+ "name": "imported_videos",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "orgId": {+ "name": "orgId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "source": {+ "name": "source",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "source_id": {+ "name": "source_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "imported_videos_orgId_source_source_id_pk": {+ "name": "imported_videos_orgId_source_source_id_pk",+ "columns": ["orgId", "source", "source_id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "notifications": {+ "name": "notifications",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "orgId": {+ "name": "orgId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "recipientId": {+ "name": "recipientId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "varchar(10)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "data": {+ "name": "data",+ "type": "json",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "readAt": {+ "name": "readAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ }+ },+ "indexes": {+ "recipient_id_idx": {+ "name": "recipient_id_idx",+ "columns": ["recipientId"],+ "isUnique": false+ },+ "org_id_idx": {+ "name": "org_id_idx",+ "columns": ["orgId"],+ "isUnique": false+ },+ "type_idx": {+ "name": "type_idx",+ "columns": ["type"],+ "isUnique": false+ },+ "read_at_idx": {+ "name": "read_at_idx",+ "columns": ["readAt"],+ "isUnique": false+ },+ "created_at_idx": {+ "name": "created_at_idx",+ "columns": ["createdAt"],+ "isUnique": false+ },+ "recipient_read_idx": {+ "name": "recipient_read_idx",+ "columns": ["recipientId", "readAt"],+ "isUnique": false+ },+ "recipient_created_idx": {+ "name": "recipient_created_idx",+ "columns": ["recipientId", "createdAt"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "notifications_id": {+ "name": "notifications_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {+ "notifications_id_unique": {+ "name": "notifications_id_unique",+ "columns": ["id"]+ }+ },+ "checkConstraint": {}+ },+ "organization_invites": {+ "name": "organization_invites",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "invitedEmail": {+ "name": "invitedEmail",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "invitedByUserId": {+ "name": "invitedByUserId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'pending'"+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": ["organizationId"],+ "isUnique": false+ },+ "invited_email_idx": {+ "name": "invited_email_idx",+ "columns": ["invitedEmail"],+ "isUnique": false+ },+ "invited_by_user_id_idx": {+ "name": "invited_by_user_id_idx",+ "columns": ["invitedByUserId"],+ "isUnique": false+ },+ "status_idx": {+ "name": "status_idx",+ "columns": ["status"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "organization_invites_id": {+ "name": "organization_invites_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "organization_members": {+ "name": "organization_members",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": ["organizationId"],+ "isUnique": false+ },+ "user_id_organization_id_idx": {+ "name": "user_id_organization_id_idx",+ "columns": ["userId", "organizationId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "organization_members_id": {+ "name": "organization_members_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "organizations": {+ "name": "organizations",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ownerId": {+ "name": "ownerId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "metadata": {+ "name": "metadata",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "tombstoneAt": {+ "name": "tombstoneAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "allowedEmailDomain": {+ "name": "allowedEmailDomain",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "customDomain": {+ "name": "customDomain",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "domainVerified": {+ "name": "domainVerified",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "settings": {+ "name": "settings",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "iconUrl": {+ "name": "iconUrl",+ "type": "varchar(1024)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "workosOrganizationId": {+ "name": "workosOrganizationId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "workosConnectionId": {+ "name": "workosConnectionId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "owner_id_tombstone_idx": {+ "name": "owner_id_tombstone_idx",+ "columns": ["ownerId", "tombstoneAt"],+ "isUnique": false+ },+ "custom_domain_idx": {+ "name": "custom_domain_idx",+ "columns": ["customDomain"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "organizations_id": {+ "name": "organizations_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "s3_buckets": {+ "name": "s3_buckets",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ownerId": {+ "name": "ownerId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "region": {+ "name": "region",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "endpoint": {+ "name": "endpoint",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "bucketName": {+ "name": "bucketName",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "accessKeyId": {+ "name": "accessKeyId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "secretAccessKey": {+ "name": "secretAccessKey",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "('aws')"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "s3_buckets_id": {+ "name": "s3_buckets_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {+ "s3_buckets_id_unique": {+ "name": "s3_buckets_id_unique",+ "columns": ["id"]+ }+ },+ "checkConstraint": {}+ },+ "sessions": {+ "name": "sessions",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "sessionToken": {+ "name": "sessionToken",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires": {+ "name": "expires",+ "type": "datetime",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "session_token_idx": {+ "name": "session_token_idx",+ "columns": ["sessionToken"],+ "isUnique": true+ },+ "user_id_idx": {+ "name": "user_id_idx",+ "columns": ["userId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "sessions_id": {+ "name": "sessions_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "shared_videos": {+ "name": "shared_videos",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "videoId": {+ "name": "videoId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "folderId": {+ "name": "folderId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "sharedByUserId": {+ "name": "sharedByUserId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "sharedAt": {+ "name": "sharedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ }+ },+ "indexes": {+ "video_id_idx": {+ "name": "video_id_idx",+ "columns": ["videoId"],+ "isUnique": false+ },+ "folder_id_idx": {+ "name": "folder_id_idx",+ "columns": ["folderId"],+ "isUnique": false+ },+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": ["organizationId"],+ "isUnique": false+ },+ "shared_by_user_id_idx": {+ "name": "shared_by_user_id_idx",+ "columns": ["sharedByUserId"],+ "isUnique": false+ },+ "video_id_organization_id_idx": {+ "name": "video_id_organization_id_idx",+ "columns": ["videoId", "organizationId"],+ "isUnique": false+ },+ "video_id_folder_id_idx": {+ "name": "video_id_folder_id_idx",+ "columns": ["videoId", "folderId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "shared_videos_id": {+ "name": "shared_videos_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {+ "shared_videos_id_unique": {+ "name": "shared_videos_id_unique",+ "columns": ["id"]+ }+ },+ "checkConstraint": {}+ },+ "space_members": {+ "name": "space_members",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "spaceId": {+ "name": "spaceId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'member'"+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "space_id_idx": {+ "name": "space_id_idx",+ "columns": ["spaceId"],+ "isUnique": false+ },+ "user_id_idx": {+ "name": "user_id_idx",+ "columns": ["userId"],+ "isUnique": false+ },+ "space_id_user_id_idx": {+ "name": "space_id_user_id_idx",+ "columns": ["spaceId", "userId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "space_members_id": {+ "name": "space_members_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {+ "space_members_id_unique": {+ "name": "space_members_id_unique",+ "columns": ["id"]+ },+ "space_id_user_id_unique": {+ "name": "space_id_user_id_unique",+ "columns": ["spaceId", "userId"]+ }+ },+ "checkConstraint": {}+ },+ "space_videos": {+ "name": "space_videos",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "spaceId": {+ "name": "spaceId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "folderId": {+ "name": "folderId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "videoId": {+ "name": "videoId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "addedById": {+ "name": "addedById",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "addedAt": {+ "name": "addedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ }+ },+ "indexes": {+ "space_id_idx": {+ "name": "space_id_idx",+ "columns": ["spaceId"],+ "isUnique": false+ },+ "folder_id_idx": {+ "name": "folder_id_idx",+ "columns": ["folderId"],+ "isUnique": false+ },+ "video_id_idx": {+ "name": "video_id_idx",+ "columns": ["videoId"],+ "isUnique": false+ },+ "added_by_id_idx": {+ "name": "added_by_id_idx",+ "columns": ["addedById"],+ "isUnique": false+ },+ "space_id_video_id_idx": {+ "name": "space_id_video_id_idx",+ "columns": ["spaceId", "videoId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "space_videos_id": {+ "name": "space_videos_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {+ "space_videos_id_unique": {+ "name": "space_videos_id_unique",+ "columns": ["id"]+ }+ },+ "checkConstraint": {}+ },+ "spaces": {+ "name": "spaces",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "primary": {+ "name": "primary",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdById": {+ "name": "createdById",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "iconUrl": {+ "name": "iconUrl",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "varchar(1000)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "privacy": {+ "name": "privacy",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'Private'"+ }+ },+ "indexes": {+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": ["organizationId"],+ "isUnique": false+ },+ "created_by_id_idx": {+ "name": "created_by_id_idx",+ "columns": ["createdById"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "spaces_id": {+ "name": "spaces_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {+ "spaces_id_unique": {+ "name": "spaces_id_unique",+ "columns": ["id"]+ }+ },+ "checkConstraint": {}+ },+ "users": {+ "name": "users",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "lastName": {+ "name": "lastName",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "emailVerified": {+ "name": "emailVerified",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "image": {+ "name": "image",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeCustomerId": {+ "name": "stripeCustomerId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeSubscriptionId": {+ "name": "stripeSubscriptionId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "thirdPartyStripeSubscriptionId": {+ "name": "thirdPartyStripeSubscriptionId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeSubscriptionStatus": {+ "name": "stripeSubscriptionStatus",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeSubscriptionPriceId": {+ "name": "stripeSubscriptionPriceId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "preferences": {+ "name": "preferences",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "('null')"+ },+ "activeOrganizationId": {+ "name": "activeOrganizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "onboardingSteps": {+ "name": "onboardingSteps",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "onboarding_completed_at": {+ "name": "onboarding_completed_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "customBucket": {+ "name": "customBucket",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "inviteQuota": {+ "name": "inviteQuota",+ "type": "int",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 1+ },+ "defaultOrgId": {+ "name": "defaultOrgId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "email_idx": {+ "name": "email_idx",+ "columns": ["email"],+ "isUnique": true+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "users_id": {+ "name": "users_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "verification_tokens": {+ "name": "verification_tokens",+ "columns": {+ "identifier": {+ "name": "identifier",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires": {+ "name": "expires",+ "type": "datetime",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "verification_tokens_identifier": {+ "name": "verification_tokens_identifier",+ "columns": ["identifier"]+ }+ },+ "uniqueConstraints": {+ "verification_tokens_token_unique": {+ "name": "verification_tokens_token_unique",+ "columns": ["token"]+ }+ },+ "checkConstraint": {}+ },+ "video_uploads": {+ "name": "video_uploads",+ "columns": {+ "video_id": {+ "name": "video_id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "uploaded": {+ "name": "uploaded",+ "type": "int",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "total": {+ "name": "total",+ "type": "int",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "mode": {+ "name": "mode",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "video_uploads_video_id": {+ "name": "video_uploads_video_id",+ "columns": ["video_id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "videos": {+ "name": "videos",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ownerId": {+ "name": "ownerId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "orgId": {+ "name": "orgId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'My Video'"+ },+ "bucket": {+ "name": "bucket",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "duration": {+ "name": "duration",+ "type": "float",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "width": {+ "name": "width",+ "type": "int",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "height": {+ "name": "height",+ "type": "int",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "fps": {+ "name": "fps",+ "type": "int",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "metadata": {+ "name": "metadata",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "public": {+ "name": "public",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": true+ },+ "settings": {+ "name": "settings",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "transcriptionStatus": {+ "name": "transcriptionStatus",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "source": {+ "name": "source",+ "type": "json",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "('{\"type\":\"MediaConvert\"}')"+ },+ "folderId": {+ "name": "folderId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "effectiveCreatedAt": {+ "name": "effectiveCreatedAt",+ "type": "datetime",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "generated": {+ "as": "COALESCE(\n STR_TO_DATE(JSON_UNQUOTE(JSON_EXTRACT(`metadata`, '$.customCreatedAt')), '%Y-%m-%dT%H:%i:%s.%fZ'),\n STR_TO_DATE(JSON_UNQUOTE(JSON_EXTRACT(`metadata`, '$.customCreatedAt')), '%Y-%m-%dT%H:%i:%sZ'),\n `createdAt`\n )",+ "type": "stored"+ }+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "xStreamInfo": {+ "name": "xStreamInfo",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "isScreenshot": {+ "name": "isScreenshot",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "awsRegion": {+ "name": "awsRegion",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "awsBucket": {+ "name": "awsBucket",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "videoStartTime": {+ "name": "videoStartTime",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "audioStartTime": {+ "name": "audioStartTime",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "jobId": {+ "name": "jobId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "jobStatus": {+ "name": "jobStatus",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "skipProcessing": {+ "name": "skipProcessing",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ }+ },+ "indexes": {+ "owner_id_idx": {+ "name": "owner_id_idx",+ "columns": ["ownerId"],+ "isUnique": false+ },+ "is_public_idx": {+ "name": "is_public_idx",+ "columns": ["public"],+ "isUnique": false+ },+ "folder_id_idx": {+ "name": "folder_id_idx",+ "columns": ["folderId"],+ "isUnique": false+ },+ "org_owner_folder_idx": {+ "name": "org_owner_folder_idx",+ "columns": ["orgId", "ownerId", "folderId"],+ "isUnique": false+ },+ "org_effective_created_idx": {+ "name": "org_effective_created_idx",+ "columns": ["orgId", "effectiveCreatedAt"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "videos_id": {+ "name": "videos_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ }+ },+ "views": {},+ "_meta": {+ "schemas": {},+ "tables": {},+ "columns": {}+ },+ "internal": {+ "tables": {},+ "indexes": {}+ }+}diff --git a/packages/database/migrations/meta/0008_snapshot.json b/packages/database/migrations/meta/0008_snapshot.jsonnew file mode 100644index 000000000..d74919328--- /dev/null+++ b/packages/database/migrations/meta/0008_snapshot.json@@ -0,0 +1,1847 @@+{+ "version": "5",+ "dialect": "mysql",+ "id": "bfb0c13d-cfec-4ae3-b80f-4dbbb99bacbd",+ "prevId": "d5cc82ff-f127-4f0c-a31d-d859447ae2a2",+ "tables": {+ "accounts": {+ "name": "accounts",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider": {+ "name": "provider",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "providerAccountId": {+ "name": "providerAccountId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "expires_in": {+ "name": "expires_in",+ "type": "int",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "id_token": {+ "name": "id_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "refresh_token_expires_in": {+ "name": "refresh_token_expires_in",+ "type": "int",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "scope": {+ "name": "scope",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "token_type": {+ "name": "token_type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "tempColumn": {+ "name": "tempColumn",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "user_id_idx": {+ "name": "user_id_idx",+ "columns": ["userId"],+ "isUnique": false+ },+ "provider_account_id_idx": {+ "name": "provider_account_id_idx",+ "columns": ["providerAccountId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "accounts_id": {+ "name": "accounts_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "auth_api_keys": {+ "name": "auth_api_keys",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(36)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "auth_api_keys_id": {+ "name": "auth_api_keys_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "comments": {+ "name": "comments",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "varchar(6)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "timestamp": {+ "name": "timestamp",+ "type": "float",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "authorId": {+ "name": "authorId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "videoId": {+ "name": "videoId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "parentCommentId": {+ "name": "parentCommentId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "video_type_created_idx": {+ "name": "video_type_created_idx",+ "columns": ["videoId", "type", "createdAt", "id"],+ "isUnique": false+ },+ "author_id_idx": {+ "name": "author_id_idx",+ "columns": ["authorId"],+ "isUnique": false+ },+ "parent_comment_id_idx": {+ "name": "parent_comment_id_idx",+ "columns": ["parentCommentId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "comments_id": {+ "name": "comments_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "folders": {+ "name": "folders",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "color": {+ "name": "color",+ "type": "varchar(16)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'normal'"+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdById": {+ "name": "createdById",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "parentId": {+ "name": "parentId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "spaceId": {+ "name": "spaceId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": ["organizationId"],+ "isUnique": false+ },+ "created_by_id_idx": {+ "name": "created_by_id_idx",+ "columns": ["createdById"],+ "isUnique": false+ },+ "parent_id_idx": {+ "name": "parent_id_idx",+ "columns": ["parentId"],+ "isUnique": false+ },+ "space_id_idx": {+ "name": "space_id_idx",+ "columns": ["spaceId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "folders_id": {+ "name": "folders_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "imported_videos": {+ "name": "imported_videos",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "orgId": {+ "name": "orgId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "source": {+ "name": "source",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "source_id": {+ "name": "source_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "imported_videos_orgId_source_source_id_pk": {+ "name": "imported_videos_orgId_source_source_id_pk",+ "columns": ["orgId", "source", "source_id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "notifications": {+ "name": "notifications",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "orgId": {+ "name": "orgId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "recipientId": {+ "name": "recipientId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "varchar(10)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "data": {+ "name": "data",+ "type": "json",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "readAt": {+ "name": "readAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ }+ },+ "indexes": {+ "org_id_idx": {+ "name": "org_id_idx",+ "columns": ["orgId"],+ "isUnique": false+ },+ "type_idx": {+ "name": "type_idx",+ "columns": ["type"],+ "isUnique": false+ },+ "read_at_idx": {+ "name": "read_at_idx",+ "columns": ["readAt"],+ "isUnique": false+ },+ "created_at_idx": {+ "name": "created_at_idx",+ "columns": ["createdAt"],+ "isUnique": false+ },+ "recipient_read_idx": {+ "name": "recipient_read_idx",+ "columns": ["recipientId", "readAt"],+ "isUnique": false+ },+ "recipient_created_idx": {+ "name": "recipient_created_idx",+ "columns": ["recipientId", "createdAt"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "notifications_id": {+ "name": "notifications_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "organization_invites": {+ "name": "organization_invites",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "invitedEmail": {+ "name": "invitedEmail",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "invitedByUserId": {+ "name": "invitedByUserId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'pending'"+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": ["organizationId"],+ "isUnique": false+ },+ "invited_email_idx": {+ "name": "invited_email_idx",+ "columns": ["invitedEmail"],+ "isUnique": false+ },+ "invited_by_user_id_idx": {+ "name": "invited_by_user_id_idx",+ "columns": ["invitedByUserId"],+ "isUnique": false+ },+ "status_idx": {+ "name": "status_idx",+ "columns": ["status"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "organization_invites_id": {+ "name": "organization_invites_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "organization_members": {+ "name": "organization_members",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": ["organizationId"],+ "isUnique": false+ },+ "user_id_organization_id_idx": {+ "name": "user_id_organization_id_idx",+ "columns": ["userId", "organizationId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "organization_members_id": {+ "name": "organization_members_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "organizations": {+ "name": "organizations",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ownerId": {+ "name": "ownerId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "metadata": {+ "name": "metadata",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "tombstoneAt": {+ "name": "tombstoneAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "allowedEmailDomain": {+ "name": "allowedEmailDomain",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "customDomain": {+ "name": "customDomain",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "domainVerified": {+ "name": "domainVerified",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "settings": {+ "name": "settings",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "iconUrl": {+ "name": "iconUrl",+ "type": "varchar(1024)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "workosOrganizationId": {+ "name": "workosOrganizationId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "workosConnectionId": {+ "name": "workosConnectionId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "owner_id_tombstone_idx": {+ "name": "owner_id_tombstone_idx",+ "columns": ["ownerId", "tombstoneAt"],+ "isUnique": false+ },+ "custom_domain_idx": {+ "name": "custom_domain_idx",+ "columns": ["customDomain"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "organizations_id": {+ "name": "organizations_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "s3_buckets": {+ "name": "s3_buckets",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ownerId": {+ "name": "ownerId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "region": {+ "name": "region",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "endpoint": {+ "name": "endpoint",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "bucketName": {+ "name": "bucketName",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "accessKeyId": {+ "name": "accessKeyId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "secretAccessKey": {+ "name": "secretAccessKey",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "('aws')"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "s3_buckets_id": {+ "name": "s3_buckets_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "sessions": {+ "name": "sessions",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "sessionToken": {+ "name": "sessionToken",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires": {+ "name": "expires",+ "type": "datetime",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "session_token_idx": {+ "name": "session_token_idx",+ "columns": ["sessionToken"],+ "isUnique": true+ },+ "user_id_idx": {+ "name": "user_id_idx",+ "columns": ["userId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "sessions_id": {+ "name": "sessions_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "shared_videos": {+ "name": "shared_videos",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "videoId": {+ "name": "videoId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "folderId": {+ "name": "folderId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "sharedByUserId": {+ "name": "sharedByUserId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "sharedAt": {+ "name": "sharedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ }+ },+ "indexes": {+ "folder_id_idx": {+ "name": "folder_id_idx",+ "columns": ["folderId"],+ "isUnique": false+ },+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": ["organizationId"],+ "isUnique": false+ },+ "shared_by_user_id_idx": {+ "name": "shared_by_user_id_idx",+ "columns": ["sharedByUserId"],+ "isUnique": false+ },+ "video_id_organization_id_idx": {+ "name": "video_id_organization_id_idx",+ "columns": ["videoId", "organizationId"],+ "isUnique": false+ },+ "video_id_folder_id_idx": {+ "name": "video_id_folder_id_idx",+ "columns": ["videoId", "folderId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "shared_videos_id": {+ "name": "shared_videos_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "space_members": {+ "name": "space_members",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "spaceId": {+ "name": "spaceId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'member'"+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "user_id_idx": {+ "name": "user_id_idx",+ "columns": ["userId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "space_members_id": {+ "name": "space_members_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {+ "space_id_user_id_unique": {+ "name": "space_id_user_id_unique",+ "columns": ["spaceId", "userId"]+ }+ },+ "checkConstraint": {}+ },+ "space_videos": {+ "name": "space_videos",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "spaceId": {+ "name": "spaceId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "folderId": {+ "name": "folderId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "videoId": {+ "name": "videoId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "addedById": {+ "name": "addedById",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "addedAt": {+ "name": "addedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ }+ },+ "indexes": {+ "folder_id_idx": {+ "name": "folder_id_idx",+ "columns": ["folderId"],+ "isUnique": false+ },+ "video_id_idx": {+ "name": "video_id_idx",+ "columns": ["videoId"],+ "isUnique": false+ },+ "added_by_id_idx": {+ "name": "added_by_id_idx",+ "columns": ["addedById"],+ "isUnique": false+ },+ "space_id_video_id_idx": {+ "name": "space_id_video_id_idx",+ "columns": ["spaceId", "videoId"],+ "isUnique": false+ },+ "space_id_folder_id_idx": {+ "name": "space_id_folder_id_idx",+ "columns": ["spaceId", "folderId"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "space_videos_id": {+ "name": "space_videos_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "spaces": {+ "name": "spaces",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "primary": {+ "name": "primary",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdById": {+ "name": "createdById",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "iconUrl": {+ "name": "iconUrl",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "varchar(1000)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "privacy": {+ "name": "privacy",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'Private'"+ }+ },+ "indexes": {+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": ["organizationId"],+ "isUnique": false+ },+ "created_by_id_idx": {+ "name": "created_by_id_idx",+ "columns": ["createdById"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "spaces_id": {+ "name": "spaces_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "users": {+ "name": "users",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "lastName": {+ "name": "lastName",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "emailVerified": {+ "name": "emailVerified",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "image": {+ "name": "image",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeCustomerId": {+ "name": "stripeCustomerId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeSubscriptionId": {+ "name": "stripeSubscriptionId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "thirdPartyStripeSubscriptionId": {+ "name": "thirdPartyStripeSubscriptionId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeSubscriptionStatus": {+ "name": "stripeSubscriptionStatus",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeSubscriptionPriceId": {+ "name": "stripeSubscriptionPriceId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "preferences": {+ "name": "preferences",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "('null')"+ },+ "activeOrganizationId": {+ "name": "activeOrganizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "onboardingSteps": {+ "name": "onboardingSteps",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "onboarding_completed_at": {+ "name": "onboarding_completed_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "customBucket": {+ "name": "customBucket",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "inviteQuota": {+ "name": "inviteQuota",+ "type": "int",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 1+ },+ "defaultOrgId": {+ "name": "defaultOrgId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "email_idx": {+ "name": "email_idx",+ "columns": ["email"],+ "isUnique": true+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "users_id": {+ "name": "users_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "verification_tokens": {+ "name": "verification_tokens",+ "columns": {+ "identifier": {+ "name": "identifier",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires": {+ "name": "expires",+ "type": "datetime",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "verification_tokens_identifier": {+ "name": "verification_tokens_identifier",+ "columns": ["identifier"]+ }+ },+ "uniqueConstraints": {+ "verification_tokens_token_unique": {+ "name": "verification_tokens_token_unique",+ "columns": ["token"]+ }+ },+ "checkConstraint": {}+ },+ "video_uploads": {+ "name": "video_uploads",+ "columns": {+ "video_id": {+ "name": "video_id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "uploaded": {+ "name": "uploaded",+ "type": "int",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "total": {+ "name": "total",+ "type": "int",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "mode": {+ "name": "mode",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "video_uploads_video_id": {+ "name": "video_uploads_video_id",+ "columns": ["video_id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ },+ "videos": {+ "name": "videos",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ownerId": {+ "name": "ownerId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "orgId": {+ "name": "orgId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'My Video'"+ },+ "bucket": {+ "name": "bucket",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "duration": {+ "name": "duration",+ "type": "float",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "width": {+ "name": "width",+ "type": "int",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "height": {+ "name": "height",+ "type": "int",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "fps": {+ "name": "fps",+ "type": "int",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "metadata": {+ "name": "metadata",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "public": {+ "name": "public",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": true+ },+ "settings": {+ "name": "settings",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "transcriptionStatus": {+ "name": "transcriptionStatus",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "source": {+ "name": "source",+ "type": "json",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "('{\"type\":\"MediaConvert\"}')"+ },+ "folderId": {+ "name": "folderId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "effectiveCreatedAt": {+ "name": "effectiveCreatedAt",+ "type": "datetime",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "generated": {+ "as": "COALESCE(\n STR_TO_DATE(JSON_UNQUOTE(JSON_EXTRACT(`metadata`, '$.customCreatedAt')), '%Y-%m-%dT%H:%i:%s.%fZ'),\n STR_TO_DATE(JSON_UNQUOTE(JSON_EXTRACT(`metadata`, '$.customCreatedAt')), '%Y-%m-%dT%H:%i:%sZ'),\n `createdAt`\n )",+ "type": "stored"+ }+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "xStreamInfo": {+ "name": "xStreamInfo",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "isScreenshot": {+ "name": "isScreenshot",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "awsRegion": {+ "name": "awsRegion",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "awsBucket": {+ "name": "awsBucket",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "videoStartTime": {+ "name": "videoStartTime",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "audioStartTime": {+ "name": "audioStartTime",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "jobId": {+ "name": "jobId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "jobStatus": {+ "name": "jobStatus",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "skipProcessing": {+ "name": "skipProcessing",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ }+ },+ "indexes": {+ "owner_id_idx": {+ "name": "owner_id_idx",+ "columns": ["ownerId"],+ "isUnique": false+ },+ "is_public_idx": {+ "name": "is_public_idx",+ "columns": ["public"],+ "isUnique": false+ },+ "folder_id_idx": {+ "name": "folder_id_idx",+ "columns": ["folderId"],+ "isUnique": false+ },+ "org_owner_folder_idx": {+ "name": "org_owner_folder_idx",+ "columns": ["orgId", "ownerId", "folderId"],+ "isUnique": false+ },+ "org_effective_created_idx": {+ "name": "org_effective_created_idx",+ "columns": ["orgId", "effectiveCreatedAt"],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "videos_id": {+ "name": "videos_id",+ "columns": ["id"]+ }+ },+ "uniqueConstraints": {},+ "checkConstraint": {}+ }+ },+ "views": {},+ "_meta": {+ "schemas": {},+ "tables": {},+ "columns": {}+ },+ "internal": {+ "tables": {},+ "indexes": {}+ }+}diff --git a/packages/database/migrations/meta/_journal.json b/packages/database/migrations/meta/_journal.jsonindex df9de22f0..6fdc4535e 100644--- a/packages/database/migrations/meta/_journal.json+++ b/packages/database/migrations/meta/_journal.json@@ -50,6 +50,20 @@"when": 1762410865419,"tag": "0006_hesitant_stone_men","breakpoints": true+ },+ {+ "idx": 7,+ "version": "5",+ "when": 1762428551824,+ "tag": "0007_public_toxin",+ "breakpoints": true+ },+ {+ "idx": 8,+ "version": "5",+ "when": 1762428905323,+ "tag": "0008_fat_ender_wiggin",+ "breakpoints": true}]}diff --git a/packages/database/schema.ts b/packages/database/schema.tsindex ab14efa62..df19e0f83 100644--- a/packages/database/schema.ts+++ b/packages/database/schema.ts@@ -8,6 +8,7 @@ import type {User,Video,} from "@cap/web-domain";+import { sql } from "drizzle-orm";import {boolean,customType,@@ -60,10 +61,10 @@ const encryptedTextNullable = customType<{ data: string; notNull: false }>({export const users = mysqlTable("users",{- id: nanoId("id").notNull().primaryKey().unique().$type<User.UserId>(),+ id: nanoId("id").notNull().primaryKey().$type<User.UserId>(),name: varchar("name", { length: 255 }),lastName: varchar("lastName", { length: 255 }),- email: varchar("email", { length: 255 }).unique().notNull(),+ email: varchar("email", { length: 255 }).notNull(),emailVerified: timestamp("emailVerified"),image: varchar("image", { length: 255 }).$type<ImageUpload.ImageUrlOrKey>(),stripeCustomerId: varchar("stripeCustomerId", { length: 255 }),@@ -121,7 +122,7 @@ export const users = mysqlTable(export const accounts = mysqlTable("accounts",{- id: nanoId("id").notNull().primaryKey().unique(),+ id: nanoId("id").notNull().primaryKey(),userId: nanoId("userId").notNull(),type: varchar("type", { length: 255 }).notNull(),provider: varchar("provider", { length: 255 }).notNull(),@@ -148,8 +149,8 @@ export const accounts = mysqlTable(export const sessions = mysqlTable("sessions",{- id: nanoId("id").notNull().primaryKey().unique(),- sessionToken: varchar("sessionToken", { length: 255 }).unique().notNull(),+ id: nanoId("id").notNull().primaryKey(),+ sessionToken: varchar("sessionToken", { length: 255 }).notNull(),userId: nanoId("userId").notNull().$type<User.UserId>(),expires: datetime("expires").notNull(),created_at: timestamp("created_at").notNull().defaultNow(),@@ -175,7 +176,6 @@ export const organizations = mysqlTable(id: nanoId("id").notNull().primaryKey()- .unique().$type<Organisation.OrganisationId>(),name: varchar("name", { length: 255 }).notNull(),ownerId: nanoId("ownerId").notNull().$type<User.UserId>(),@@ -201,7 +201,10 @@ export const organizations = mysqlTable(workosConnectionId: varchar("workosConnectionId", { length: 255 }),},(table) => ({- ownerIdIndex: index("owner_id_idx").on(table.ownerId),+ ownerIdTombstoneIndex: index("owner_id_tombstone_idx").on(+ table.ownerId,+ table.tombstoneAt,+ ),customDomainIndex: index("custom_domain_idx").on(table.customDomain),}),);@@ -210,7 +213,7 @@ export type OrganisationMemberRole = "owner" | "member";export const organizationMembers = mysqlTable("organization_members",{- id: nanoId("id").notNull().primaryKey().unique(),+ id: nanoId("id").notNull().primaryKey(),userId: nanoId("userId").notNull().$type<User.UserId>(),organizationId: nanoId("organizationId").notNull()@@ -222,7 +225,6 @@ export const organizationMembers = mysqlTable(updatedAt: timestamp("updatedAt").notNull().defaultNow().onUpdateNow(),},(table) => ({- userIdIndex: index("user_id_idx").on(table.userId),organizationIdIndex: index("organization_id_idx").on(table.organizationId),userIdOrganizationIdIndex: index("user_id_organization_id_idx").on(table.userId,@@ -234,7 +236,7 @@ export const organizationMembers = mysqlTable(export const organizationInvites = mysqlTable("organization_invites",{- id: nanoId("id").notNull().primaryKey().unique(),+ id: nanoId("id").notNull().primaryKey(),organizationId: nanoId("organizationId").notNull().$type<Organisation.OrganisationId>(),@@ -261,7 +263,7 @@ export const organizationInvites = mysqlTable(export const folders = mysqlTable("folders",{- id: nanoId("id").notNull().primaryKey().unique().$type<Folder.FolderId>(),+ id: nanoId("id").notNull().primaryKey().$type<Folder.FolderId>(),name: varchar("name", { length: 255 }).notNull(),color: varchar("color", {length: 16,@@ -289,7 +291,7 @@ export const folders = mysqlTable(export const videos = mysqlTable("videos",{- id: nanoId("id").notNull().primaryKey().unique().$type<Video.VideoId>(),+ id: nanoId("id").notNull().primaryKey().$type<Video.VideoId>(),ownerId: nanoId("ownerId").notNull().$type<User.UserId>(),orgId: nanoIdRequired("orgId").$type<Organisation.OrganisationId>(),name: varchar("name", { length: 255 }).notNull().default("My Video"),@@ -320,6 +322,12 @@ export const videos = mysqlTable(.default({ type: "MediaConvert" }),folderId: nanoIdNullable("folderId").$type<Folder.FolderId>(),createdAt: timestamp("createdAt").notNull().defaultNow(),+ effectiveCreatedAt: datetime("effectiveCreatedAt").generatedAlwaysAs(+ sql.raw(+ "COALESCE(\n STR_TO_DATE(JSON_UNQUOTE(JSON_EXTRACT(`metadata`, '$.customCreatedAt')), '%Y-%m-%dT%H:%i:%s.%fZ'),\n STR_TO_DATE(JSON_UNQUOTE(JSON_EXTRACT(`metadata`, '$.customCreatedAt')), '%Y-%m-%dT%H:%i:%sZ'),\n `createdAt`\n )",+ ),+ { mode: "stored" },+ ),updatedAt: timestamp("updatedAt").notNull().defaultNow().onUpdateNow(),// PRIVATEpassword: encryptedTextNullable("password"),@@ -336,17 +344,25 @@ export const videos = mysqlTable(skipProcessing: boolean("skipProcessing").notNull().default(false),},(table) => [- index("id_idx").on(table.id),index("owner_id_idx").on(table.ownerId),index("is_public_idx").on(table.public),index("folder_id_idx").on(table.folderId),+ index("org_owner_folder_idx").on(+ table.orgId,+ table.ownerId,+ table.folderId,+ ),+ index("org_effective_created_idx").on(+ table.orgId,+ table.effectiveCreatedAt,+ ),],);export const sharedVideos = mysqlTable("shared_videos",{- id: nanoId("id").notNull().primaryKey().unique(),+ id: nanoId("id").notNull().primaryKey(),videoId: nanoId("videoId").notNull().$type<Video.VideoId>(),folderId: nanoIdNullable("folderId").$type<Folder.FolderId>(),organizationId: nanoId("organizationId")@@ -356,7 +372,6 @@ export const sharedVideos = mysqlTable(sharedAt: timestamp("sharedAt").notNull().defaultNow(),},(table) => ({- videoIdIndex: index("video_id_idx").on(table.videoId),folderIdIndex: index("folder_id_idx").on(table.folderId),organizationIdIndex: index("organization_id_idx").on(table.organizationId),sharedByUserIdIndex: index("shared_by_user_id_idx").on(@@ -376,7 +391,7 @@ export const sharedVideos = mysqlTable(export const comments = mysqlTable("comments",{- id: nanoId("id").notNull().primaryKey().unique().$type<Comment.CommentId>(),+ id: nanoId("id").notNull().primaryKey().$type<Comment.CommentId>(),type: varchar("type", { length: 6, enum: ["emoji", "text"] }).notNull(),content: text("content").notNull(),timestamp: float("timestamp"),@@ -388,7 +403,12 @@ export const comments = mysqlTable(nanoIdNullable("parentCommentId").$type<Comment.CommentId>(),},(table) => ({- videoIdIndex: index("video_id_idx").on(table.videoId),+ videoTypeCreatedIndex: index("video_type_created_idx").on(+ table.videoId,+ table.type,+ table.createdAt,+ table.id,+ ),authorIdIndex: index("author_id_idx").on(table.authorId),parentCommentIdIndex: index("parent_comment_id_idx").on(table.parentCommentId,@@ -399,7 +419,7 @@ export const comments = mysqlTable(export const notifications = mysqlTable("notifications",{- id: nanoId("id").notNull().primaryKey().unique(),+ id: nanoId("id").notNull().primaryKey(),orgId: nanoId("orgId").notNull().$type<Organisation.OrganisationId>(),recipientId: nanoId("recipientId").notNull().$type<User.UserId>(),type: varchar("type", { length: 10 })@@ -419,7 +439,6 @@ export const notifications = mysqlTable(createdAt: timestamp("createdAt").notNull().defaultNow(),},(table) => ({- recipientIdIndex: index("recipient_id_idx").on(table.recipientId),orgIdIndex: index("org_id_idx").on(table.orgId),typeIndex: index("type_idx").on(table.type),readAtIndex: index("read_at_idx").on(table.readAt),@@ -436,7 +455,7 @@ export const notifications = mysqlTable();export const s3Buckets = mysqlTable("s3_buckets", {- id: nanoId("id").notNull().primaryKey().unique().$type<S3Bucket.S3BucketId>(),+ id: nanoId("id").notNull().primaryKey().$type<S3Bucket.S3BucketId>(),ownerId: nanoId("ownerId").notNull().$type<User.UserId>(),// Use encryptedText for sensitive fieldsregion: encryptedText("region").notNull(),@@ -459,7 +478,7 @@ export const notificationsRelations = relations(notifications, ({ one }) => ({}));export const authApiKeys = mysqlTable("auth_api_keys", {- id: varchar("id", { length: 36 }).notNull().primaryKey().unique(),+ id: varchar("id", { length: 36 }).notNull().primaryKey(),userId: nanoId("userId").notNull().$type<User.UserId>(),createdAt: timestamp("createdAt").defaultNow().notNull(),});@@ -595,7 +614,6 @@ export const spaces = mysqlTable(id: nanoId("id").notNull().primaryKey()- .unique().$type<Space.SpaceIdOrOrganisationId>(),primary: boolean("primary").notNull().default(false),name: varchar("name", { length: 255 }).notNull(),@@ -622,7 +640,7 @@ export const spaces = mysqlTable(export const spaceMembers = mysqlTable("space_members",{- id: nanoId("id").notNull().primaryKey().unique(),+ id: nanoId("id").notNull().primaryKey(),spaceId: nanoId("spaceId").notNull().$type<Space.SpaceIdOrOrganisationId>(),userId: nanoId("userId").notNull().$type<User.UserId>(),role: varchar("role", { length: 255 })@@ -633,12 +651,7 @@ export const spaceMembers = mysqlTable(updatedAt: timestamp("updatedAt").notNull().defaultNow().onUpdateNow(),},(table) => ({- spaceIdIndex: index("space_id_idx").on(table.spaceId),userIdIndex: index("user_id_idx").on(table.userId),- spaceIdUserIdIndex: index("space_id_user_id_idx").on(- table.spaceId,- table.userId,- ),spaceIdUserIdUnique: unique("space_id_user_id_unique").on(table.spaceId,table.userId,@@ -649,7 +662,7 @@ export const spaceMembers = mysqlTable(export const spaceVideos = mysqlTable("space_videos",{- id: nanoId("id").notNull().primaryKey().unique(),+ id: nanoId("id").notNull().primaryKey(),spaceId: nanoId("spaceId").notNull().$type<Space.SpaceIdOrOrganisationId>(),folderId: nanoIdNullable("folderId").$type<Folder.FolderId>(),videoId: nanoId("videoId").notNull().$type<Video.VideoId>(),@@ -657,7 +670,6 @@ export const spaceVideos = mysqlTable(addedAt: timestamp("addedAt").notNull().defaultNow(),},(table) => ({- spaceIdIndex: index("space_id_idx").on(table.spaceId),folderIdIndex: index("folder_id_idx").on(table.folderId),videoIdIndex: index("video_id_idx").on(table.videoId),addedByIdIndex: index("added_by_id_idx").on(table.addedById),@@ -665,6 +677,10 @@ export const spaceVideos = mysqlTable(table.spaceId,table.videoId,),+ spaceIdFolderIdIndex: index("space_id_folder_id_idx").on(+ table.spaceId,+ table.folderId,+ ),}),);