mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Replace the unique constraint on library_item table with a unique index of userId and md5 hashed original url
This commit is contained in:
parent
6604c42bf4
commit
e950662ced
2 changed files with 20 additions and 0 deletions
10
packages/db/migrations/0127.do.replace_unique_index_on_library_item.sql
Executable file
10
packages/db/migrations/0127.do.replace_unique_index_on_library_item.sql
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
-- Type: DO
|
||||
-- Name: replace_unique_index_on_library_item
|
||||
-- Description: Create a unique index of MD5 hashed url and userId on library item table
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE omnivore.library_item DROP CONSTRAINT IF EXISTS library_item_user_id_original_url_key;
|
||||
CREATE UNIQUE INDEX library_item_user_id_hashed_original_url_key ON omnivore.library_item (user_id, md5(original_url));
|
||||
|
||||
COMMIT;
|
||||
10
packages/db/migrations/0127.undo.replace_unique_index_on_library_item.sql
Executable file
10
packages/db/migrations/0127.undo.replace_unique_index_on_library_item.sql
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
-- Type: UNDO
|
||||
-- Name: replace_unique_index_on_library_item
|
||||
-- Description: Create a unique index of MD5 hashed url and userId on library item table
|
||||
|
||||
BEGIN;
|
||||
|
||||
DROP INDEX IF EXISTS omnivore.library_item_user_id_hashed_original_url_key;
|
||||
ALTER TABLE omnivore.library_item ADD CONSTRAINT library_item_user_id_original_url_key UNIQUE (user_id, original_url);
|
||||
|
||||
COMMIT;
|
||||
Loading…
Reference in a new issue