Skip to content

Commit 752b280

Browse files
committed
migrations: drop packages table
The packages table is no longer used and dropped. This frees up 827 GB of table space and 78 GB of indexes. For golang/go#39629 Change-Id: I149707013c3fd39122b55f79976893ca979982cb Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/265243 Trust: Julie Qiu <[email protected]> Run-TryBot: Julie Qiu <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Jamal Carvalho <[email protected]>
1 parent a3a39dd commit 752b280

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
-- Copyright 2020 The Go Authors. All rights reserved.
2+
-- Use of this source code is governed by a BSD-style
3+
-- license that can be found in the LICENSE file.
4+
5+
BEGIN;
6+
7+
CREATE TABLE packages (
8+
path text NOT NULL,
9+
module_path text NOT NULL,
10+
version text NOT NULL,
11+
commit_time timestamp with time zone NOT NULL,
12+
name text NOT NULL,
13+
synopsis text,
14+
license_types text[],
15+
license_paths text[],
16+
v1_path text NOT NULL,
17+
goos text NOT NULL,
18+
goarch text NOT NULL,
19+
redistributable boolean DEFAULT false NOT NULL,
20+
documentation text,
21+
tsv_parent_directories tsvector,
22+
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
23+
updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
24+
PRIMARY KEY (path, module_path, version),
25+
FOREIGN KEY (module_path, version) REFERENCES modules(module_path, version) ON DELETE CASCADE
26+
);
27+
COMMENT ON TABLE packages IS
28+
'TABLE packages contains packages in a specific module version.';
29+
COMMENT ON COLUMN packages.commit_time IS
30+
'commit_time is the same as verions.commit_time. It is added here so that we can reduce the number of joins in our queries.';
31+
COMMENT ON COLUMN packages.tsv_parent_directories IS
32+
'tsv_parent_directories should always be NOT NULL, but it is populated by a trigger, so it will be initially NULL on insert.';
33+
34+
CREATE INDEX idx_packages_v1_path ON packages (v1_path);
35+
COMMENT ON INDEX idx_packages_v1_path IS
36+
'INDEX idx_packages_v1_path is used to get all of the packages in a series.';
37+
38+
CREATE INDEX idx_packages_module_path_text_pattern_ops ON packages (module_path text_pattern_ops);
39+
COMMENT ON INDEX idx_packages_module_path_text_pattern_ops IS
40+
'INDEX idx_packages_module_path_text_pattern_ops is used to improve performance of LIKE statements for module_path. It is used to fetch directories matching a given module_path prefix.';
41+
42+
CREATE INDEX idx_packages_path_text_pattern_ops ON packages (path text_pattern_ops);
43+
44+
END;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- Copyright 2020 The Go Authors. All rights reserved.
2+
-- Use of this source code is governed by a BSD-style
3+
-- license that can be found in the LICENSE file.
4+
5+
BEGIN;
6+
7+
DROP TABLE packages;
8+
9+
END;

0 commit comments

Comments
 (0)