This repository has been archived by the owner on Aug 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add in_progress status for recordings and prevent stream cascade dele…
…tion (#142) * Add in_progress status for recordings * Prevent stream cascade deletion
- Loading branch information
1 parent
445ae42
commit 084d03f
Showing
9 changed files
with
117 additions
and
15 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
migrations/2020-08-26-234252_add_in_progress_to_recording_status/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ALTER TABLE recording DROP CONSTRAINT recording_check; | ||
|
||
DELETE FROM recording WHERE status = 'in_progress'; | ||
ALTER TYPE recording_status RENAME TO recording_status_old; | ||
CREATE TYPE recording_status AS ENUM ('ready', 'missing'); | ||
ALTER TABLE recording ALTER COLUMN status DROP DEFAULT; | ||
ALTER TABLE recording ALTER COLUMN status TYPE recording_status USING status::text::recording_status; | ||
ALTER TABLE recording ALTER COLUMN status SET DEFAULT 'ready'; | ||
DROP TYPE recording_status_old; | ||
|
||
ALTER TABLE recording ADD CONSTRAINT recording_check CHECK ( | ||
( | ||
status = 'ready' | ||
AND started_at IS NOT NULL | ||
AND segments IS NOT NULL | ||
) OR ( | ||
status = 'missing' | ||
AND started_at IS NULL | ||
AND segments IS NULL | ||
) | ||
); |
20 changes: 20 additions & 0 deletions
20
migrations/2020-08-26-234252_add_in_progress_to_recording_status/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
ALTER TABLE recording DROP CONSTRAINT recording_check; | ||
|
||
ALTER TYPE recording_status RENAME TO recording_status_old; | ||
CREATE TYPE recording_status AS ENUM ('in_progress', 'ready', 'missing'); | ||
ALTER TABLE recording ALTER COLUMN status DROP DEFAULT; | ||
ALTER TABLE recording ALTER COLUMN status TYPE recording_status USING status::text::recording_status; | ||
ALTER TABLE recording ALTER COLUMN status SET DEFAULT 'in_progress'; | ||
DROP TYPE recording_status_old; | ||
|
||
ALTER TABLE recording ADD CONSTRAINT recording_check CHECK ( | ||
( | ||
status = 'ready' | ||
AND started_at IS NOT NULL | ||
AND segments IS NOT NULL | ||
) OR ( | ||
status IN ('in_progress', 'missing') | ||
AND started_at IS NULL | ||
AND segments IS NULL | ||
) | ||
); |
5 changes: 5 additions & 0 deletions
5
migrations/2020-08-27-001820_remove_janus_rtc_stream_backend_fk/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ALTER TABLE janus_rtc_stream | ||
ADD CONSTRAINT janus_rtc_stream_backend_id_fkey | ||
FOREIGN KEY (backend_id) | ||
REFERENCES janus_backend(id) | ||
ON DELETE CASCADE; |
2 changes: 2 additions & 0 deletions
2
migrations/2020-08-27-001820_remove_janus_rtc_stream_backend_fk/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE janus_rtc_stream | ||
DROP CONSTRAINT janus_rtc_stream_backend_id_fkey; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters