AppFlowy-Cloud/migrations/20240930135712_import_data.sql
Nathan.fooo 9c0dffacef
feat: implement import notion zip file api endpoint (#840)
* chore: implement api endpoint

* chore: worker

* chore: async zip

* chore: test bulk insert

* chore: insert collab

* chore: custom task

* chore: consume un acked message

* chore: fix compile

* chore: add test

* test: update

* chore: save import record

* chore: save import record

* chore: fix ci

* chore: remove unused deps

* chore: update docker file

* chore: build worker images

* chore: use small int

* chore: use small int

* chore: rm protoc deps in runtime

* chore: move collab cache to database crate

* chore: update test

* chore: rm health api endpoint

* chore: clippy

* chore: update ci

* chore: add test

* chore: upgrade collab

* chore: clippy

* chore: update test

* chore: use custom host

* chore: config nginx

* chore: install cert
2024-10-03 22:22:29 +08:00

21 lines
No EOL
924 B
SQL

-- Add migration script here
CREATE TABLE af_import_task(
task_id UUID NOT NULL PRIMARY KEY,
file_size BIGINT NOT NULL, -- File size in bytes, BIGINT for large files
workspace_id TEXT NOT NULL, -- Workspace id
created_by BIGINT NOT NULL, -- User ID
status SMALLINT NOT NULL, -- Status of the file import (e.g., 0 for pending, 1 for completed, 2 for failed)
metadata JSONB DEFAULT '{}' NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_af_import_task_status_created_at
ON af_import_task (status, created_at);
-- For existing workspaces, this column will be NULL. So Null and true will be considered as
-- initialized and false will be considered as not initialized.
ALTER TABLE af_workspace
ADD COLUMN is_initialized BOOLEAN DEFAULT NULL;
CREATE INDEX idx_af_workspace_is_initialized
ON af_workspace (is_initialized);