-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
delete all fs_updated_time once and for all
also deletes a bunch of views: drop view public_open_contracts; drop view trending_contracts; drop view listed_open_contracts; drop view contract_distance; drop view user_contract_distance; drop view public_contracts; alter table contracts drop column fs_updated_time; create or replace view public_contracts as ( select * from contracts where visibility = 'public' ); alter table answers drop column fs_updated_time; drop view private_contract_comments; alter table contract_comments drop column fs_updated_time; alter table contract_liquidity drop column fs_updated_time; -- alter table group_contracts -- drop column fs_updated_time; alter table manalinks drop column fs_updated_time; alter table old_posts drop column fs_updated_time; alter table private_users drop column fs_updated_time; alter table user_contract_metrics drop column fs_updated_time; alter table user_notifications drop column fs_updated_time;
- Loading branch information
Showing
20 changed files
with
68 additions
and
806 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
|
||
create table if not exists | ||
contract_liquidity ( | ||
contract_id text not null, | ||
liquidity_id text not null, | ||
data jsonb not null, | ||
fs_updated_time timestamp, | ||
primary key (contract_id, liquidity_id) | ||
); | ||
contract_liquidity ( | ||
contract_id text not null, | ||
liquidity_id text not null, | ||
data jsonb not null, | ||
primary key (contract_id, liquidity_id) | ||
); | ||
|
||
alter table contract_liquidity enable row level security; | ||
|
||
drop policy if exists "public read" on contract_liquidity; | ||
|
||
create policy "public read" on contract_liquidity for | ||
select | ||
using (true); | ||
select | ||
using (true); | ||
|
||
alter table contract_liquidity | ||
cluster on contract_liquidity_pkey; | ||
cluster on contract_liquidity_pkey; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
|
||
create table if not exists | ||
old_posts ( | ||
id text not null primary key default uuid_generate_v4 (), | ||
data jsonb not null, | ||
visibility text, | ||
group_id text, | ||
creator_id text, | ||
created_time timestamptz default now(), | ||
fs_updated_time timestamp | ||
); | ||
old_posts ( | ||
id text not null primary key default uuid_generate_v4 (), | ||
data jsonb not null, | ||
visibility text, | ||
group_id text, | ||
creator_id text, | ||
created_time timestamptz default now(), | ||
); | ||
|
||
alter table old_posts enable row level security; | ||
|
||
drop policy if exists "public read" on old_posts; | ||
|
||
create policy "public read" on old_posts for | ||
select | ||
using (true); | ||
select | ||
using (true); | ||
|
||
alter table old_posts | ||
cluster on posts_pkey; | ||
cluster on posts_pkey; |
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 |
---|---|---|
@@ -1,31 +1,29 @@ | ||
|
||
create table if not exists | ||
user_notifications ( | ||
user_id text not null, | ||
notification_id text not null, | ||
data jsonb not null, | ||
fs_updated_time timestamp not null, | ||
primary key (user_id, notification_id) | ||
); | ||
user_notifications ( | ||
user_id text not null, | ||
notification_id text not null, | ||
data jsonb not null, | ||
primary key (user_id, notification_id) | ||
); | ||
|
||
alter table user_notifications enable row level security; | ||
|
||
drop policy if exists "public read" on user_notifications; | ||
|
||
create policy "public read" on user_notifications for | ||
select | ||
using (true); | ||
select | ||
using (true); | ||
|
||
create index if not exists user_notifications_notification_id on user_notifications (notification_id, user_id); | ||
|
||
create index if not exists user_notifications_created_time on user_notifications (user_id, (to_jsonb(data) -> 'createdTime') desc); | ||
|
||
create index if not exists user_notifications_unseen_text_created_time_idx on user_notifications ( | ||
user_id, | ||
-- Unfortunately casting to a boolean doesn't work in postgrest ((data->'isSeen')::boolean), | ||
(data ->> 'isSeen'), | ||
((data -> 'createdTime')::bigint) desc | ||
); | ||
user_id, | ||
-- Unfortunately casting to a boolean doesn't work in postgrest ((data->'isSeen')::boolean), | ||
(data ->> 'isSeen'), | ||
((data -> 'createdTime')::bigint) desc | ||
); | ||
|
||
alter table user_notifications | ||
cluster on user_notifications_created_time_idx; | ||
cluster on user_notifications_created_time_idx; |
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
Oops, something went wrong.