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

databaseChangeLog:
  - changeSet:
      id: 1-1
      author: cps
      changes:
        - createTable:
            columns:
              - column:
                  autoIncrement: true
                  constraints:
                    nullable: false
                    primaryKey: true
                    primaryKeyName: anchor_pkey
                  name: id
                  type: BIGINT
              - column:
                  name: name
                  type: TEXT
              - column:
                  name: schema_set_id
                  type: INTEGER
              - column:
                  constraints:
                    nullable: false
                  name: dataspace_id
                  type: INTEGER
            tableName: anchor
  - changeSet:
      id: 1-2
      author: cps
      changes:
        - createTable:
            columns:
              - column:
                  constraints:
                    nullable: false
                  name: from_fragment_id
                  type: BIGINT
              - column:
                  constraints:
                    nullable: false
                  name: to_fragment_id
                  type: BIGINT
              - column:
                  constraints:
                    nullable: false
                  name: relation_type_id
                  type: INTEGER
              - column:
                  constraints:
                    nullable: false
                  name: from_rel_xpath
                  type: TEXT
              - column:
                  constraints:
                    nullable: false
                  name: to_rel_xpath
                  type: TEXT
            tableName: relation
  - changeSet:
      id: 1-3
      author: cps
      changes:
        - createTable:
            columns:
              - column:
                  constraints:
                    nullable: false
                  name: relation_type
                  type: TEXT
              - column:
                  autoIncrement: true
                  constraints:
                    nullable: false
                    primaryKey: true
                    primaryKeyName: relation_type_pkey
                  name: id
                  type: INTEGER
            tableName: relation_type
  - changeSet:
      id: 1-4
      author: cps
      changes:
        - createTable:
            columns:
              - column:
                  autoIncrement: true
                  constraints:
                    nullable: false
                    primaryKey: true
                    primaryKeyName: fragment_pkey
                  name: id
                  type: BIGINT
              - column:
                  constraints:
                    nullable: false
                  name: xpath
                  type: TEXT
              - column:
                  name: attributes
                  type: JSONB
              - column:
                  name: anchor_id
                  type: BIGINT
              - column:
                  name: parent_id
                  type: BIGINT
              - column:
                  constraints:
                    nullable: false
                  name: dataspace_id
                  type: INTEGER
              - column:
                  name: schema_node_id
                  type: INTEGER
            tableName: fragment
  - changeSet:
      id: 1-5
      author: cps
      changes:
        - createTable:
            columns:
              - column:
                  autoIncrement: true
                  constraints:
                    nullable: false
                    primaryKey: true
                    primaryKeyName: schema_set_pkey
                  name: id
                  type: INTEGER
              - column:
                  constraints:
                    nullable: false
                  name: name
                  type: TEXT
              - column:
                  constraints:
                    nullable: false
                  name: dataspace_id
                  type: BIGINT
            tableName: schema_set
  - changeSet:
      id: 1-6
      author: cps
      changes:
        - createTable:
            columns:
              - column:
                  autoIncrement: true
                  constraints:
                    nullable: false
                    primaryKey: true
                    primaryKeyName: yang_resource_pkey
                  name: id
                  type: INTEGER
              - column:
                  constraints:
                    nullable: false
                  name: name
                  type: TEXT
              - column:
                  constraints:
                    nullable: false
                  name: content
                  type: TEXT
              - column:
                  constraints:
                    nullable: false
                  name: checksum
                  type: TEXT
            tableName: yang_resource
  - changeSet:
      id: 1-7
      author: cps
      changes:
        - createTable:
            columns:
              - column:
                  autoIncrement: true
                  constraints:
                    nullable: false
                    primaryKey: true
                    primaryKeyName: dataspace_pkey
                  name: id
                  type: INTEGER
              - column:
                  constraints:
                    nullable: false
                  name: name
                  type: TEXT
            tableName: dataspace
  - changeSet:
      id: 1-8
      author: cps
      changes:
        - createTable:
            columns:
              - column:
                  constraints:
                    nullable: false
                  name: schema_node_identifier
                  type: TEXT
              - column:
                  autoIncrement: true
                  constraints:
                    nullable: false
                    primaryKey: true
                    primaryKeyName: schema_node_pkey
                  name: id
                  type: INTEGER
            tableName: schema_node
  - changeSet:
      id: 1-9
      author: cps
      changes:
        - createTable:
            columns:
              - column:
                  constraints:
                    nullable: false
                  name: schema_set_id
                  type: BIGINT
              - column:
                  constraints:
                    nullable: false
                  name: yang_resource_id
                  type: BIGINT
            tableName: schema_set_yang_resources
  - changeSet:
      id: 1-10
      author: cps
      changes:
        - createIndex:
            columns:
              - column:
                  name: schema_set_id
            indexName: FKI_ANCHOR_SCHEMA_SET_ID_FK
            tableName: anchor
  - changeSet:
      id: 1-11
      author: cps
      changes:
        - addUniqueConstraint:
            columnNames: dataspace_id, name
            constraintName: anchor_dataspace_id_name_key
            tableName: anchor
  - changeSet:
      id: 1-12
      author: cps
      changes:
        - addForeignKeyConstraint:
            baseColumnNames: anchor_id
            baseTableName: fragment
            constraintName: fragment_anchor_id_fkey
            deferrable: false
            initiallyDeferred: false
            onDelete: NO ACTION
            onUpdate: NO ACTION
            referencedColumnNames: id
            referencedTableName: anchor
            validate: true
  - changeSet:
      id: 1-13
      author: cps
      changes:
        - createIndex:
            columns:
              - column:
                  name: from_fragment_id
            indexName: FKI_RELATIONS_FROM_ID_FK
            tableName: relation
  - changeSet:
      id: 1-14
      author: cps
      changes:
        - createIndex:
            columns:
              - column:
                  name: to_fragment_id
            indexName: FKI_RELATIONS_TO_ID_FK
            tableName: relation
  - changeSet:
      id: 1-15
      author: cps
      changes:
        - createIndex:
            columns:
              - column:
                  name: relation_type_id
            indexName: FKI_RELATION_TYPE_ID_FK
            tableName: relation
  - changeSet:
      id: 1-16
      author: cps
      changes:
        - addPrimaryKey:
            columnNames: to_fragment_id, from_fragment_id, relation_type_id
            constraintName: relation_pkey
            tableName: relation
  - changeSet:
      id: 1-17
      author: cps
      changes:
        - createIndex:
            columns:
              - column:
                  name: anchor_id
            indexName: FKI_FRAGMENT_ANCHOR_ID_FK
            tableName: fragment
  - changeSet:
      id: 1-18
      author: cps
      changes:
        - createIndex:
            columns:
              - column:
                  name: dataspace_id
            indexName: FKI_FRAGMENT_DATASPACE_ID_FK
            tableName: fragment
  - changeSet:
      id: 1-19
      author: cps
      changes:
        - createIndex:
            columns:
              - column:
                  name: parent_id
            indexName: FKI_FRAGMENT_PARENT_ID_FK
            tableName: fragment
  - changeSet:
      id: 1-20
      author: cps
      changes:
        - createIndex:
            columns:
              - column:
                  name: schema_node_id
            indexName: FKI_SCHEMA_NODE_ID_TO_ID
            tableName: fragment
  - changeSet:
      id: 1-21
      author: cps
      changes:
        - createIndex:
            columns:
              - column:
                  name: xpath
              - column:
                  name: dataspace_id
            indexName: UQ_FRAGMENT_XPATH
            tableName: fragment
            unique: true
  - changeSet:
      id: 1-22
      author: cps
      changes:
        - addUniqueConstraint:
            columnNames: dataspace_id, anchor_id, xpath
            constraintName: fragment_dataspace_id_anchor_id_xpath_key
            tableName: fragment
  - changeSet:
      id: 1-23
      author: cps
      changes:
        - addForeignKeyConstraint:
            baseColumnNames: from_fragment_id
            baseTableName: relation
            constraintName: relation_from_fragment_id_fkey
            deferrable: false
            initiallyDeferred: false
            onDelete: NO ACTION
            onUpdate: NO ACTION
            referencedColumnNames: id
            referencedTableName: fragment
            validate: true
  - changeSet:
      id: 1-24
      author: cps
      changes:
        - addForeignKeyConstraint:
            baseColumnNames: to_fragment_id
            baseTableName: relation
            constraintName: relation_to_fragment_id_fkey
            deferrable: false
            initiallyDeferred: false
            onDelete: NO ACTION
            onUpdate: NO ACTION
            referencedColumnNames: id
            referencedTableName: fragment
            validate: true
  - changeSet:
      id: 1-25
      author: cps
      changes:
        - addUniqueConstraint:
            columnNames: name, dataspace_id
            constraintName: schema_set_name_dataspace_id_key
            tableName: schema_set
  - changeSet:
      id: 1-26
      author: cps
      changes:
        - addForeignKeyConstraint:
            baseColumnNames: schema_set_id
            baseTableName: schema_set_yang_resources
            constraintName: schema_set_resource
            deferrable: false
            initiallyDeferred: false
            onDelete: CASCADE
            onUpdate: NO ACTION
            referencedColumnNames: id
            referencedTableName: schema_set
            validate: true
  - changeSet:
      id: 1-27
      author: cps
      changes:
        - addUniqueConstraint:
            columnNames: checksum
            constraintName: yang_resource_checksum_key
            tableName: yang_resource
  - changeSet:
      id: 1-28
      author: cps
      changes:
        - addUniqueConstraint:
            columnNames: name
            constraintName: UQ_NAME
            tableName: dataspace
  - changeSet:
      id: 1-29
      author: cps
      changes:
        - addForeignKeyConstraint:
            baseColumnNames: dataspace_id
            baseTableName: fragment
            constraintName: fragment_dataspace_id_fkey
            deferrable: false
            initiallyDeferred: false
            onDelete: NO ACTION
            onUpdate: NO ACTION
            referencedColumnNames: id
            referencedTableName: dataspace
            validate: true
  - changeSet:
      id: 1-30
      author: cps
      changes:
        - addForeignKeyConstraint:
            baseColumnNames: dataspace_id
            baseTableName: schema_set
            constraintName: schema_set_dataspace
            deferrable: false
            initiallyDeferred: false
            onDelete: CASCADE
            onUpdate: CASCADE
            referencedColumnNames: id
            referencedTableName: dataspace
            validate: true
  - changeSet:
      id: 1-31
      author: cps
      changes:
        - createIndex:
            columns:
              - column:
                  name: schema_node_identifier
            indexName: PERF_SCHEMA_NODE_SCHEMA_NODE_ID
            tableName: schema_node
  - changeSet:
      id: 1-32
      author: cps
      changes:
        - addForeignKeyConstraint:
            baseColumnNames: yang_resource_id
            baseTableName: schema_set_yang_resources
            constraintName: schema_set_yang_resources_yang_resource_id_fkey
            deferrable: false
            initiallyDeferred: false
            onDelete: NO ACTION
            onUpdate: NO ACTION
            referencedColumnNames: id
            referencedTableName: yang_resource
            validate: true
  - changeSet:
      id: 1-33
      author: cps
      changes:
        - addForeignKeyConstraint:
            baseColumnNames: dataspace_id
            baseTableName: anchor
            constraintName: anchor_dataspace_id_fkey
            deferrable: false
            initiallyDeferred: false
            onDelete: NO ACTION
            onUpdate: NO ACTION
            referencedColumnNames: id
            referencedTableName: dataspace
            validate: true
  - changeSet:
      id: 1-34
      author: cps
      changes:
        - addForeignKeyConstraint:
            baseColumnNames: schema_set_id
            baseTableName: anchor
            constraintName: anchor_schema_set_id_fkey
            deferrable: false
            initiallyDeferred: false
            onDelete: NO ACTION
            onUpdate: NO ACTION
            referencedColumnNames: id
            referencedTableName: schema_set
            validate: true
  - changeSet:
      id: 1-35
      author: cps
      changes:
        - addForeignKeyConstraint:
            baseColumnNames: relation_type_id
            baseTableName: relation
            constraintName: relation_relation_type_id_fkey
            deferrable: false
            initiallyDeferred: false
            onDelete: NO ACTION
            onUpdate: NO ACTION
            referencedColumnNames: id
            referencedTableName: relation_type
            validate: true
  - changeSet:
      id: 1-36
      author: cps
      changes:
        - addForeignKeyConstraint:
            baseColumnNames: parent_id
            baseTableName: fragment
            constraintName: fragment_parent_id_fkey
            deferrable: false
            initiallyDeferred: false
            onDelete: NO ACTION
            onUpdate: NO ACTION
            referencedColumnNames: id
            referencedTableName: fragment
            validate: true
  - changeSet:
      id: 1-37
      author: cps
      changes:
        - addForeignKeyConstraint:
            baseColumnNames: schema_node_id
            baseTableName: fragment
            constraintName: fragment_schema_node_id_fkey
            deferrable: false
            initiallyDeferred: false
            onDelete: NO ACTION
            onUpdate: NO ACTION
            referencedColumnNames: id
            referencedTableName: schema_node
            validate: true


  - changeSet:
      id: 1-38
      label: add-module-name-and-revision-column
      author: cps
      changes:
        - addColumn:
            tableName: yang_resource
            columns:
              - column:
                  name: module_name
                  type: TEXT
              - column:
                  name: revision
                  type: TEXT

  - changeSet:
      id: 1-39
      label: update-previous-data-module-name-and-revision
      author: cps
      changes:
        - sql:
            sql: update yang_resource set module_name = 'dummy_module_name', revision = '2021-08-04' where module_name is null and revision is null
      rollback:
        sql: update yang_resource set module_name = null, revision = null where module_name = 'dummy_module_name' and revision = '2021-08-04'

  - changeSet:
      author: cps
      label: yang-resource-rename-column
      id: 1-40
      changes:
        - renameColumn:
            tableName: yang_resource
            columnDataType: TEXT
            oldColumnName: name
            newColumnName: file_name
      rollback:
        - sql:
            sql: alter table yang_resource rename column file_name to name