file_publish="/docker-entrypoint-initdb.d/scripts/publish.psql" files=( ########################################################################## # schemas "/docker-entrypoint-initdb.d/schemas/token/token.psql" ########################################################################## # tables # token_type и owner — раньше token (на них ссылаются type_id / owner_id) "/docker-entrypoint-initdb.d/schemas/token/tables/token_type.psql" "/docker-entrypoint-initdb.d/schemas/token/tables/owner.psql" "/docker-entrypoint-initdb.d/schemas/token/tables/token.psql" ########################################################################## # functions # token_type "/docker-entrypoint-initdb.d/schemas/token/functions/token_type/token_type_select.psql" # owner "/docker-entrypoint-initdb.d/schemas/token/functions/owner/owner_select.psql" "/docker-entrypoint-initdb.d/schemas/token/functions/owner/owner_insert.psql" # token "/docker-entrypoint-initdb.d/schemas/token/functions/token/token_select.psql" "/docker-entrypoint-initdb.d/schemas/token/functions/token/token_insert.psql" "/docker-entrypoint-initdb.d/schemas/token/functions/token/token_update.psql" "/docker-entrypoint-initdb.d/schemas/token/functions/token/token_consume.psql" "/docker-entrypoint-initdb.d/schemas/token/functions/token/token_validate.psql" "/docker-entrypoint-initdb.d/schemas/token/functions/token/token_revoke.psql" "/docker-entrypoint-initdb.d/schemas/token/functions/token/token_revoke_by_owner.psql" "/docker-entrypoint-initdb.d/schemas/token/functions/token/token_delete.psql" ########################################################################## # post-deploy (seed справочников) "/docker-entrypoint-initdb.d/schemas/token/token.post-deploy.psql" ) > ${file_publish} for item in "${files[@]}"; do cat "${item}" >> "${file_publish}" && printf "\n\n\n" >> "${file_publish}" done # run publish.psql psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -f "${file_publish}"