[GH-ISSUE #52] Latest Docker version relation "snippet_files" does not exist #47

Closed
opened 2026-02-27 23:18:38 +03:00 by kerem · 3 comments
Owner

Originally created by @ils13 on GitHub (Jun 2, 2019).
Original GitHub issue: https://github.com/snibox/snibox/issues/52

Hey today I noticed my snibox was all empty, and upon further inspection I noticed the following error, in the db logs.

ERROR:  relation "snippet_files" does not exist at character 566,
STATEMENT:                SELECT a.attname, format_type(a.atttypid, a.atttypmod),,
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,,
c.collname, col_description(a.attrelid, a.attnum) AS comment,
FROM pg_attribute a,
LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum,
LEFT JOIN pg_type t ON a.atttypid = t.oid,
LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation,
WHERE a.attrelid = '"snippet_files"'::regclass,
AND a.attnum > 0 AND NOT a.attisdropped,
ORDER BY a.attnum

Docker image version of 2019-06-01 00:16:15

Originally created by @ils13 on GitHub (Jun 2, 2019). Original GitHub issue: https://github.com/snibox/snibox/issues/52 Hey today I noticed my snibox was all empty, and upon further inspection I noticed the following error, in the db logs. ``` ERROR: relation "snippet_files" does not exist at character 566, STATEMENT: SELECT a.attname, format_type(a.atttypid, a.atttypmod),, pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,, c.collname, col_description(a.attrelid, a.attnum) AS comment, FROM pg_attribute a, LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum, LEFT JOIN pg_type t ON a.atttypid = t.oid, LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation, WHERE a.attrelid = '"snippet_files"'::regclass, AND a.attnum > 0 AND NOT a.attisdropped, ORDER BY a.attnum ``` Docker image version of 2019-06-01 00:16:15
kerem closed this issue 2026-02-27 23:18:39 +03:00
Author
Owner

@vavgustov commented on GitHub (Jun 2, 2019):

hi, did you run ./bin/setup ?

<!-- gh-comment-id:498019868 --> @vavgustov commented on GitHub (Jun 2, 2019): hi, did you run `./bin/setup` ?
Author
Owner

@ils13 commented on GitHub (Jun 2, 2019):

Did run ./bin/setup now.

./bin/setup
...
== Preparing database ==
Database 'postgres' already exists
rails aborted!
ActiveRecord::ProtectedEnvironmentError: You are attempting to run a destructive action against your 'production' database.
If you are sure you want to continue, run the same command with the environment variable:
DISABLE_DATABASE_ENVIRONMENT_CHECK=1

And with the env var, it wipes out the whole database instead of upgrading it (I do have a backup)

export DISABLE_DATABASE_ENVIRONMENT_CHECK=1
./bin/setup
...
== Preparing database ==
Database 'postgres' already exists
-- enable_extension("plpgsql")
   -> 0.0235s
-- create_table("labels", {:force=>:cascade})
   -> 0.1820s
-- create_table("snippet_files", {:force=>:cascade})
   -> 0.1208s
-- create_table("snippets", {:force=>:cascade})
   -> 0.1369s
-- create_table("users", {:force=>:cascade})
   -> 0.1850s
<!-- gh-comment-id:498042484 --> @ils13 commented on GitHub (Jun 2, 2019): Did run `./bin/setup` now. ``` ./bin/setup ... == Preparing database == Database 'postgres' already exists rails aborted! ActiveRecord::ProtectedEnvironmentError: You are attempting to run a destructive action against your 'production' database. If you are sure you want to continue, run the same command with the environment variable: DISABLE_DATABASE_ENVIRONMENT_CHECK=1 ``` And with the env var, it wipes out the whole database instead of upgrading it (I do have a backup) ``` export DISABLE_DATABASE_ENVIRONMENT_CHECK=1 ./bin/setup ... == Preparing database == Database 'postgres' already exists -- enable_extension("plpgsql") -> 0.0235s -- create_table("labels", {:force=>:cascade}) -> 0.1820s -- create_table("snippet_files", {:force=>:cascade}) -> 0.1208s -- create_table("snippets", {:force=>:cascade}) -> 0.1369s -- create_table("users", {:force=>:cascade}) -> 0.1850s ```
Author
Owner

@ils13 commented on GitHub (Jun 2, 2019):

It's fixed by running ./bin/update inside the container, and it migrated the old database to the new schema, and it all works again now.

Thanks a lot for Snibox and the quick support!

<!-- gh-comment-id:498046010 --> @ils13 commented on GitHub (Jun 2, 2019): It's fixed by running `./bin/update` inside the container, and it migrated the old database to the new schema, and it all works again now. Thanks a lot for Snibox and the quick support!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/snibox#47
No description provided.