Compare commits

..

No commits in common. '9e6e20cee2cc610df067f22350b8a6a0258a6bc2' and '0a638b053490b2a1c7cb87d20f941454781933bb' have entirely different histories.

@ -1,4 +1,4 @@
FROM postgres:17 FROM postgres:12
COPY postgres/setup.sh /docker-entrypoint-initdb.d/setup.sh COPY postgres/setup.sh /docker-entrypoint-initdb.d/setup.sh
COPY postgres/schema.sql / COPY postgres/schema.sql /
COPY postgres/buscribe.sql / COPY postgres/buscribe.sql /

@ -26,10 +26,6 @@ CREATE TYPE thumbnail_mode as ENUM (
'CUSTOM' 'CUSTOM'
); );
-- Represents an area in an image as (left, top, bottom, right)
-- or equivalently as (x1, y1, x2, y2) where x is the top-left corner and y is the bottom-right.
CREATE DOMAIN box_coords AS INTEGER[] CHECK (cardinality(VALUE) = 4 OR VALUE IS NULL);
-- The end time for an event can be unset, "--" or a timestamp. -- The end time for an event can be unset, "--" or a timestamp.
-- If dashed is true, value should be the same as start time (which may be NULL if start time is unset). -- If dashed is true, value should be the same as start time (which may be NULL if start time is unset).
-- Otherwise value is the value (which may be NULL if end time is unset). -- Otherwise value is the value (which may be NULL if end time is unset).
@ -93,8 +89,14 @@ CREATE TABLE events (
OR thumbnail_mode = 'NONE' OR thumbnail_mode = 'NONE'
OR thumbnail_last_written IS NOT NULL OR thumbnail_last_written IS NOT NULL
), ),
thumbnail_crop box_coords, -- pixel coordinates to crop the selected frame thumbnail_crop INTEGER[] CHECK (
thumbnail_location box_coords, -- pixel coordinates to position the cropped frame cardinality(thumbnail_crop) = 4
OR thumbnail_crop IS NULL
), -- left, upper, right, and lower pixel coordinates to crop the selected frame
thumbnail_location INTEGER[] CHECK (
cardinality(thumbnail_location) = 4
OR thumbnail_location IS NULL
), -- left, top, right, bottom pixel coordinates to position the cropped frame
state event_state NOT NULL DEFAULT 'UNEDITED', state event_state NOT NULL DEFAULT 'UNEDITED',
uploader TEXT CHECK (state IN ('UNEDITED', 'EDITED', 'DONE', 'MODIFIED') OR uploader IS NOT NULL), uploader TEXT CHECK (state IN ('UNEDITED', 'EDITED', 'DONE', 'MODIFIED') OR uploader IS NOT NULL),
@ -192,6 +194,6 @@ CREATE TABLE templates (
image BYTEA NOT NULL, image BYTEA NOT NULL,
description TEXT NOT NULL DEFAULT '', description TEXT NOT NULL DEFAULT '',
attribution TEXT NOT NULL DEFAULT '', attribution TEXT NOT NULL DEFAULT '',
crop box_coords NOT NULL, crop INTEGER[] NOT NULL CHECK (cardinality(crop) = 4),
location box_coords NOT NULL location INTEGER[] NOT NULL CHECK (cardinality(location) = 4)
); );

@ -1,6 +1,6 @@
#! /bin/bash #! /bin/bash
set -eu set -e
sql() { sql() {
local user local user
@ -14,10 +14,9 @@ sed -i "/host all all all/d" "$PGDATA/pg_hba.conf"
echo "host all $WUBLOADER_USER all md5" >> "$PGDATA/pg_hba.conf" echo "host all $WUBLOADER_USER all md5" >> "$PGDATA/pg_hba.conf"
echo "Creating $WUBLOADER_USER" echo "Creating $WUBLOADER_USER"
sql "$POSTGRES_USER" -d "$POSTGRES_DB" <<-EOSQL sql "$POSTGRES_USER" <<-EOSQL
CREATE USER $WUBLOADER_USER LOGIN PASSWORD '$WUBLOADER_PASSWORD'; CREATE USER $WUBLOADER_USER LOGIN PASSWORD '$WUBLOADER_PASSWORD';
GRANT CREATE ON SCHEMA public TO $WUBLOADER_USER;
EOSQL EOSQL
@ -33,7 +32,11 @@ if [ -n "$REPLICATION_USER" ]; then
EOSQL EOSQL
cat >> ${PGDATA}/postgresql.conf <<-EOF cat >> ${PGDATA}/postgresql.conf <<-EOF
wal_keep_size = 128MB wal_level = replica
archive_mode = on
archive_command = 'cd .'
max_wal_senders = 8
wal_keep_segments = 8
EOF EOF
fi fi

Loading…
Cancel
Save