Skip to content

Commit

Permalink
recreate created_at column to preserve ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
w3b6x9 committed Dec 21, 2021
1 parent 17996ce commit 51582c4
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ defmodule Realtime.RLS.Repo.Migrations.EnableGenericSubscriptionClaims do

execute "alter table realtime.subscription
drop constraint subscription_entity_user_id_filters_key cascade,
drop column email cascade"
drop column email cascade,
drop column created_at cascade"

execute "alter table realtime.subscription rename user_id to subscription_id"

Expand All @@ -19,7 +20,8 @@ defmodule Realtime.RLS.Repo.Migrations.EnableGenericSubscriptionClaims do

execute "alter table realtime.subscription
add column claims jsonb not null,
add column claims_role regrole not null generated always as (realtime.to_regrole(claims ->> 'role')) stored"
add column claims_role regrole not null generated always as (realtime.to_regrole(claims ->> 'role')) stored,
add column created_at timestamp not null default timezone('utc', now())"

execute "create unique index subscription_subscription_id_entity_filters_key on realtime.subscription (subscription_id, entity, filters)"

Expand Down

0 comments on commit 51582c4

Please sign in to comment.