migrations: create documentation_symbols

For golang/go#37102

Change-Id: I75fbb6393664ade2ab14f70d8df0e4503c5adea9
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/295953
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
Julie Qiu 2021-02-24 13:10:33 -05:00
Родитель c50a924c56
Коммит 7f6d05502a
2 изменённых файлов: 29 добавлений и 0 удалений

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

@ -0,0 +1,9 @@
-- 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 documentation_symbols;
END;

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

@ -0,0 +1,20 @@
-- 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;
CREATE TABLE documentation_symbols (
id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
documentation_id INTEGER NOT NULL,
package_symbol_id INTEGER NOT NULL,
UNIQUE(documentation_id, package_symbol_id),
-- TODO: add FK to documentation.id in a future migration, once the UNIQUE
-- constraint has been added.
FOREIGN KEY (package_symbol_id) REFERENCES package_symbols(id) ON DELETE CASCADE
);
COMMENT ON TABLE documentation_symbols IS
'TABLE documentation_symbols contains symbols for a given row in the documentation table.';
END;