AppFlowy-IO / AppFlowy-Cloud

AppFlowy is an open-source alternative to Notion. You are in charge of your data and customizations. Built with Flutter and Rust.
GNU Affero General Public License v3.0
528 stars 145 forks source link

[Bug] Upgrade failed: Failed to run migrations #602

Open ThanatosDi opened 1 month ago

ThanatosDi commented 1 month ago

Describe the bug When I upgrade Appflowy-Cloud from 0.4.x to 0.5.3 I already pull new docker image and git pull repository. run docker compose up -d to recreate container.

appflowy_cloud log

Error: Failed to initialize application state: Failed to run migrations: while executing migrations: error returned from database: extension "vector" is not available

postgres log

2024-06-04 09:06:22.439 UTC [42] ERROR:  extension "vector" is not available
2024-06-04 09:06:22.439 UTC [42] DETAIL:  Could not open extension control file "/usr/share/postgresql/16/extension/vector.control": No such file or directory.
2024-06-04 09:06:22.439 UTC [42] HINT:  The extension must first be installed on the system where PostgreSQL is running.
2024-06-04 09:06:22.439 UTC [42] STATEMENT:  -- Add migration script here
CREATE EXTENSION IF NOT EXISTS vector;

-- create table to store collab embeddings
CREATE TABLE IF NOT EXISTS af_collab_embeddings
(
    fragment_id TEXT NOT NULL PRIMARY KEY,
    oid TEXT NOT NULL,
    partition_key INTEGER NOT NULL,
    content_type INTEGER NOT NULL,
    indexed_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT (NOW()),
    content TEXT,
    embedding VECTOR(1536),
    FOREIGN KEY (oid, partition_key) REFERENCES af_collab (oid, partition_key) ON DELETE CASCADE
);

CREATE INDEX IF NOT EXISTS af_collab_embeddings_similarity_idx ON af_collab_embeddings USING hnsw (embedding vector_cosine_ops);
2024-06-04 09:06:22.439 UTC [42] LOG:  could not receive data from client: Connection reset by peer

It possable miss the "pgvector" extension, but I don't have any idea how to install the extension for postgres.

Screenshots image

image

Server :

ThanatosDi commented 1 month ago

oh, It my bad I forgot build the postgres image. It possable that build a postgres image for NAS mechine, that NAS can pull the image to start postgres without build.

speed2exe commented 3 weeks ago

thanks for reporting the issue, i saw this and might be helpful to you. https://hub.docker.com/r/tensorchord/pgvecto-rs