Commit Graph

44 Commits (08ac1a1da73a8aca02f5a9407b055bd8272da006)

Author SHA1 Message Date
Tony Finn cdc007c83c
Specify the public schema for public videos
Unlike the other migrations, this one uses a bare table name to specify the table. This means it looks in the default search path. Unfortunately, the out of box search path is:

1. Schema with the same name as the user
2. Public

Because of this, if a schema exists with the same name as the DB user, the playlist_videos table will get created in _that_ schema, rather than the public schema, and then the grant statement will fail with an error like below if check_table is enabled as it keeps trying to create the table but failing on the grant statement:

```
2022-01-22 02:27:42 UTC [info] check_table: check_table: CREATE TABLE playlist_videos
Unhandled exception: relation "public.playlist_videos" does not exist (PQ::PQError)
  from /usr/share/crystal/src/primitives.cr:266:3 in 'handle_error'
  from lib/pg/src/pq/connection.cr:184:9 in 'handle_async_frames'
  from lib/pg/src/pq/connection.cr:162:7 in 'read'
  from lib/pg/src/pq/query.cr:53:14 in 'exec_all'
  from lib/db/src/db/database.cr:126:9 in '__crystal_main'
  from /usr/share/crystal/src/crystal/main.cr:110:5 in 'main'
  from src/env/__libc_start_main.c:94:2 in 'libc_start_main_stage2'
2022-01-22 02:27:43 UTC [info] check_table: check_table: CREATE TABLE playlist_videos
Unhandled exception: relation "public.playlist_videos" does not exist (PQ::PQError)
  from /usr/share/crystal/src/primitives.cr:266:3 in 'handle_error'
  from lib/pg/src/pq/connection.cr:184:9 in 'handle_async_frames'
  from lib/pg/src/pq/connection.cr:162:7 in 'read'
  from lib/pg/src/pq/query.cr:53:14 in 'exec_all'
  from lib/db/src/db/database.cr:126:9 in '__crystal_main'
  from /usr/share/crystal/src/crystal/main.cr:110:5 in 'main'
  from src/env/__libc_start_main.c:94:2 in 'libc_start_main_stage2'
```
3 years ago
Émilien Devos 7b9f5d74dc Create videos caching table as UNLOGGED 3 years ago
Andre Borie ffa9e5dfab Make migrations (mostly) idempotent. 4 years ago
Omar Roth 1eca969cf6
Add support for polymer redesign 4 years ago
Omar Roth 61150c74d2
Move privacy type into playlists.sql 5 years ago
Omar Roth be055d9dcb
Add support for custom playlists 5 years ago
Omar Roth 18d66ddded
Add 'needs_update' column for scheduling feed refresh 6 years ago
Omar Roth 64464f23ae
Add 'views' to channel_videos 6 years ago
Omar Roth 42dd6326d5 Remove unnecessary index 6 years ago
Omar Roth 3bcb98e644 Add config option to cache annotations from IA 6 years ago
Omar Roth fd26f9f34e Add support for premieres to search and feed 6 years ago
Omar Roth 7425700009 Update pubsub to support lease_seconds 6 years ago
Omar Roth 52cad8d6da Update change index for channel_videos and add index for nonces 6 years ago
Omar Roth ff563a70a5 Fix typo in session_ids 6 years ago
Omar Roth a384f6e5fd Add migrate script and update README 6 years ago
Omar Roth 3646395f1d Store session_ids in separate table 6 years ago
Omar Roth 30e6d29106 Add 'deleted' to channel info 6 years ago
Omar Roth a242390fc1 Fix typo in nonces.sql 6 years ago
Omar Roth ad20d6359b Add 'expire' to filter invalid tokens 6 years ago
Omar Roth d185ba84bf Remember nonce to prevent replay attacks 6 years ago
Omar Roth 19632511d5 Update SQL 6 years ago
Omar Roth c55c553725 Fix channel_videos schema 6 years ago
Omar Roth 8794e26e67 Add length_seconds to channel_videos 6 years ago
Omar Roth f88697541c Add author_thumbnail to '/api/v1/videos' 6 years ago
Omar Roth 1a39faee75 Add subCountText and add XHR alternative for subscribing to channels 6 years ago
Omar Roth 51d00b16c3 Use hash instead of btree for channel_videos_ucid_idx 6 years ago
Omar Roth 5b2c228bb6 Add 'license' 6 years ago
Omar Roth 40028e1462 Update SQL and remove migration points 6 years ago
Omar Roth 74cf3d18d0 Remove ID constrant for users 6 years ago
Omar Roth 8adb4650a0 Add support for multiple sessions 6 years ago
Omar Roth b5c92c1a2f Add watch history 6 years ago
Omar Roth b13b91e2bf Add ucid index for channel_videos 6 years ago
Omar Roth 09a9364427 Update videos SQL 6 years ago
Omar Roth 99ff27dae3 Update users.sql 6 years ago
Omar Roth d29ea79a5d Add separate user accounts 6 years ago
Omar Roth c928a938f9 Fix typo in users.sql 6 years ago
Omar Roth 96c520b02b Add user preferences 6 years ago
Omar Roth a2e23f7022 Move author and ucid into schema 7 years ago
Omar Roth 57102c54c7 Add notifications 7 years ago
Omar Roth ffdf2ea4c5 Add email to user table 7 years ago
Omar Roth 0aa8ad9a7c Make user id unique 7 years ago
Omar Roth 6c4cfbe39d Add users table 7 years ago
Omar Roth 239a6c892c Use seperate table for videos pulled from RSS 7 years ago
Omar Roth 908543dd62 Add channel sql 7 years ago