diff --git a/backend/README.md b/backend/README.md index 9e2acd77..e5e96a75 100644 --- a/backend/README.md +++ b/backend/README.md @@ -41,6 +41,10 @@ npx directus-sync seed diff \ --directus-password admin123 ``` +## Manual Seed + +In order to seed files and additional data not covered by `directus-sync` run the script `backend/directus-config/manual/seed.sh`. + ## Backup Database Either keep a copy of the `/data/database` folder or run the following command to get an sql dump @@ -118,4 +122,3 @@ sudo chmod 777 -R ./data/ This process is to be repeated whenever you restart the database docker container The same applies for the uploads and extension folder - ensure that the folder is writeable or file uploads will fail. - diff --git a/backend/directus-config/manual/files/412c25dc-a3b7-4114-b64b-cac2d6b46db3.svg b/backend/directus-config/manual/files/412c25dc-a3b7-4114-b64b-cac2d6b46db3.svg new file mode 100644 index 00000000..e28b152f --- /dev/null +++ b/backend/directus-config/manual/files/412c25dc-a3b7-4114-b64b-cac2d6b46db3.svg @@ -0,0 +1,264 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/backend/directus-config/manual/seed.sh b/backend/directus-config/manual/seed.sh new file mode 100755 index 00000000..a31092e2 --- /dev/null +++ b/backend/directus-config/manual/seed.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# base setup +SCRIPT_PATH=$(realpath $0) +SCRIPT_DIR=$(dirname $SCRIPT_PATH) +ROOT_DIR=$SCRIPT_DIR/../../.. + +DATA_DIR=$ROOT_DIR/data +DATA_UPLOADS_DIR=$DATA_DIR/uploads + +SEED_FILES_DIR=$SCRIPT_DIR/files +SEED_SQL_DIR=$SCRIPT_DIR/sql + +# copy files +cp $SEED_FILES_DIR/* $DATA_UPLOADS_DIR/ + +# apply database updates +for filename in $SEED_SQL_DIR/*.sql; do + docker exec -i utopia-map-database-1 /bin/bash -c "PGPASSWORD=directus psql -v ON_ERROR_STOP=1 --username directus directus" < $filename +done \ No newline at end of file diff --git a/backend/directus-config/manual/sql/branding-logo.sql b/backend/directus-config/manual/sql/branding-logo.sql new file mode 100644 index 00000000..101b948c --- /dev/null +++ b/backend/directus-config/manual/sql/branding-logo.sql @@ -0,0 +1,7 @@ +DELETE FROM public.directus_files WHERE id = '412c25dc-a3b7-4114-b64b-cac2d6b46db3'; + +COPY public.directus_files (id, storage, filename_disk, filename_download, title, type, folder, uploaded_by, created_on, modified_by, modified_on, charset, filesize, width, height, duration, embed, description, location, tags, metadata, focal_point_x, focal_point_y, tus_id, tus_data, uploaded_on) FROM stdin; +412c25dc-a3b7-4114-b64b-cac2d6b46db3 local 412c25dc-a3b7-4114-b64b-cac2d6b46db3.svg utopia-logo.svg utopia-logo image/svg+xml \N \N 2025-08-12 11:26:36.539+00 \N 2025-08-12 11:27:07.646+00 \N 22906 \N \N \N \N \N \N \N \N \N \N \N \N 2025-08-12 11:26:36.555+00 +\. + +UPDATE public.directus_settings SET project_logo = '412c25dc-a3b7-4114-b64b-cac2d6b46db3';