Skip to content

Commit

Permalink
migration script from db version 8 to 9 (policy dimension)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkotronis committed Feb 24, 2019
1 parent bc61c31 commit bd3b001
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions backend/migrate/migrations/scripts/migration_9.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
DROP VIEW view_hijacks;

ALTER TABLE hijacks
ALTER COLUMN type TYPE VARCHAR ( 7 ) USING replace(
replace(
replace(
replace(
replace(
replace(type::VARCHAR ( 5 ), 'S|0|-', 'S|0|-|-'),
'S|1|-', 'S|1|-|-'),
'S|-|-', 'S|-|-|-'),
'E|0|-', 'E|0|-|-'),
'E|1|-', 'E|1|-|-'),
'Q|0|-', 'Q|0|-|-')::VARCHAR ( 7 );

CREATE OR REPLACE VIEW view_hijacks AS SELECT key, type, prefix, hijack_as, num_peers_seen, num_asns_inf, time_started, time_ended, time_last, mitigation_started, time_detected, timestamp_of_config, under_mitigation, resolved, active, ignored, configured_prefix, comment, seen, withdrawn, outdated, peers_withdrawn, peers_seen FROM hijacks;
6 changes: 6 additions & 0 deletions backend/migrate/migrations/target_steps.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
"db_version": "8",
"description": "Added indexes in table: hijacks",
"file": "migration_8.sql"
},
"9": {
"id": "9",
"db_version": "9",
"description": "Expanded hijacks type field from 5 to 7 characters to support policy dimension and migrated hijacks",
"file": "migration_9.sql"
}
}
}

0 comments on commit bd3b001

Please sign in to comment.