Skip to content

Commit

Permalink
update sql script
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinBeczak committed Aug 10, 2024
1 parent aaef430 commit 93fb77e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions conf/evolutions/default/95.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ ALTER TABLE IF EXISTS users
ALTER COLUMN avatar_url SET DEFAULT '/assets/images/user_no_image.png',
ALTER COLUMN avatar_url SET NOT NULL;

-- Add a CHECK constraint to ensure avatar_url is not empty
-- Add a CHECK constraint to ensure avatar_url is a string (TEXT type)
ALTER TABLE IF EXISTS users
ADD CONSTRAINT check_avatar_url_not_empty CHECK (avatar_url <> '');
ADD CONSTRAINT check_avatar_url_is_string CHECK (pg_typeof(avatar_url) = 'text');

-- --- !Downs
-- Remove the CHECK constraint
ALTER TABLE IF EXISTS users
DROP CONSTRAINT IF EXISTS check_avatar_url_not_empty;
DROP CONSTRAINT IF EXISTS check_avatar_url_is_string;

-- Revert the avatar_url column to allow null values and remove the default value
ALTER TABLE IF EXISTS users
Expand Down

0 comments on commit 93fb77e

Please sign in to comment.