1
Fork 0

Make sure path hash is added consistently

The path_hash attribute is added after the path attribute,
to make it consistent with `002_photo.up.sql`
This commit is contained in:
viktorstrate 2020-06-30 15:53:29 +02:00
parent f2bcdf883f
commit b4bdd522dc
1 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ IF NOT EXISTS( SELECT *
ALTER TABLE photo DROP INDEX path;
-- Add path_hash and set it to the md5 hash based of the path attribute
ALTER TABLE photo ADD path_hash varchar(32);
ALTER TABLE photo ADD path_hash varchar(32) AFTER path;
UPDATE photo p SET path_hash = md5(p.path);
ALTER TABLE photo MODIFY path_hash varchar(32) NOT NULL UNIQUE;
@ -31,7 +31,7 @@ IF NOT EXISTS( SELECT *
ALTER TABLE album DROP INDEX path;
-- Add path_hash and set it to the md5 hash based of the path attribute
ALTER TABLE album ADD path_hash varchar(32);
ALTER TABLE album ADD path_hash varchar(32) AFTER path;
UPDATE album a SET path_hash = md5(a.path);
ALTER TABLE album MODIFY path_hash varchar(32) NOT NULL UNIQUE;