migrations: change licenses PK to (module_id, file_path)

The primary key for licenses is changed to (module_id, file_path).

The licenses.module_path and licenses.version columns will be dropped in
a future CL.

For golang/go#39629

Change-Id: I3ae8f7c582013a897152bdf5926f6a9287136c5e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/265019
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Julie Qiu 2020-10-26 10:33:25 -04:00
Родитель 807ebaef54
Коммит bda006f319
2 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,11 @@
-- Copyright 2020 The Go Authors. All rights reserved.
-- Use of this source code is governed by a BSD-style
-- license that can be found in the LICENSE file.
BEGIN;
CREATE INDEX idx_licenses_module_id ON licenses (module_id);
ALTER TABLE licenses DROP CONSTRAINT licenses_pkey;
ALTER TABLE licenses ADD PRIMARY KEY (module_path, version, file_path);
END;

Просмотреть файл

@ -0,0 +1,11 @@
-- Copyright 2020 The Go Authors. All rights reserved.
-- Use of this source code is governed by a BSD-style
-- license that can be found in the LICENSE file.
BEGIN;
ALTER TABLE licenses DROP CONSTRAINT licenses_pkey;
ALTER TABLE licenses ADD PRIMARY KEY (module_id, file_path);
DROP INDEX idx_licenses_module_id;
END;