Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
"""Canvas projects, each member's workspace in them, and the documents of projects that lost their owner."""
from sqlalchemy import CheckConstraint, Column, ForeignKey, Index, PrimaryKeyConstraint
from invokeai.app.services.shared.database.schema.metadata import (
USER_ID_LENGTH,
default,
inserted_at,
table,
updated_at,
)
from invokeai.app.services.shared.database.types import BigInt, Key, LongText, Timestamp
projects = table(
"projects",
# Generated by the client; unique across accounts.
Column("project_id", Key(), nullable=False),
# The owner.
Column("user_id", Key(USER_ID_LENGTH), ForeignKey("users.user_id", ondelete="CASCADE"), nullable=False),
Column("name", LongText(), nullable=False),
# The client's project content (JSON); each member's workspace is in `project_workspaces`.
Column("data", LongText(), nullable=False),
# The project's own board. Unique: at most one project per board. RESTRICT: a claimed board cannot be deleted.
Column("board_id", Key(), ForeignKey("boards.board_id", ondelete="RESTRICT"), nullable=False, unique=True),
# Incremented on every update, for optimistic concurrency.
Column("revision", BigInt(), nullable=False, server_default=default(1)),
inserted_at(),
updated_at(),
Column("minimum_canvas_schema_version", BigInt(), nullable=False, server_default=default(2)),
# The oldest project document schema that can read `data`: a client that understands less is refused it.
Column("minimum_document_schema_version", BigInt(), nullable=False, server_default=default(3)),
PrimaryKeyConstraint("project_id"),
CheckConstraint("minimum_canvas_schema_version >= 1", name="minimum_canvas_schema_version"),
CheckConstraint("minimum_document_schema_version >= 1", name="minimum_document_schema_version"),
)
Index("idx_projects_user_id", projects.c.user_id)
# One account's workspace in a project: its layout, widgets and generation settings (JSON), saved apart from the
# project content so that the two never conflict.
project_workspaces = table(
"project_workspaces",
Column("project_id", Key(), ForeignKey("projects.project_id", ondelete="CASCADE"), primary_key=True),
Column("user_id", Key(USER_ID_LENGTH), ForeignKey("users.user_id", ondelete="CASCADE"), primary_key=True),
Column("data", LongText(), nullable=False),
# Incremented on every update, for optimistic concurrency.
Column("revision", BigInt(), nullable=False, server_default=default(1)),
updated_at(),
)
Index("idx_project_workspaces_user_id", project_workspaces.c.user_id)
# Where the project boards migration put projects whose owner no longer existed, whole, for repair. Free of
# foreign keys, so it can hold what `projects` cannot. Created by that migration only when it had such projects.
orphaned_projects_2026_08_06 = table(
"orphaned_projects_2026_08_06",
Column("project_id", Key(), nullable=False),
Column("user_id", Key(USER_ID_LENGTH), nullable=False),
Column("name", LongText(), nullable=False),
Column("data", LongText(), nullable=False),
Column("revision", BigInt(), nullable=False),
Column("created_at", Timestamp(), nullable=False),
Column("updated_at", Timestamp(), nullable=False),
inserted_at("quarantined_at"),
PrimaryKeyConstraint("user_id", "project_id"),
)