Skip to content

Commit

Permalink
migrations: add migrations for module compatibility sorting
Browse files Browse the repository at this point in the history
Add the "incompatible" column to both the modules and
module_version_states tables in order to sort modules by compatibility
whenever they are being displayed or processed.

Updates golang/go#37714

Change-Id: I1f7b5dd55563b38af5c54a692b5e70512ef24c0e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/247404
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
  • Loading branch information
Miguel Acero committed Aug 10, 2020
1 parent 6ff8945 commit 7c159f5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
10 changes: 10 additions & 0 deletions migrations/000025_add_module_incomapatible_column.down.sql
@@ -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 modules DROP COLUMN incompatible;
ALTER TABLE module_version_states DROP COLUMN incompatible;

END;
23 changes: 23 additions & 0 deletions migrations/000025_add_module_incomapatible_column.up.sql
@@ -0,0 +1,23 @@
-- 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 modules ADD COLUMN incompatible boolean;
ALTER TABLE module_version_states ADD COLUMN incompatible boolean;

COMMENT ON COLUMN modules.incompatible IS
'COLUMN incompatible defines whether the the version for the given module is incompatible';
COMMENT ON COLUMN module_version_states.incompatible IS
'COLUMN incompatible defines whether the the version for the given module is incompatible';

CREATE INDEX idx_modules_incompatible on modules (incompatible);
COMMENT ON INDEX idx_modules_incompatible IS
'INDEX idx_modules_incompatible is used to sort versions if they are incompatible';

CREATE INDEX idx_module_version_states_incompatible on module_version_states (incompatible);
COMMENT ON INDEX idx_module_version_states_incompatible IS
'INDEX idx_module_version_states_incompatible is used to sort versions if they are incompatible';

END;

0 comments on commit 7c159f5

Please sign in to comment.