columnsEqual checks if two columns are equal.
(engine storepb.Engine, col1, col2 *storepb.ColumnMetadata)
| 638 | |
| 639 | // columnsEqual checks if two columns are equal. |
| 640 | func columnsEqual(engine storepb.Engine, col1, col2 *storepb.ColumnMetadata) bool { |
| 641 | if col1.Type != col2.Type { |
| 642 | return false |
| 643 | } |
| 644 | if col1.Nullable != col2.Nullable { |
| 645 | return false |
| 646 | } |
| 647 | // Compare default values |
| 648 | if !defaultValuesEqual(col1, col2) { |
| 649 | return false |
| 650 | } |
| 651 | if col1.Comment != col2.Comment { |
| 652 | return false |
| 653 | } |
| 654 | // Compare character set and collation |
| 655 | if col1.CharacterSet != col2.CharacterSet { |
| 656 | return false |
| 657 | } |
| 658 | if col1.Collation != col2.Collation { |
| 659 | return false |
| 660 | } |
| 661 | // Compare on update clause |
| 662 | if col1.OnUpdate != col2.OnUpdate { |
| 663 | return false |
| 664 | } |
| 665 | // Compare Oracle specific metadata |
| 666 | if col1.DefaultOnNull != col2.DefaultOnNull { |
| 667 | return false |
| 668 | } |
| 669 | // Compare generated column metadata |
| 670 | if !generationMetadataEqual(engine, col1.Generation, col2.Generation) { |
| 671 | return false |
| 672 | } |
| 673 | // Compare identity column metadata |
| 674 | if col1.IsIdentity != col2.IsIdentity { |
| 675 | return false |
| 676 | } |
| 677 | if col1.IdentityGeneration != col2.IdentityGeneration { |
| 678 | return false |
| 679 | } |
| 680 | if col1.IdentitySeed != col2.IdentitySeed { |
| 681 | return false |
| 682 | } |
| 683 | return true |
| 684 | } |
| 685 | |
| 686 | // defaultValuesEqual compares default values. |
| 687 | func defaultValuesEqual(col1, col2 *storepb.ColumnMetadata) bool { |
no test coverage detected