Skip to content

[Step 1] Create table SnippetRepositoryStorageMove

We need to create the table SnippetRepositoryStorageMove, that will store and track all the repository storage moves we made on snippet repositories.

We can look at the existing ProjectRepositoryStorageMove table, to see the necessary fields:

CREATE TABLE public.snippet_repository_storage_moves (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    snippet_id bigint NOT NULL,
    state smallint DEFAULT 1 NOT NULL,
    source_storage_name text NOT NULL,
    destination_storage_name text NOT NULL,
    CONSTRAINT snippet_repository_storage_moves_destination_storage_name CHECK ((char_length(destination_storage_name) <= 255)),
    CONSTRAINT snippet_repository_storage_moves_source_storage_name CHECK ((char_length(source_storage_name) <= 255))
);

We need to add also an index and a foreign key on the snippet_id column.

Edited by Francisco Javier López