wikijs/rootfs/etc/cont-init.d/02-fix-postgre-schema

14 lines
545 B
Plaintext
Raw Normal View History

2019-11-02 13:41:53 +00:00
#!/usr/bin/with-contenv sh
2019-11-02 14:41:08 +00:00
FIXED_FILE=/home/wikijs/data/pgfixed
if [ "$DB_TYPE" == "postgres" ] && [ ! -f "$FIXED_FILE" ]; then
# starting at 3 because the default groups and user mess things up otherwise
2019-11-02 13:41:53 +00:00
psql --host "$DB_HOST" --port "$DB_PORT" --username "$DB_USER" --dbname "$DB_NAME" --command \
"ALTER SEQUENCE users_id_seq RESTART WITH 3;"
sql --host "$DB_HOST" --port "$DB_PORT" --username "$DB_USER" --dbname "$DB_NAME" --command \
"ALTER SEQUENCE groups_id_seq RESTART WITH 3;"
2019-11-02 14:41:08 +00:00
touch "$FIXED_FILE"
2019-11-02 13:41:53 +00:00
fi