-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change json datatype to jsonb, if available.
Also update existing text columns to jsonb and json. Signed-off-by: Clemens Gruber <[email protected]>
- Loading branch information
Showing
5 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
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
8 changes: 8 additions & 0 deletions
8
lib/generators/queue_classic/templates/update_queue_classic_3_2_0.rb
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,8 @@ | ||
class UpdateQueueClassic320 < ActiveRecord::Migration | ||
def self.up | ||
QC::Setup.update_to_3_2_0 | ||
end | ||
|
||
def self.down | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
do $$ begin | ||
|
||
-- If jsonb type is available, use it for the args column | ||
if exists (select 1 from pg_type where typname = 'jsonb') then | ||
alter table queue_classic_jobs alter column args type jsonb using args::jsonb; | ||
-- Otherwise, use json type for the args column if available | ||
elsif exists (select 1 from pg_type where typname = 'json') then | ||
alter table queue_classic_jobs alter column args type json using args::json; | ||
-- Keep using text type for the args column, if neither is available | ||
else | ||
alter table queue_classic_jobs alter column args type text using args::text; | ||
end if; | ||
|
||
end $$ language plpgsql; |