AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { File, FileCompression, FileType, Project } from '@activepieces/shared'
import { EntitySchema } from 'typeorm'
import {
ApIdSchema,
BaseColumnSchemaPart,
} from '../database/database-common'
type FileSchema = File & {
project: Project
}
export const FileEntity = new EntitySchema<FileSchema>({
name: 'file',
columns: {
...BaseColumnSchemaPart,
projectId: { ...ApIdSchema, nullable: true },
platformId: { ...ApIdSchema, nullable: true },
data: {
type: 'bytea',
nullable: true,
},
location: {
type: String,
nullable: false,
},
fileName: {
type: String,
nullable: true,
},
size: {
type: Number,
nullable: true,
},
metadata: {
type: 'jsonb',
nullable: true,
},
s3Key: {
type: String,
nullable: true,
},
type: {
type: String,
default: FileType.UNKNOWN,
nullable: false,
},
compression: {
type: String,
default: FileCompression.NONE,
nullable: false,
},
},
indices: [
{
name: 'idx_file_project_id_type_created',
columns: ['projectId', 'type', 'created'],
},
{
name: 'idx_file_type_created_desc',
columns: ['type', 'created'],
},
{
name: 'idx_file_platform_id_null_project',
columns: ['platformId'],
where: '"projectId" IS NULL',
},
{
// Real index is a partial expression index on (type, (metadata->>'flowId')),
// created in 1815000000000-AddSampleDataFlowIdIndexToFile. EntitySchema can't
// express the expression, so synchronize:false stops migration:generate dropping it.
name: 'idx_file_sample_data_flow_id',
columns: ['type'],
synchronize: false,
},
],
relations: {
project: {
type: 'many-to-one',
target: 'project',
cascade: true,
onDelete: 'CASCADE',
joinColumn: {
name: 'projectId',
foreignKeyConstraintName: 'fk_file_project_id',
},
},
},
})