Skip to content

Commit

Permalink
provide default for enforce_first_as (#5704)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcgoodfellow authored May 6, 2024
1 parent ecb6214 commit 371a813
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion nexus/db-model/src/schema_versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::collections::BTreeMap;
///
/// This must be updated when you change the database schema. Refer to
/// schema/crdb/README.adoc in the root of this repository for details.
pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(58, 0, 0);
pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(59, 0, 0);

/// List of all past database schema versions, in *reverse* order
///
Expand All @@ -29,6 +29,7 @@ static KNOWN_VERSIONS: Lazy<Vec<KnownVersion>> = Lazy::new(|| {
// | leaving the first copy as an example for the next person.
// v
// KnownVersion::new(next_int, "unique-dirname-with-the-sql-files"),
KnownVersion::new(59, "enforce-first-as-default"),
KnownVersion::new(58, "insert-default-allowlist"),
KnownVersion::new(57, "add-allowed-source-ips"),
KnownVersion::new(56, "bgp-oxpop-features"),
Expand Down
4 changes: 2 additions & 2 deletions schema/crdb/dbinit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2637,7 +2637,7 @@ CREATE TABLE IF NOT EXISTS omicron.public.switch_port_settings_bgp_peer_config (
md5_auth_key TEXT,
multi_exit_discriminator INT8,
local_pref INT8,
enforce_first_as BOOLEAN,
enforce_first_as BOOLEAN NOT NULL DEFAULT false,
allow_import_list_active BOOLEAN NOT NULL DEFAULT false,
allow_export_list_active BOOLEAN NOT NULL DEFAULT false,
vlan_id INT4,
Expand Down Expand Up @@ -3842,7 +3842,7 @@ INSERT INTO omicron.public.db_metadata (
version,
target_version
) VALUES
(TRUE, NOW(), NOW(), '58.0.0', NULL)
(TRUE, NOW(), NOW(), '59.0.0', NULL)
ON CONFLICT DO NOTHING;

COMMIT;
1 change: 1 addition & 0 deletions schema/crdb/enforce-first-as-default/up01.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE omicron.public.switch_port_settings_bgp_peer_config ALTER COLUMN enforce_first_as SET DEFAULT false;
5 changes: 5 additions & 0 deletions schema/crdb/enforce-first-as-default/up02.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set local disallow_full_table_scans = off;

UPDATE omicron.public.switch_port_settings_bgp_peer_config
SET enforce_first_as = false
WHERE enforce_first_as IS NULL;
1 change: 1 addition & 0 deletions schema/crdb/enforce-first-as-default/up03.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE omicron.public.switch_port_settings_bgp_peer_config ALTER COLUMN enforce_first_as SET NOT NULL;

0 comments on commit 371a813

Please sign in to comment.