fix user and group sequences in postgre

This commit is contained in:
Sebastian Hugentobler 2019-11-02 15:00:48 +01:00
parent 9da2c9381a
commit 4849cc33f4

View File

@ -1,6 +1,9 @@
#!/usr/bin/with-contenv sh #!/usr/bin/with-contenv sh
if [ "$DB_TYPE" == "postgres" ]; then if [ "$DB_TYPE" == "postgres" ]; then
# starting at 3 because the
psql --host "$DB_HOST" --port "$DB_PORT" --username "$DB_USER" --dbname "$DB_NAME" --command \ psql --host "$DB_HOST" --port "$DB_PORT" --username "$DB_USER" --dbname "$DB_NAME" --command \
"CREATE SEQUENCE IF NOT EXISTS users_id_seq AS integer START 1 OWNED BY users.id; ALTER TABLE users ALTER COLUMN id SET DEFAULT nextval('users_id_seq');" "ALTER SEQUENCE users_id_seq START WITH 3;"
sql --host "$DB_HOST" --port "$DB_PORT" --username "$DB_USER" --dbname "$DB_NAME" --command \
"ALTER SEQUENCE groups_id_seq START WITH 3;"
fi fi