зеркало из https://github.com/golang/pkgsite.git
migrations: add paths table and units.path_id
A paths table is added, which contains the path string for every path in the units table. This table is added to replace units.path in order to reduce the index size on that column and improve performance. For golang/go#39629 Change-Id: I9d173bbb8a1680176f1807d8d3561cd6906afaf3 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/267437 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
Родитель
81780f2de9
Коммит
8ac0e15af5
|
@ -0,0 +1,10 @@
|
|||
-- 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 units DROP COLUMN path_id;
|
||||
DROP TABLE paths;
|
||||
|
||||
END;
|
|
@ -0,0 +1,16 @@
|
|||
-- 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 TABLE paths (
|
||||
id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
path TEXT NOT NULL
|
||||
);
|
||||
COMMENT ON TABLE paths IS
|
||||
'TABLE paths contains the path string for every path in the units table.';
|
||||
|
||||
ALTER TABLE units ADD COLUMN path_id INTEGER;
|
||||
|
||||
END;
|
Загрузка…
Ссылка в новой задаче