Corsair
PluginsGoogle Drive

Google Drive Database Schema

Database entities and querying synced Google Drive data

The Google Drive plugin automatically syncs data from Google Drive to your database. This allows you to query Drive data without making API calls, providing faster access and offline capabilities.

New to Corsair? Learn about core concepts like database operations, data synchronization, and multi-tenancy before working with the database.

Full Implementation: For the complete, up-to-date database schema and implementations, see the Google Drive plugin source code on GitHub.

Synced Entities

The Google Drive plugin syncs the following entities to your database:

  • files - Files and documents
  • folders - Folders
  • sharedDrives - Shared drives (Team Drives)

Database API

Access synced data through the db property:

const files = await corsair.googledrive.db.files.search({
    data: { name: "document.pdf" },
});

Files

Schema

{
    id: string;
    name?: string;
    mimeType?: string;
    description?: string;
    starred?: boolean;
    trashed?: boolean;
    parents?: string[];
    webViewLink?: string;
    createdTime?: string;
    modifiedTime?: string;
    size?: string;
    createdAt?: Date;
}

Querying Files

Search by name:

const files = await corsair.googledrive.db.files.search({
    data: { name: "document.pdf" },
});

Find starred files:

const starredFiles = await corsair.googledrive.db.files.search({
    data: { starred: true },
});

Folders

Schema

{
    id: string;
    name?: string;
    mimeType?: string;
    parents?: string[];
    createdAt?: Date;
}

Querying Folders

Search by name:

const folders = await corsair.googledrive.db.folders.search({
    data: { name: "My Folder" },
});

Shared Drives

Schema

{
    id: string;
    name?: string;
    themeId?: string;
    colorRgb?: string;
    createdTime?: string;
    hidden?: boolean;
    createdAt?: Date;
}

Querying Shared Drives

Search by name:

const drives = await corsair.googledrive.db.sharedDrives.search({
    data: { name: "Team Drive" },
});

See Database for more information about database concepts and querying patterns.