Revert "Removing deprecated/unused/outdated code"
[osm/RO.git] / RO / osm_ro / database_utils / migrations / up / 35_add_sfc_ingress_and_egress.sql
1 /**
2 * Licensed under the Apache License, Version 2.0 (the "License"); you may
3 * not use this file except in compliance with the License. You may obtain
4 * a copy of the License at
5 *
6 * http://www.apache.org/licenses/LICENSE-2.0
7 *
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11 * License for the specific language governing permissions and limitations
12 * under the License.
13 **/
14 --
15 -- Adding different ingress and egress ports for SFC.
16 --
17
18 ALTER TABLE sce_rsp_hops
19 DROP FOREIGN KEY FK_interfaces_rsp_hop,
20 CHANGE COLUMN interface_id ingress_interface_id VARCHAR(36) NOT NULL
21 AFTER if_order,
22 ADD CONSTRAINT FK_interfaces_rsp_hop_ingress
23 FOREIGN KEY (ingress_interface_id)
24 REFERENCES interfaces (uuid) ON UPDATE CASCADE ON DELETE CASCADE,
25 ADD COLUMN egress_interface_id VARCHAR(36) NULL DEFAULT NULL
26 AFTER ingress_interface_id;
27
28 UPDATE sce_rsp_hops
29 SET egress_interface_id = ingress_interface_id;
30
31 ALTER TABLE sce_rsp_hops
32 ALTER COLUMN egress_interface_id DROP DEFAULT;
33
34 ALTER TABLE sce_rsp_hops
35 MODIFY COLUMN egress_interface_id VARCHAR(36) NOT NULL
36 AFTER ingress_interface_id,
37 ADD CONSTRAINT FK_interfaces_rsp_hop_egress
38 FOREIGN KEY (egress_interface_id)
39 REFERENCES interfaces (uuid) ON UPDATE CASCADE ON DELETE CASCADE;
40
41 INSERT INTO schema_version (version_int, version, openmano_ver, comments, date)
42 VALUES (35, '0.35', '0.6.02', 'Adding ingress and egress ports for RSPs', '2018-12-11');