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: |
| 119 | name: anchor_id |
| 120 | type: BIGINT |
| 121 | - column: |
| 122 | name: parent_id |
| 123 | type: BIGINT |
| 124 | - column: |
| 125 | constraints: |
| 126 | nullable: false |
| 127 | name: dataspace_id |
| 128 | type: INTEGER |
| 129 | - column: |
| 130 | name: schema_node_id |
| 131 | type: INTEGER |
| 132 | tableName: fragment |
| 133 | - changeSet: |
| 134 | id: 1-5 |
| 135 | author: cps |
| 136 | changes: |
| 137 | - createTable: |
| 138 | columns: |
| 139 | - column: |
| 140 | autoIncrement: true |
| 141 | constraints: |
| 142 | nullable: false |
| 143 | primaryKey: true |
| 144 | primaryKeyName: schema_set_pkey |
| 145 | name: id |
| 146 | type: INTEGER |
| 147 | - column: |
| 148 | constraints: |
| 149 | nullable: false |
| 150 | name: name |
| 151 | type: TEXT |
| 152 | - column: |
| 153 | constraints: |
| 154 | nullable: false |
| 155 | name: dataspace_id |
| 156 | type: BIGINT |
| 157 | tableName: schema_set |
| 158 | - changeSet: |
| 159 | id: 1-6 |
| 160 | author: cps |
| 161 | changes: |
| 162 | - createTable: |
| 163 | columns: |
| 164 | - column: |
| 165 | autoIncrement: true |
| 166 | constraints: |
| 167 | nullable: false |
| 168 | primaryKey: true |
| 169 | primaryKeyName: yang_resource_pkey |
| 170 | name: id |
| 171 | type: INTEGER |
| 172 | - column: |
| 173 | constraints: |
| 174 | nullable: false |
| 175 | name: name |
| 176 | type: TEXT |
| 177 | - column: |
| 178 | constraints: |
| 179 | nullable: false |
| 180 | name: content |
| 181 | type: TEXT |
| 182 | - column: |
| 183 | constraints: |
| 184 | nullable: false |
| 185 | name: checksum |
| 186 | type: TEXT |
| 187 | tableName: yang_resource |
| 188 | - changeSet: |
| 189 | id: 1-7 |
| 190 | author: cps |
| 191 | changes: |
| 192 | - createTable: |
| 193 | columns: |
| 194 | - column: |
| 195 | autoIncrement: true |
| 196 | constraints: |
| 197 | nullable: false |
| 198 | primaryKey: true |
| 199 | primaryKeyName: dataspace_pkey |
| 200 | name: id |
| 201 | type: INTEGER |
| 202 | - column: |
| 203 | constraints: |
| 204 | nullable: false |
| 205 | name: name |
| 206 | type: TEXT |
| 207 | tableName: dataspace |
| 208 | - changeSet: |
| 209 | id: 1-8 |
| 210 | author: cps |
| 211 | changes: |
| 212 | - createTable: |
| 213 | columns: |
| 214 | - column: |
| 215 | constraints: |
| 216 | nullable: false |
| 217 | name: schema_node_identifier |
| 218 | type: TEXT |
| 219 | - column: |
| 220 | autoIncrement: true |
| 221 | constraints: |
| 222 | nullable: false |
| 223 | primaryKey: true |
| 224 | primaryKeyName: schema_node_pkey |
| 225 | name: id |
| 226 | type: INTEGER |
| 227 | tableName: schema_node |
| 228 | - changeSet: |
| 229 | id: 1-9 |
| 230 | author: cps |
| 231 | changes: |
| 232 | - createTable: |
| 233 | columns: |
| 234 | - column: |
| 235 | constraints: |
| 236 | nullable: false |
| 237 | name: schema_set_id |
| 238 | type: BIGINT |
| 239 | - column: |
| 240 | constraints: |
| 241 | nullable: false |
| 242 | name: yang_resource_id |
| 243 | type: BIGINT |
| 244 | tableName: schema_set_yang_resources |
| 245 | - changeSet: |
| 246 | id: 1-10 |
| 247 | author: cps |
| 248 | changes: |
| 249 | - createIndex: |
| 250 | columns: |
| 251 | - column: |
| 252 | name: schema_set_id |
| 253 | indexName: FKI_ANCHOR_SCHEMA_SET_ID_FK |
| 254 | tableName: anchor |
| 255 | - changeSet: |
| 256 | id: 1-11 |
| 257 | author: cps |
| 258 | changes: |
| 259 | - addUniqueConstraint: |
| 260 | columnNames: dataspace_id, name |
| 261 | constraintName: anchor_dataspace_id_name_key |
| 262 | tableName: anchor |
| 263 | - changeSet: |
| 264 | id: 1-12 |
| 265 | author: cps |
| 266 | changes: |
| 267 | - addForeignKeyConstraint: |
| 268 | baseColumnNames: anchor_id |
| 269 | baseTableName: fragment |
| 270 | constraintName: fragment_anchor_id_fkey |
| 271 | deferrable: false |
| 272 | initiallyDeferred: false |
| 273 | onDelete: NO ACTION |
| 274 | onUpdate: NO ACTION |
| 275 | referencedColumnNames: id |
| 276 | referencedTableName: anchor |
| 277 | validate: true |
| 278 | - changeSet: |
| 279 | id: 1-13 |
| 280 | author: cps |
| 281 | changes: |
| 282 | - createIndex: |
| 283 | columns: |
| 284 | - column: |
| 285 | name: from_fragment_id |
| 286 | indexName: FKI_RELATIONS_FROM_ID_FK |
| 287 | tableName: relation |
| 288 | - changeSet: |
| 289 | id: 1-14 |
| 290 | author: cps |
| 291 | changes: |
| 292 | - createIndex: |
| 293 | columns: |
| 294 | - column: |
| 295 | name: to_fragment_id |
| 296 | indexName: FKI_RELATIONS_TO_ID_FK |
| 297 | tableName: relation |
| 298 | - changeSet: |
| 299 | id: 1-15 |
| 300 | author: cps |
| 301 | changes: |
| 302 | - createIndex: |
| 303 | columns: |
| 304 | - column: |
| 305 | name: relation_type_id |
| 306 | indexName: FKI_RELATION_TYPE_ID_FK |
| 307 | tableName: relation |
| 308 | - changeSet: |
| 309 | id: 1-16 |
| 310 | author: cps |
| 311 | changes: |
| 312 | - addPrimaryKey: |
| 313 | columnNames: to_fragment_id, from_fragment_id, relation_type_id |
| 314 | constraintName: relation_pkey |
| 315 | tableName: relation |
| 316 | - changeSet: |
| 317 | id: 1-17 |
| 318 | author: cps |
| 319 | changes: |
| 320 | - createIndex: |
| 321 | columns: |
| 322 | - column: |
| 323 | name: anchor_id |
| 324 | indexName: FKI_FRAGMENT_ANCHOR_ID_FK |
| 325 | tableName: fragment |
| 326 | - changeSet: |
| 327 | id: 1-18 |
| 328 | author: cps |
| 329 | changes: |
| 330 | - createIndex: |
| 331 | columns: |
| 332 | - column: |
| 333 | name: dataspace_id |
| 334 | indexName: FKI_FRAGMENT_DATASPACE_ID_FK |
| 335 | tableName: fragment |
| 336 | - changeSet: |
| 337 | id: 1-19 |
| 338 | author: cps |
| 339 | changes: |
| 340 | - createIndex: |
| 341 | columns: |
| 342 | - column: |
| 343 | name: parent_id |
| 344 | indexName: FKI_FRAGMENT_PARENT_ID_FK |
| 345 | tableName: fragment |
| 346 | - changeSet: |
| 347 | id: 1-20 |
| 348 | author: cps |
| 349 | changes: |
| 350 | - createIndex: |
| 351 | columns: |
| 352 | - column: |
| 353 | name: schema_node_id |
| 354 | indexName: FKI_SCHEMA_NODE_ID_TO_ID |
| 355 | tableName: fragment |
| 356 | - changeSet: |
lukegleeson | 665e224 | 2023-01-11 09:45:53 +0000 | [diff] [blame] | 357 | id: 1-22 |
| 358 | author: cps |
| 359 | changes: |
| 360 | - addUniqueConstraint: |
| 361 | columnNames: dataspace_id, anchor_id, xpath |
| 362 | constraintName: fragment_dataspace_id_anchor_id_xpath_key |
| 363 | tableName: fragment |
| 364 | - changeSet: |
| 365 | id: 1-23 |
| 366 | author: cps |
| 367 | changes: |
| 368 | - addForeignKeyConstraint: |
| 369 | baseColumnNames: from_fragment_id |
| 370 | baseTableName: relation |
| 371 | constraintName: relation_from_fragment_id_fkey |
| 372 | deferrable: false |
| 373 | initiallyDeferred: false |
| 374 | onDelete: NO ACTION |
| 375 | onUpdate: NO ACTION |
| 376 | referencedColumnNames: id |
| 377 | referencedTableName: fragment |
| 378 | validate: true |
| 379 | - changeSet: |
| 380 | id: 1-24 |
| 381 | author: cps |
| 382 | changes: |
| 383 | - addForeignKeyConstraint: |
| 384 | baseColumnNames: to_fragment_id |
| 385 | baseTableName: relation |
| 386 | constraintName: relation_to_fragment_id_fkey |
| 387 | deferrable: false |
| 388 | initiallyDeferred: false |
| 389 | onDelete: NO ACTION |
| 390 | onUpdate: NO ACTION |
| 391 | referencedColumnNames: id |
| 392 | referencedTableName: fragment |
| 393 | validate: true |
| 394 | - changeSet: |
| 395 | id: 1-25 |
| 396 | author: cps |
| 397 | changes: |
| 398 | - addUniqueConstraint: |
| 399 | columnNames: name, dataspace_id |
| 400 | constraintName: schema_set_name_dataspace_id_key |
| 401 | tableName: schema_set |
| 402 | - changeSet: |
| 403 | id: 1-26 |
| 404 | author: cps |
| 405 | changes: |
| 406 | - addForeignKeyConstraint: |
| 407 | baseColumnNames: schema_set_id |
| 408 | baseTableName: schema_set_yang_resources |
| 409 | constraintName: schema_set_resource |
| 410 | deferrable: false |
| 411 | initiallyDeferred: false |
| 412 | onDelete: CASCADE |
| 413 | onUpdate: NO ACTION |
| 414 | referencedColumnNames: id |
| 415 | referencedTableName: schema_set |
| 416 | validate: true |
| 417 | - changeSet: |
| 418 | id: 1-27 |
| 419 | author: cps |
| 420 | changes: |
| 421 | - addUniqueConstraint: |
| 422 | columnNames: checksum |
| 423 | constraintName: yang_resource_checksum_key |
| 424 | tableName: yang_resource |
| 425 | - changeSet: |
| 426 | id: 1-28 |
| 427 | author: cps |
| 428 | changes: |
| 429 | - addUniqueConstraint: |
| 430 | columnNames: name |
| 431 | constraintName: UQ_NAME |
| 432 | tableName: dataspace |
| 433 | - changeSet: |
| 434 | id: 1-29 |
| 435 | author: cps |
| 436 | changes: |
| 437 | - addForeignKeyConstraint: |
| 438 | baseColumnNames: dataspace_id |
| 439 | baseTableName: fragment |
| 440 | constraintName: fragment_dataspace_id_fkey |
| 441 | deferrable: false |
| 442 | initiallyDeferred: false |
| 443 | onDelete: NO ACTION |
| 444 | onUpdate: NO ACTION |
| 445 | referencedColumnNames: id |
| 446 | referencedTableName: dataspace |
| 447 | validate: true |
| 448 | - changeSet: |
| 449 | id: 1-30 |
| 450 | author: cps |
| 451 | changes: |
| 452 | - addForeignKeyConstraint: |
| 453 | baseColumnNames: dataspace_id |
| 454 | baseTableName: schema_set |
| 455 | constraintName: schema_set_dataspace |
| 456 | deferrable: false |
| 457 | initiallyDeferred: false |
| 458 | onDelete: CASCADE |
| 459 | onUpdate: CASCADE |
| 460 | referencedColumnNames: id |
| 461 | referencedTableName: dataspace |
| 462 | validate: true |
| 463 | - changeSet: |
| 464 | id: 1-31 |
| 465 | author: cps |
| 466 | changes: |
| 467 | - createIndex: |
| 468 | columns: |
| 469 | - column: |
| 470 | name: schema_node_identifier |
| 471 | indexName: PERF_SCHEMA_NODE_SCHEMA_NODE_ID |
| 472 | tableName: schema_node |
| 473 | - changeSet: |
| 474 | id: 1-32 |
| 475 | author: cps |
| 476 | changes: |
| 477 | - addForeignKeyConstraint: |
| 478 | baseColumnNames: yang_resource_id |
| 479 | baseTableName: schema_set_yang_resources |
| 480 | constraintName: schema_set_yang_resources_yang_resource_id_fkey |
| 481 | deferrable: false |
| 482 | initiallyDeferred: false |
| 483 | onDelete: NO ACTION |
| 484 | onUpdate: NO ACTION |
| 485 | referencedColumnNames: id |
| 486 | referencedTableName: yang_resource |
| 487 | validate: true |
| 488 | - changeSet: |
| 489 | id: 1-33 |
| 490 | author: cps |
| 491 | changes: |
| 492 | - addForeignKeyConstraint: |
| 493 | baseColumnNames: dataspace_id |
| 494 | baseTableName: anchor |
| 495 | constraintName: anchor_dataspace_id_fkey |
| 496 | deferrable: false |
| 497 | initiallyDeferred: false |
| 498 | onDelete: NO ACTION |
| 499 | onUpdate: NO ACTION |
| 500 | referencedColumnNames: id |
| 501 | referencedTableName: dataspace |
| 502 | validate: true |
| 503 | - changeSet: |
| 504 | id: 1-34 |
| 505 | author: cps |
| 506 | changes: |
| 507 | - addForeignKeyConstraint: |
| 508 | baseColumnNames: schema_set_id |
| 509 | baseTableName: anchor |
| 510 | constraintName: anchor_schema_set_id_fkey |
| 511 | deferrable: false |
| 512 | initiallyDeferred: false |
| 513 | onDelete: NO ACTION |
| 514 | onUpdate: NO ACTION |
| 515 | referencedColumnNames: id |
| 516 | referencedTableName: schema_set |
| 517 | validate: true |
| 518 | - changeSet: |
| 519 | id: 1-35 |
| 520 | author: cps |
| 521 | changes: |
| 522 | - addForeignKeyConstraint: |
| 523 | baseColumnNames: relation_type_id |
| 524 | baseTableName: relation |
| 525 | constraintName: relation_relation_type_id_fkey |
| 526 | deferrable: false |
| 527 | initiallyDeferred: false |
| 528 | onDelete: NO ACTION |
| 529 | onUpdate: NO ACTION |
| 530 | referencedColumnNames: id |
| 531 | referencedTableName: relation_type |
| 532 | validate: true |
| 533 | - changeSet: |
| 534 | id: 1-36 |
| 535 | author: cps |
| 536 | changes: |
| 537 | - addForeignKeyConstraint: |
| 538 | baseColumnNames: parent_id |
| 539 | baseTableName: fragment |
| 540 | constraintName: fragment_parent_id_fkey |
| 541 | deferrable: false |
| 542 | initiallyDeferred: false |
| 543 | onDelete: NO ACTION |
| 544 | onUpdate: NO ACTION |
| 545 | referencedColumnNames: id |
| 546 | referencedTableName: fragment |
| 547 | validate: true |
| 548 | - changeSet: |
| 549 | id: 1-37 |
| 550 | author: cps |
| 551 | changes: |
| 552 | - addForeignKeyConstraint: |
| 553 | baseColumnNames: schema_node_id |
| 554 | baseTableName: fragment |
| 555 | constraintName: fragment_schema_node_id_fkey |
| 556 | deferrable: false |
| 557 | initiallyDeferred: false |
| 558 | onDelete: NO ACTION |
| 559 | onUpdate: NO ACTION |
| 560 | referencedColumnNames: id |
| 561 | referencedTableName: schema_node |
| 562 | validate: true |
| 563 | |
| 564 | |
| 565 | - changeSet: |
| 566 | id: 1-38 |
| 567 | label: add-module-name-and-revision-column |
| 568 | author: cps |
| 569 | changes: |
| 570 | - addColumn: |
| 571 | tableName: yang_resource |
| 572 | columns: |
| 573 | - column: |
| 574 | name: module_name |
| 575 | type: TEXT |
| 576 | - column: |
| 577 | name: revision |
| 578 | type: TEXT |
| 579 | |
| 580 | - changeSet: |
| 581 | id: 1-39 |
| 582 | label: update-previous-data-module-name-and-revision |
| 583 | author: cps |
| 584 | changes: |
| 585 | - sql: |
| 586 | sql: update yang_resource set module_name = 'dummy_module_name', revision = '2021-08-04' where module_name is null and revision is null |
| 587 | rollback: |
| 588 | sql: update yang_resource set module_name = null, revision = null where module_name = 'dummy_module_name' and revision = '2021-08-04' |
| 589 | |
| 590 | - changeSet: |
| 591 | author: cps |
| 592 | label: yang-resource-rename-column |
| 593 | id: 1-40 |
| 594 | changes: |
| 595 | - renameColumn: |
| 596 | tableName: yang_resource |
| 597 | columnDataType: TEXT |
| 598 | oldColumnName: name |
| 599 | newColumnName: file_name |
| 600 | rollback: |
| 601 | - sql: |
| 602 | sql: alter table yang_resource rename column file_name to name |
danielhanrahan | e2e5e53 | 2023-03-09 17:26:34 +0000 | [diff] [blame] | 603 | |
| 604 | - changeSet: |
| 605 | author: cps |
| 606 | id: 1-41 |
| 607 | changes: |
| 608 | - createIndex: |
| 609 | columns: |
| 610 | - column: |
| 611 | name: schema_set_id |
| 612 | indexName: FKI_SCHEMA_SET_YANG_RESOURCES_SCHEMA_SET_ID_FK |
| 613 | tableName: schema_set_yang_resources |
| 614 | rollback: |
| 615 | - dropIndex: |
| 616 | indexName: FKI_SCHEMA_SET_YANG_RESOURCES_SCHEMA_SET_ID_FK |
| 617 | tableName: schema_set_yang_resources |
danielhanrahan | 0d7ae4f | 2023-04-21 11:08:01 +0100 | [diff] [blame] | 618 | |
| 619 | - changeSet: |
| 620 | author: cps |
| 621 | id: 1-42 |
| 622 | changes: |
| 623 | - dropForeignKeyConstraint: |
| 624 | baseTableName: fragment |
| 625 | constraintName: fragment_parent_id_fkey |
| 626 | - addForeignKeyConstraint: |
| 627 | baseColumnNames: parent_id |
| 628 | baseTableName: fragment |
| 629 | constraintName: fragment_parent_id_fkey |
| 630 | deferrable: false |
| 631 | initiallyDeferred: false |
| 632 | onDelete: CASCADE |
| 633 | onUpdate: NO ACTION |
| 634 | referencedColumnNames: id |
| 635 | referencedTableName: fragment |
| 636 | validate: true |
| 637 | rollback: |
| 638 | - dropForeignKeyConstraint: |
| 639 | baseTableName: fragment |
| 640 | constraintName: fragment_parent_id_fkey |
| 641 | - addForeignKeyConstraint: |
| 642 | baseColumnNames: parent_id |
| 643 | baseTableName: fragment |
| 644 | constraintName: fragment_parent_id_fkey |
| 645 | deferrable: false |
| 646 | initiallyDeferred: false |
| 647 | onDelete: NO ACTION |
| 648 | onUpdate: NO ACTION |
| 649 | referencedColumnNames: id |
| 650 | referencedTableName: fragment |
| 651 | validate: true |