Remove duplicate migration
This commit is contained in:
@@ -1,34 +0,0 @@
|
|||||||
-- Normalize existing phone numbers to (XXX) XXX-XXXX format
|
|
||||||
|
|
||||||
-- Update users table
|
|
||||||
UPDATE users
|
|
||||||
SET phone = '(' || SUBSTRING(clean_digits, 1, 3) || ') ' || SUBSTRING(clean_digits, 4, 3) || '-' || SUBSTRING(clean_digits, 7, 4)
|
|
||||||
FROM (
|
|
||||||
SELECT id,
|
|
||||||
RIGHT(regexp_replace(phone, '\D', '', 'g'), 10) as clean_digits
|
|
||||||
FROM users
|
|
||||||
WHERE regexp_replace(phone, '\D', '', 'g') ~ '\d{10,}$'
|
|
||||||
) AS sub
|
|
||||||
WHERE users.id = sub.id;
|
|
||||||
|
|
||||||
-- Update supplier table
|
|
||||||
UPDATE supplier
|
|
||||||
SET supPhone = '(' || SUBSTRING(clean_digits, 1, 3) || ') ' || SUBSTRING(clean_digits, 4, 3) || '-' || SUBSTRING(clean_digits, 7, 4)
|
|
||||||
FROM (
|
|
||||||
SELECT supId,
|
|
||||||
RIGHT(regexp_replace(supPhone, '\D', '', 'g'), 10) as clean_digits
|
|
||||||
FROM supplier
|
|
||||||
WHERE regexp_replace(supPhone, '\D', '', 'g') ~ '\d{10,}$'
|
|
||||||
) AS sub
|
|
||||||
WHERE supplier.supId = sub.supId;
|
|
||||||
|
|
||||||
-- Update storeLocation table
|
|
||||||
UPDATE storeLocation
|
|
||||||
SET phone = '(' || SUBSTRING(clean_digits, 1, 3) || ') ' || SUBSTRING(clean_digits, 4, 3) || '-' || SUBSTRING(clean_digits, 7, 4)
|
|
||||||
FROM (
|
|
||||||
SELECT storeId,
|
|
||||||
RIGHT(regexp_replace(phone, '\D', '', 'g'), 10) as clean_digits
|
|
||||||
FROM storeLocation
|
|
||||||
WHERE regexp_replace(phone, '\D', '', 'g') ~ '\d{10,}$'
|
|
||||||
) AS sub
|
|
||||||
WHERE storeLocation.storeId = sub.storeId;
|
|
||||||
Reference in New Issue
Block a user