migrations: change symbol_history.id to BIGINT

The symbol_history.id column is changed from an INT to a BIGINT.

Rather than change the column type, we drop the entire table since
we need to reprocess everything anyways.

For golang/go#37102

Change-Id: I8aedaf73bfd41b71005d630c011c92da1686f580
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/315709
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
Julie Qiu 2021-04-30 12:57:17 -04:00
Родитель d57a839f8b
Коммит 740e9bddf1
2 изменённых файлов: 60 добавлений и 0 удалений

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

@ -0,0 +1,30 @@
-- Copyright 2021 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;
DROP TABLE symbol_history;
CREATE TABLE symbol_history (
id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
package_path_id INTEGER NOT NULL,
module_path_id INTEGER NOT NULL,
symbol_name_id INTEGER NOT NULL,
parent_symbol_name_id INTEGER NOT NULL,
package_symbol_id INTEGER NOT NULL,
since_version TEXT NOT NULL CHECK(since_version != ''),
sort_version text NOT NULL,
goos goos NOT NULL,
goarch goarch NOT NULL,
UNIQUE( package_path_id, module_path_id, symbol_name_id, goos, goarch),
FOREIGN KEY (package_path_id) REFERENCES paths(id) ON DELETE CASCADE,
FOREIGN KEY (module_path_id) REFERENCES paths(id) ON DELETE CASCADE,
FOREIGN KEY (symbol_name_id) REFERENCES symbol_names(id) ON DELETE CASCADE,
FOREIGN KEY (parent_symbol_name_id) REFERENCES symbol_names(id) ON DELETE CASCADE,
FOREIGN KEY (package_symbol_id) REFERENCES package_symbols(id) ON DELETE CASCADE
);
END;

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

@ -0,0 +1,30 @@
-- Copyright 2021 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;
DROP TABLE symbol_history;
CREATE TABLE symbol_history (
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
package_path_id INTEGER NOT NULL,
module_path_id INTEGER NOT NULL,
symbol_name_id INTEGER NOT NULL,
parent_symbol_name_id INTEGER NOT NULL,
package_symbol_id INTEGER NOT NULL,
since_version TEXT NOT NULL CHECK(since_version != ''),
sort_version text NOT NULL,
goos goos NOT NULL,
goarch goarch NOT NULL,
UNIQUE( package_path_id, module_path_id, symbol_name_id, goos, goarch),
FOREIGN KEY (package_path_id) REFERENCES paths(id) ON DELETE CASCADE,
FOREIGN KEY (module_path_id) REFERENCES paths(id) ON DELETE CASCADE,
FOREIGN KEY (symbol_name_id) REFERENCES symbol_names(id) ON DELETE CASCADE,
FOREIGN KEY (parent_symbol_name_id) REFERENCES symbol_names(id) ON DELETE CASCADE,
FOREIGN KEY (package_symbol_id) REFERENCES package_symbols(id) ON DELETE CASCADE
);
END;