Add unique key on server_alias.alias #59
|
@ -33,7 +33,9 @@ class Server extends \Friendica\Directory\Model
|
||||||
SET `server_id` = :server_id,
|
SET `server_id` = :server_id,
|
||||||
`alias` = :alias,
|
`alias` = :alias,
|
||||||
`timestamp` = NOW()
|
`timestamp` = NOW()
|
||||||
ON DUPLICATE KEY UPDATE `timestamp` = NOW()',
|
ON DUPLICATE KEY UPDATE
|
||||||
|
`server_id` = :server_id,
|
||||||
|
`timestamp` = NOW()',
|
||||||
[
|
[
|
||||||
'server_id' => $server_id,
|
'server_id' => $server_id,
|
||||||
'alias' => strtolower($server_alias)
|
'alias' => strtolower($server_alias)
|
||||||
|
|
0
src/sql/migrations/down/0006.sql
Normal file
0
src/sql/migrations/down/0006.sql
Normal file
6
src/sql/migrations/up/0007.sql
Normal file
6
src/sql/migrations/up/0007.sql
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
BEGIN;
|
||||||
|
CREATE TABLE temp_server_alias AS SELECT * FROM server_alias GROUP BY alias;
|
||||||
|
DROP TABLE server_alias;
|
||||||
|
RENAME TABLE temp_server_alias TO server_alias;
|
||||||
|
CREATE UNIQUE INDEX server_alias_alias_uindex ON server_alias (alias);
|
||||||
|
COMMIT;
|
Loading…
Reference in a new issue