lukegleeson | 665e224 | 2023-01-11 09:45:53 +0000 | [diff] [blame] | 1 | # ============LICENSE_START======================================================= |
| 2 | # Copyright (c) 2023 Nordix Foundation. |
| 3 | # ================================================================================ |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # ============LICENSE_END========================================================= |
| 16 | |
| 17 | databaseChangeLog: |
| 18 | - changeSet: |
| 19 | id: 1-1 |
| 20 | author: cps |
| 21 | changes: |
| 22 | - createTable: |
| 23 | columns: |
| 24 | - column: |
| 25 | autoIncrement: true |
| 26 | constraints: |
| 27 | nullable: false |
| 28 | primaryKey: true |
| 29 | primaryKeyName: anchor_pkey |
| 30 | name: id |
| 31 | type: BIGINT |
| 32 | - column: |
| 33 | name: name |
| 34 | type: TEXT |
| 35 | - column: |
| 36 | name: schema_set_id |
| 37 | type: INTEGER |
| 38 | - column: |
| 39 | constraints: |
| 40 | nullable: false |
| 41 | name: dataspace_id |
| 42 | type: INTEGER |
| 43 | tableName: anchor |
| 44 | - changeSet: |
| 45 | id: 1-2 |
| 46 | author: cps |
| 47 | changes: |
| 48 | - createTable: |
| 49 | columns: |
| 50 | - column: |
| 51 | constraints: |
| 52 | nullable: false |
| 53 | name: from_fragment_id |
| 54 | type: BIGINT |
| 55 | - column: |
| 56 | constraints: |
| 57 | nullable: false |
| 58 | name: to_fragment_id |
| 59 | type: BIGINT |
| 60 | - column: |
| 61 | constraints: |
| 62 | nullable: false |
| 63 | name: relation_type_id |
| 64 | type: INTEGER |
| 65 | - column: |
| 66 | constraints: |
| 67 | nullable: false |
| 68 | name: from_rel_xpath |
| 69 | type: TEXT |
| 70 | - column: |
| 71 | constraints: |
| 72 | nullable: false |
| 73 | name: to_rel_xpath |
| 74 | type: TEXT |
| 75 | tableName: relation |
| 76 | - changeSet: |
| 77 | id: 1-3 |
| 78 | author: cps |
| 79 | changes: |
| 80 | - createTable: |
| 81 | columns: |
| 82 | - column: |
| 83 | constraints: |
| 84 | nullable: false |
| 85 | name: relation_type |
| 86 | type: TEXT |
| 87 | - column: |
| 88 | autoIncrement: true |
| 89 | constraints: |
| 90 | nullable: false |
| 91 | primaryKey: true |
| 92 | primaryKeyName: relation_type_pkey |
| 93 | name: id |
| 94 | type: INTEGER |
| 95 | tableName: relation_type |
| 96 | - changeSet: |
| 97 | id: 1-4 |
| 98 | author: cps |
| 99 | changes: |
| 100 | - createTable: |
| 101 | columns: |
| 102 | - column: |
| 103 | autoIncrement: true |
| 104 | constraints: |
| 105 | nullable: false |
| 106 | primaryKey: true |
| 107 | primaryKeyName: fragment_pkey |
| 108 | name: id |
| 109 | type: BIGINT |
| 110 | - column: |
| 111 | constraints: |
| 112 | nullable: false |
| 113 | name: xpath |
| 114 | type: TEXT |
| 115 | - column: |
| 116 | name: attributes |
| 117 | type: JSONB |
| 118 | - column: |
danielhanrahan | b740156 | 2023-05-04 22:34:41 +0100 | [diff] [blame] | 119 | constraints: |
| 120 | nullable: false |
lukegleeson | 665e224 | 2023-01-11 09:45:53 +0000 | [diff] [blame] | 121 | name: anchor_id |
| 122 | type: BIGINT |
| 123 | - column: |
| 124 | name: parent_id |
| 125 | type: BIGINT |
| 126 | - column: |
lukegleeson | 665e224 | 2023-01-11 09:45:53 +0000 | [diff] [blame] | 127 | name: schema_node_id |
| 128 | type: INTEGER |
| 129 | tableName: fragment |
| 130 | - changeSet: |
| 131 | id: 1-5 |
| 132 | author: cps |
| 133 | changes: |
| 134 | - createTable: |
| 135 | columns: |
| 136 | - column: |
| 137 | autoIncrement: true |
| 138 | constraints: |
| 139 | nullable: false |
| 140 | primaryKey: true |
| 141 | primaryKeyName: schema_set_pkey |
| 142 | name: id |
| 143 | type: INTEGER |
| 144 | - column: |
| 145 | constraints: |
| 146 | nullable: false |
| 147 | name: name |
| 148 | type: TEXT |
| 149 | - column: |
| 150 | constraints: |
| 151 | nullable: false |
| 152 | name: dataspace_id |
ToineSiebelink | 9fde458 | 2023-05-17 16:40:44 +0100 | [diff] [blame] | 153 | type: INTEGER |
lukegleeson | 665e224 | 2023-01-11 09:45:53 +0000 | [diff] [blame] | 154 | tableName: schema_set |
| 155 | - changeSet: |
| 156 | id: 1-6 |
| 157 | author: cps |
| 158 | changes: |
| 159 | - createTable: |
| 160 | columns: |
| 161 | - column: |
| 162 | autoIncrement: true |
| 163 | constraints: |
| 164 | nullable: false |
| 165 | primaryKey: true |
| 166 | primaryKeyName: yang_resource_pkey |
| 167 | name: id |
| 168 | type: INTEGER |
| 169 | - column: |
| 170 | constraints: |
| 171 | nullable: false |
| 172 | name: name |
| 173 | type: TEXT |
| 174 | - column: |
| 175 | constraints: |
| 176 | nullable: false |
| 177 | name: content |
| 178 | type: TEXT |
| 179 | - column: |
| 180 | constraints: |
| 181 | nullable: false |
| 182 | name: checksum |
| 183 | type: TEXT |
| 184 | tableName: yang_resource |
| 185 | - changeSet: |
| 186 | id: 1-7 |
| 187 | author: cps |
| 188 | changes: |
| 189 | - createTable: |
| 190 | columns: |
| 191 | - column: |
| 192 | autoIncrement: true |
| 193 | constraints: |
| 194 | nullable: false |
| 195 | primaryKey: true |
| 196 | primaryKeyName: dataspace_pkey |
| 197 | name: id |
| 198 | type: INTEGER |
| 199 | - column: |
| 200 | constraints: |
| 201 | nullable: false |
| 202 | name: name |
| 203 | type: TEXT |
| 204 | tableName: dataspace |
| 205 | - changeSet: |
| 206 | id: 1-8 |
| 207 | author: cps |
| 208 | changes: |
| 209 | - createTable: |
| 210 | columns: |
| 211 | - column: |
| 212 | constraints: |
| 213 | nullable: false |
| 214 | name: schema_node_identifier |
| 215 | type: TEXT |
| 216 | - column: |
| 217 | autoIncrement: true |
| 218 | constraints: |
| 219 | nullable: false |
| 220 | primaryKey: true |
| 221 | primaryKeyName: schema_node_pkey |
| 222 | name: id |
| 223 | type: INTEGER |
| 224 | tableName: schema_node |
| 225 | - changeSet: |
| 226 | id: 1-9 |
| 227 | author: cps |
| 228 | changes: |
| 229 | - createTable: |
| 230 | columns: |
| 231 | - column: |
| 232 | constraints: |
| 233 | nullable: false |
| 234 | name: schema_set_id |
ToineSiebelink | 9fde458 | 2023-05-17 16:40:44 +0100 | [diff] [blame] | 235 | type: INTEGER |
lukegleeson | 665e224 | 2023-01-11 09:45:53 +0000 | [diff] [blame] | 236 | - column: |
| 237 | constraints: |
| 238 | nullable: false |
| 239 | name: yang_resource_id |
ToineSiebelink | 9fde458 | 2023-05-17 16:40:44 +0100 | [diff] [blame] | 240 | type: INTEGER |
lukegleeson | 665e224 | 2023-01-11 09:45:53 +0000 | [diff] [blame] | 241 | tableName: schema_set_yang_resources |
| 242 | - changeSet: |
| 243 | id: 1-10 |
| 244 | author: cps |
| 245 | changes: |
| 246 | - createIndex: |
| 247 | columns: |
| 248 | - column: |
| 249 | name: schema_set_id |
| 250 | indexName: FKI_ANCHOR_SCHEMA_SET_ID_FK |
| 251 | tableName: anchor |
| 252 | - changeSet: |
| 253 | id: 1-11 |
| 254 | author: cps |
| 255 | changes: |
| 256 | - addUniqueConstraint: |
| 257 | columnNames: dataspace_id, name |
| 258 | constraintName: anchor_dataspace_id_name_key |
| 259 | tableName: anchor |
| 260 | - changeSet: |
| 261 | id: 1-12 |
| 262 | author: cps |
| 263 | changes: |
| 264 | - addForeignKeyConstraint: |
| 265 | baseColumnNames: anchor_id |
| 266 | baseTableName: fragment |
| 267 | constraintName: fragment_anchor_id_fkey |
| 268 | deferrable: false |
| 269 | initiallyDeferred: false |
| 270 | onDelete: NO ACTION |
| 271 | onUpdate: NO ACTION |
| 272 | referencedColumnNames: id |
| 273 | referencedTableName: anchor |
| 274 | validate: true |
| 275 | - changeSet: |
| 276 | id: 1-13 |
| 277 | author: cps |
| 278 | changes: |
| 279 | - createIndex: |
| 280 | columns: |
| 281 | - column: |
| 282 | name: from_fragment_id |
| 283 | indexName: FKI_RELATIONS_FROM_ID_FK |
| 284 | tableName: relation |
| 285 | - changeSet: |
| 286 | id: 1-14 |
| 287 | author: cps |
| 288 | changes: |
| 289 | - createIndex: |
| 290 | columns: |
| 291 | - column: |
| 292 | name: to_fragment_id |
| 293 | indexName: FKI_RELATIONS_TO_ID_FK |
| 294 | tableName: relation |
| 295 | - changeSet: |
| 296 | id: 1-15 |
| 297 | author: cps |
| 298 | changes: |
| 299 | - createIndex: |
| 300 | columns: |
| 301 | - column: |
| 302 | name: relation_type_id |
| 303 | indexName: FKI_RELATION_TYPE_ID_FK |
| 304 | tableName: relation |
| 305 | - changeSet: |
| 306 | id: 1-16 |
| 307 | author: cps |
| 308 | changes: |
| 309 | - addPrimaryKey: |
| 310 | columnNames: to_fragment_id, from_fragment_id, relation_type_id |
| 311 | constraintName: relation_pkey |
| 312 | tableName: relation |
| 313 | - changeSet: |
| 314 | id: 1-17 |
| 315 | author: cps |
| 316 | changes: |
| 317 | - createIndex: |
| 318 | columns: |
| 319 | - column: |
| 320 | name: anchor_id |
| 321 | indexName: FKI_FRAGMENT_ANCHOR_ID_FK |
| 322 | tableName: fragment |
| 323 | - changeSet: |
lukegleeson | 665e224 | 2023-01-11 09:45:53 +0000 | [diff] [blame] | 324 | id: 1-19 |
| 325 | author: cps |
| 326 | changes: |
| 327 | - createIndex: |
| 328 | columns: |
| 329 | - column: |
| 330 | name: parent_id |
| 331 | indexName: FKI_FRAGMENT_PARENT_ID_FK |
| 332 | tableName: fragment |
| 333 | - changeSet: |
| 334 | id: 1-20 |
| 335 | author: cps |
| 336 | changes: |
| 337 | - createIndex: |
| 338 | columns: |
| 339 | - column: |
| 340 | name: schema_node_id |
| 341 | indexName: FKI_SCHEMA_NODE_ID_TO_ID |
| 342 | tableName: fragment |
| 343 | - changeSet: |
lukegleeson | 665e224 | 2023-01-11 09:45:53 +0000 | [diff] [blame] | 344 | id: 1-22 |
| 345 | author: cps |
| 346 | changes: |
| 347 | - addUniqueConstraint: |
danielhanrahan | b740156 | 2023-05-04 22:34:41 +0100 | [diff] [blame] | 348 | columnNames: anchor_id, xpath |
| 349 | constraintName: fragment_anchor_id_xpath_key |
lukegleeson | 665e224 | 2023-01-11 09:45:53 +0000 | [diff] [blame] | 350 | tableName: fragment |
| 351 | - changeSet: |
| 352 | id: 1-23 |
| 353 | author: cps |
| 354 | changes: |
| 355 | - addForeignKeyConstraint: |
| 356 | baseColumnNames: from_fragment_id |
| 357 | baseTableName: relation |
| 358 | constraintName: relation_from_fragment_id_fkey |
| 359 | deferrable: false |
| 360 | initiallyDeferred: false |
| 361 | onDelete: NO ACTION |
| 362 | onUpdate: NO ACTION |
| 363 | referencedColumnNames: id |
| 364 | referencedTableName: fragment |
| 365 | validate: true |
| 366 | - changeSet: |
| 367 | id: 1-24 |
| 368 | author: cps |
| 369 | changes: |
| 370 | - addForeignKeyConstraint: |
| 371 | baseColumnNames: to_fragment_id |
| 372 | baseTableName: relation |
| 373 | constraintName: relation_to_fragment_id_fkey |
| 374 | deferrable: false |
| 375 | initiallyDeferred: false |
| 376 | onDelete: NO ACTION |
| 377 | onUpdate: NO ACTION |
| 378 | referencedColumnNames: id |
| 379 | referencedTableName: fragment |
| 380 | validate: true |
| 381 | - changeSet: |
| 382 | id: 1-25 |
| 383 | author: cps |
| 384 | changes: |
| 385 | - addUniqueConstraint: |
| 386 | columnNames: name, dataspace_id |
| 387 | constraintName: schema_set_name_dataspace_id_key |
| 388 | tableName: schema_set |
| 389 | - changeSet: |
| 390 | id: 1-26 |
| 391 | author: cps |
| 392 | changes: |
| 393 | - addForeignKeyConstraint: |
| 394 | baseColumnNames: schema_set_id |
| 395 | baseTableName: schema_set_yang_resources |
| 396 | constraintName: schema_set_resource |
| 397 | deferrable: false |
| 398 | initiallyDeferred: false |
| 399 | onDelete: CASCADE |
| 400 | onUpdate: NO ACTION |
| 401 | referencedColumnNames: id |
| 402 | referencedTableName: schema_set |
| 403 | validate: true |
| 404 | - changeSet: |
| 405 | id: 1-27 |
| 406 | author: cps |
| 407 | changes: |
| 408 | - addUniqueConstraint: |
| 409 | columnNames: checksum |
| 410 | constraintName: yang_resource_checksum_key |
| 411 | tableName: yang_resource |
| 412 | - changeSet: |
| 413 | id: 1-28 |
| 414 | author: cps |
| 415 | changes: |
| 416 | - addUniqueConstraint: |
| 417 | columnNames: name |
| 418 | constraintName: UQ_NAME |
| 419 | tableName: dataspace |
| 420 | - changeSet: |
lukegleeson | 665e224 | 2023-01-11 09:45:53 +0000 | [diff] [blame] | 421 | id: 1-30 |
| 422 | author: cps |
| 423 | changes: |
| 424 | - addForeignKeyConstraint: |
| 425 | baseColumnNames: dataspace_id |
| 426 | baseTableName: schema_set |
| 427 | constraintName: schema_set_dataspace |
| 428 | deferrable: false |
| 429 | initiallyDeferred: false |
| 430 | onDelete: CASCADE |
| 431 | onUpdate: CASCADE |
| 432 | referencedColumnNames: id |
| 433 | referencedTableName: dataspace |
| 434 | validate: true |
| 435 | - changeSet: |
| 436 | id: 1-31 |
| 437 | author: cps |
| 438 | changes: |
| 439 | - createIndex: |
| 440 | columns: |
| 441 | - column: |
| 442 | name: schema_node_identifier |
| 443 | indexName: PERF_SCHEMA_NODE_SCHEMA_NODE_ID |
| 444 | tableName: schema_node |
| 445 | - changeSet: |
| 446 | id: 1-32 |
| 447 | author: cps |
| 448 | changes: |
| 449 | - addForeignKeyConstraint: |
| 450 | baseColumnNames: yang_resource_id |
| 451 | baseTableName: schema_set_yang_resources |
| 452 | constraintName: schema_set_yang_resources_yang_resource_id_fkey |
| 453 | deferrable: false |
| 454 | initiallyDeferred: false |
| 455 | onDelete: NO ACTION |
| 456 | onUpdate: NO ACTION |
| 457 | referencedColumnNames: id |
| 458 | referencedTableName: yang_resource |
| 459 | validate: true |
| 460 | - changeSet: |
| 461 | id: 1-33 |
| 462 | author: cps |
| 463 | changes: |
| 464 | - addForeignKeyConstraint: |
| 465 | baseColumnNames: dataspace_id |
| 466 | baseTableName: anchor |
| 467 | constraintName: anchor_dataspace_id_fkey |
| 468 | deferrable: false |
| 469 | initiallyDeferred: false |
| 470 | onDelete: NO ACTION |
| 471 | onUpdate: NO ACTION |
| 472 | referencedColumnNames: id |
| 473 | referencedTableName: dataspace |
| 474 | validate: true |
| 475 | - changeSet: |
| 476 | id: 1-34 |
| 477 | author: cps |
| 478 | changes: |
| 479 | - addForeignKeyConstraint: |
| 480 | baseColumnNames: schema_set_id |
| 481 | baseTableName: anchor |
| 482 | constraintName: anchor_schema_set_id_fkey |
| 483 | deferrable: false |
| 484 | initiallyDeferred: false |
| 485 | onDelete: NO ACTION |
| 486 | onUpdate: NO ACTION |
| 487 | referencedColumnNames: id |
| 488 | referencedTableName: schema_set |
| 489 | validate: true |
| 490 | - changeSet: |
| 491 | id: 1-35 |
| 492 | author: cps |
| 493 | changes: |
| 494 | - addForeignKeyConstraint: |
| 495 | baseColumnNames: relation_type_id |
| 496 | baseTableName: relation |
| 497 | constraintName: relation_relation_type_id_fkey |
| 498 | deferrable: false |
| 499 | initiallyDeferred: false |
| 500 | onDelete: NO ACTION |
| 501 | onUpdate: NO ACTION |
| 502 | referencedColumnNames: id |
| 503 | referencedTableName: relation_type |
| 504 | validate: true |
| 505 | - changeSet: |
| 506 | id: 1-36 |
| 507 | author: cps |
| 508 | changes: |
| 509 | - addForeignKeyConstraint: |
| 510 | baseColumnNames: parent_id |
| 511 | baseTableName: fragment |
| 512 | constraintName: fragment_parent_id_fkey |
| 513 | deferrable: false |
| 514 | initiallyDeferred: false |
| 515 | onDelete: NO ACTION |
| 516 | onUpdate: NO ACTION |
| 517 | referencedColumnNames: id |
| 518 | referencedTableName: fragment |
| 519 | validate: true |
| 520 | - changeSet: |
| 521 | id: 1-37 |
| 522 | author: cps |
| 523 | changes: |
| 524 | - addForeignKeyConstraint: |
| 525 | baseColumnNames: schema_node_id |
| 526 | baseTableName: fragment |
| 527 | constraintName: fragment_schema_node_id_fkey |
| 528 | deferrable: false |
| 529 | initiallyDeferred: false |
| 530 | onDelete: NO ACTION |
| 531 | onUpdate: NO ACTION |
| 532 | referencedColumnNames: id |
| 533 | referencedTableName: schema_node |
| 534 | validate: true |
| 535 | |
| 536 | |
| 537 | - changeSet: |
| 538 | id: 1-38 |
| 539 | label: add-module-name-and-revision-column |
| 540 | author: cps |
| 541 | changes: |
| 542 | - addColumn: |
| 543 | tableName: yang_resource |
| 544 | columns: |
| 545 | - column: |
| 546 | name: module_name |
| 547 | type: TEXT |
| 548 | - column: |
| 549 | name: revision |
| 550 | type: TEXT |
| 551 | |
| 552 | - changeSet: |
| 553 | id: 1-39 |
| 554 | label: update-previous-data-module-name-and-revision |
| 555 | author: cps |
| 556 | changes: |
| 557 | - sql: |
| 558 | sql: update yang_resource set module_name = 'dummy_module_name', revision = '2021-08-04' where module_name is null and revision is null |
| 559 | rollback: |
| 560 | sql: update yang_resource set module_name = null, revision = null where module_name = 'dummy_module_name' and revision = '2021-08-04' |
| 561 | |
| 562 | - changeSet: |
| 563 | author: cps |
| 564 | label: yang-resource-rename-column |
| 565 | id: 1-40 |
| 566 | changes: |
| 567 | - renameColumn: |
| 568 | tableName: yang_resource |
| 569 | columnDataType: TEXT |
| 570 | oldColumnName: name |
| 571 | newColumnName: file_name |
| 572 | rollback: |
| 573 | - sql: |
| 574 | sql: alter table yang_resource rename column file_name to name |
danielhanrahan | e2e5e53 | 2023-03-09 17:26:34 +0000 | [diff] [blame] | 575 | |
| 576 | - changeSet: |
| 577 | author: cps |
| 578 | id: 1-41 |
| 579 | changes: |
| 580 | - createIndex: |
| 581 | columns: |
| 582 | - column: |
| 583 | name: schema_set_id |
| 584 | indexName: FKI_SCHEMA_SET_YANG_RESOURCES_SCHEMA_SET_ID_FK |
| 585 | tableName: schema_set_yang_resources |
| 586 | rollback: |
| 587 | - dropIndex: |
| 588 | indexName: FKI_SCHEMA_SET_YANG_RESOURCES_SCHEMA_SET_ID_FK |
| 589 | tableName: schema_set_yang_resources |
danielhanrahan | 0d7ae4f | 2023-04-21 11:08:01 +0100 | [diff] [blame] | 590 | |
| 591 | - changeSet: |
| 592 | author: cps |
| 593 | id: 1-42 |
| 594 | changes: |
| 595 | - dropForeignKeyConstraint: |
| 596 | baseTableName: fragment |
| 597 | constraintName: fragment_parent_id_fkey |
| 598 | - addForeignKeyConstraint: |
| 599 | baseColumnNames: parent_id |
| 600 | baseTableName: fragment |
| 601 | constraintName: fragment_parent_id_fkey |
| 602 | deferrable: false |
| 603 | initiallyDeferred: false |
| 604 | onDelete: CASCADE |
| 605 | onUpdate: NO ACTION |
| 606 | referencedColumnNames: id |
| 607 | referencedTableName: fragment |
| 608 | validate: true |
| 609 | rollback: |
| 610 | - dropForeignKeyConstraint: |
| 611 | baseTableName: fragment |
| 612 | constraintName: fragment_parent_id_fkey |
| 613 | - addForeignKeyConstraint: |
| 614 | baseColumnNames: parent_id |
| 615 | baseTableName: fragment |
| 616 | constraintName: fragment_parent_id_fkey |
| 617 | deferrable: false |
| 618 | initiallyDeferred: false |
| 619 | onDelete: NO ACTION |
| 620 | onUpdate: NO ACTION |
| 621 | referencedColumnNames: id |
| 622 | referencedTableName: fragment |
| 623 | validate: true |