sixarm_ruby_migration_helper_extensions 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/sixarm_ruby_migration_helper_extensions.rb +61 -32
- data/test/sixarm_ruby_migration_helper_extensions_test.rb +35 -8
- metadata +3 -4
- metadata.gz.sig +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: cfbd74ab297461d56b079b27be0fa2d037f2bea59ccecd664075729f1526b411
         | 
| 4 | 
            +
              data.tar.gz: 8de8ed748526fe22b40966d6fb11a2531191d8d25b439fbf481f9d1d2db9699c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7d32cf5c457b5da445714e1a2f20c123ea45b525557ae1907f7e4f0d215226b97395ff36bcbdb4216629b723bf22c313da5744cd213f393b92bd3d17253602ae
         | 
| 7 | 
            +
              data.tar.gz: fe55eefe68138ae9125413cff7c8fdbfb1cd35d0ca3931878a851e7a394961ea0d45b906fb8d86aa969f25f28b0edd863b7c793bfbbcb2c5a94dbc7730d5e6ae
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | Binary file | 
    
        data.tar.gz.sig
    CHANGED
    
    | Binary file | 
| @@ -20,21 +20,12 @@ module Ddb | |
| 20 20 | 
             
                    #
         | 
| 21 21 | 
             
                    ##
         | 
| 22 22 |  | 
| 23 | 
            -
                    ##
         | 
| 24 | 
            -
                    # Name
         | 
| 25 | 
            -
                    #
         | 
| 26 | 
            -
                    def name(column_name=:name)
         | 
| 27 | 
            -
                      column(column_name, :string)
         | 
| 28 | 
            -
                      index(column_name)
         | 
| 29 | 
            -
                    end
         | 
| 30 | 
            -
             | 
| 31 23 | 
             
                    ##
         | 
| 32 24 | 
             
                    # email: string limit is 320 because the email spec has pieces
         | 
| 33 25 | 
             
                    # that total to 320, though then trims the limit to 254.
         | 
| 34 26 | 
             
                    #
         | 
| 35 27 | 
             
                    def email(column_name=:email)
         | 
| 36 28 | 
             
                      column(column_name, :string, limit: 320)
         | 
| 37 | 
            -
                      index(column_name)
         | 
| 38 29 | 
             
                    end
         | 
| 39 30 |  | 
| 40 31 | 
             
                    ##
         | 
| @@ -43,7 +34,6 @@ module Ddb | |
| 43 34 | 
             
                    #
         | 
| 44 35 | 
             
                    def phone(column_name=:phone)
         | 
| 45 36 | 
             
                      column(column_name, :string)
         | 
| 46 | 
            -
                      index(column_name)
         | 
| 47 37 | 
             
                    end
         | 
| 48 38 |  | 
| 49 39 | 
             
                    ##
         | 
| @@ -51,7 +41,13 @@ module Ddb | |
| 51 41 | 
             
                    #
         | 
| 52 42 | 
             
                    def uri(column_name=:uri)
         | 
| 53 43 | 
             
                      column(column_name, :string)
         | 
| 54 | 
            -
             | 
| 44 | 
            +
                    end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                    ##
         | 
| 47 | 
            +
                    # hostname: POSIX standard is not to exceed 255 bytes.
         | 
| 48 | 
            +
                    #
         | 
| 49 | 
            +
                    def hostname(column_name=:hostname)
         | 
| 50 | 
            +
                      column(column_name, :string, limit: 255)
         | 
| 55 51 | 
             
                    end
         | 
| 56 52 |  | 
| 57 53 | 
             
                    ##
         | 
| @@ -72,24 +68,37 @@ module Ddb | |
| 72 68 | 
             
                    #
         | 
| 73 69 | 
             
                    ##
         | 
| 74 70 |  | 
| 75 | 
            -
                    def latitude(column_name=:latitude)     column(column_name, :decimal, precision: 13, scale: 10);  | 
| 76 | 
            -
                    def longitude(column_name=:longitude)   column(column_name, :decimal, precision: 13, scale: 10);  | 
| 77 | 
            -
                    def altitude(column_name=:altitude)     column(column_name, :decimal, precision: 13, scale: 10);  | 
| 71 | 
            +
                    def latitude(column_name=:latitude)     column(column_name, :decimal, precision: 13, scale: 10); end
         | 
| 72 | 
            +
                    def longitude(column_name=:longitude)   column(column_name, :decimal, precision: 13, scale: 10); end
         | 
| 73 | 
            +
                    def altitude(column_name=:altitude)     column(column_name, :decimal, precision: 13, scale: 10); end
         | 
| 74 | 
            +
                    def elevation(column_name=:elevation)   column(column_name, :decimal, precision: 13, scale: 10); end
         | 
| 78 75 |  | 
| 79 76 | 
             
                    def geolocation
         | 
| 80 77 | 
             
                      latitude
         | 
| 81 78 | 
             
                      longitude
         | 
| 82 79 | 
             
                      altitude
         | 
| 80 | 
            +
                      elevation
         | 
| 83 81 | 
             
                    end
         | 
| 84 82 |  | 
| 85 83 | 
             
                    ##
         | 
| 86 84 | 
             
                    #
         | 
| 87 | 
            -
                    #  | 
| 85 | 
            +
                    # Places
         | 
| 88 86 | 
             
                    #
         | 
| 89 87 | 
             
                    ##
         | 
| 90 88 |  | 
| 91 | 
            -
                     | 
| 92 | 
            -
             | 
| 89 | 
            +
                    # ISO 3166-1 alpha-2 - two-letter country codes which are also used to create the ISO 3166-2 country subdivision codes and the Internet country code top-level domains.
         | 
| 90 | 
            +
                    def iso_3166_1_alpha_2(column_name=:iso_3166_1_alpha_2)
         | 
| 91 | 
            +
                      column(column_name, :string, limit: 2)
         | 
| 92 | 
            +
                    end
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                    # ISO 3166-1 alpha-3 – three-letter country codes which may allow a better visual association between the codes and the country names than the 3166-1 alpha-2 codes.
         | 
| 95 | 
            +
                    def iso_3166_1_alpha_3(column_name=:iso_3166_1_alpha_3)
         | 
| 96 | 
            +
                      column(column_name, :string, limit: 3)
         | 
| 97 | 
            +
                    end
         | 
| 98 | 
            +
             | 
| 99 | 
            +
                    # ISO 3166-1 numeric – three-digit country codes which are identical to those developed and maintained by the United Nations Statistics Division, with the advantage of script (writing system) independence, and hence useful for people or systems using non-Latin scripts.
         | 
| 100 | 
            +
                    def iso_3166_1_numeric(column_name=:iso_3166_1_numeric)
         | 
| 101 | 
            +
                      column(column_name, :string, limit: 3)
         | 
| 93 102 | 
             
                    end
         | 
| 94 103 |  | 
| 95 104 | 
             
                    ##
         | 
| @@ -99,12 +108,27 @@ module Ddb | |
| 99 108 | 
             
                    ##
         | 
| 100 109 |  | 
| 101 110 | 
             
                    ##
         | 
| 102 | 
            -
                    #  | 
| 111 | 
            +
                    # timestamp_string: timestamp strings are good for e.g. log reports;
         | 
| 112 | 
            +
                    # our format has a max length of  "YYYY-DD-MMTHH:MM:SS.NNNNNNNNN+HH:MM".
         | 
| 113 | 
            +
                    #
         | 
| 114 | 
            +
                    def timestamp_string(column_name=:timestamp_string)
         | 
| 115 | 
            +
                      column(column_name, :string, limit: 35)
         | 
| 116 | 
            +
                    end
         | 
| 117 | 
            +
             | 
| 118 | 
            +
                    ##
         | 
| 119 | 
            +
                    # uuid_string: we sometimes like to use UUID strings;
         | 
| 103 120 | 
             
                    # for efficiency, we suggest using a database-native format.
         | 
| 104 121 | 
             
                    #
         | 
| 105 122 | 
             
                    def uuid_string(column_name=:uuid_string)
         | 
| 106 123 | 
             
                      column(column_name, :string, limit: 36)
         | 
| 107 | 
            -
             | 
| 124 | 
            +
                    end
         | 
| 125 | 
            +
             | 
| 126 | 
            +
                    ##
         | 
| 127 | 
            +
                    # zid_string: we sometimes like to use ZID strings, similar to UUID stings;
         | 
| 128 | 
            +
                    # for efficiency, we suggest using a database-native format.
         | 
| 129 | 
            +
                    #
         | 
| 130 | 
            +
                    def zid_string(column_name=:zid_string)
         | 
| 131 | 
            +
                      column(column_name, :string, limit: 36)
         | 
| 108 132 | 
             
                    end
         | 
| 109 133 |  | 
| 110 134 | 
             
                    ##
         | 
| @@ -113,25 +137,22 @@ module Ddb | |
| 113 137 | 
             
                    #
         | 
| 114 138 | 
             
                    def parent_id(column_name=:parent_id)
         | 
| 115 139 | 
             
                      column(column_name, :integer)
         | 
| 116 | 
            -
                      index(column_name)
         | 
| 117 140 | 
             
                    end
         | 
| 118 141 |  | 
| 119 142 | 
             
                    ##
         | 
| 120 | 
            -
                    # position: we sometimes like to use ordered lists, | 
| 143 | 
            +
                    # position: we sometimes like to use ordered lists,
         | 
| 121 144 | 
             
                    # where the `position` is the list position.
         | 
| 122 145 | 
             
                    #
         | 
| 123 146 | 
             
                    def position(column_name=:position)
         | 
| 124 147 | 
             
                      column(column_name, :integer)
         | 
| 125 | 
            -
                      index(column_name)
         | 
| 126 148 | 
             
                    end
         | 
| 127 149 |  | 
| 128 150 | 
             
                    ##
         | 
| 129 | 
            -
                    # state: we sometimes like to use state machines, | 
| 151 | 
            +
                    # state: we sometimes like to use state machines,
         | 
| 130 152 | 
             
                    # where the `state` is an integer enumeration.
         | 
| 131 153 | 
             
                    #
         | 
| 132 154 | 
             
                    def state(column_name=:state)
         | 
| 133 155 | 
             
                      column(column_name, :integer)
         | 
| 134 | 
            -
                      index(column_name)
         | 
| 135 156 | 
             
                    end
         | 
| 136 157 |  | 
| 137 158 | 
             
                    ##
         | 
| @@ -140,27 +161,25 @@ module Ddb | |
| 140 161 | 
             
                    #
         | 
| 141 162 | 
             
                    def lock_version(column_name=:lock_version)
         | 
| 142 163 | 
             
                      column(column_name, :integer)
         | 
| 143 | 
            -
                      index(column_name)
         | 
| 144 164 | 
             
                    end
         | 
| 145 165 |  | 
| 146 166 | 
             
                    ##
         | 
| 147 | 
            -
                    # type: Rails single table inheritance (STI) | 
| 167 | 
            +
                    # type: Rails single table inheritance (STI)
         | 
| 148 168 | 
             
                    # uses a magic field name `type`.
         | 
| 149 169 | 
             
                    #
         | 
| 150 170 | 
             
                    def type(column_name=:type)
         | 
| 151 171 | 
             
                      column(column_name, :string)
         | 
| 152 | 
            -
             | 
| 153 | 
            -
                    end  
         | 
| 172 | 
            +
                    end
         | 
| 154 173 |  | 
| 155 174 | 
             
                    ##
         | 
| 156 175 | 
             
                    # auditstamps: we like to track what's happening to a row,
         | 
| 157 176 | 
             
                    # by using typical Rails timestamps and then some more.
         | 
| 158 177 | 
             
                    #
         | 
| 159 178 | 
             
                    def auditstamps
         | 
| 160 | 
            -
                      column(:created_at, :datetime);  | 
| 161 | 
            -
                      column(:updated_at, :datetime);  | 
| 162 | 
            -
                      column(:proofed_at, :datetime);  | 
| 163 | 
            -
                      column(:retired_at, :datetime);  | 
| 179 | 
            +
                      column(:created_at, :datetime); column(:created_by, :integer);
         | 
| 180 | 
            +
                      column(:updated_at, :datetime); column(:updated_by, :integer);
         | 
| 181 | 
            +
                      column(:proofed_at, :datetime); column(:proofed_by, :integer);
         | 
| 182 | 
            +
                      column(:retired_at, :datetime); column(:retired_by, :integer);
         | 
| 164 183 | 
             
                    end
         | 
| 165 184 |  | 
| 166 185 | 
             
                    ##
         | 
| @@ -185,6 +204,16 @@ module Ddb | |
| 185 204 | 
             
                      type
         | 
| 186 205 | 
             
                    end
         | 
| 187 206 |  | 
| 207 | 
            +
                    ##
         | 
| 208 | 
            +
                    #
         | 
| 209 | 
            +
                    # Vendor
         | 
| 210 | 
            +
                    #
         | 
| 211 | 
            +
                    ##
         | 
| 212 | 
            +
             | 
| 213 | 
            +
                    def freebase(column_name=:freebase)
         | 
| 214 | 
            +
                      column(column_name, :string)
         | 
| 215 | 
            +
                    end
         | 
| 216 | 
            +
             | 
| 188 217 | 
             
                  end
         | 
| 189 218 | 
             
                end
         | 
| 190 219 | 
             
              end
         | 
| @@ -10,24 +10,36 @@ require "sixarm_ruby_active_record_migration_mock" | |
| 10 10 | 
             
            require "sixarm_ruby_migration_helper_extensions"
         | 
| 11 11 |  | 
| 12 12 | 
             
            class Testing < Minitest::Test
         | 
| 13 | 
            -
             | 
| 13 | 
            +
             | 
| 14 14 | 
             
             def test_columns
         | 
| 15 15 | 
             
              CreateFoos.up
         | 
| 16 16 | 
             
              for col in [
         | 
| 17 | 
            +
                ## Contact
         | 
| 17 18 | 
             
                :email,
         | 
| 18 | 
            -
                : | 
| 19 | 
            +
                :phone,
         | 
| 20 | 
            +
                :uri,
         | 
| 21 | 
            +
                :hostname,
         | 
| 22 | 
            +
                ## Size
         | 
| 19 23 | 
             
                :height,
         | 
| 20 24 | 
             
                :length,
         | 
| 21 25 | 
             
                :width,
         | 
| 22 26 | 
             
                :depth,
         | 
| 23 27 | 
             
                :mass,
         | 
| 28 | 
            +
                ## Geolocation
         | 
| 24 29 | 
             
                :latitude,
         | 
| 25 30 | 
             
                :longitude,
         | 
| 26 31 | 
             
                :altitude,
         | 
| 27 | 
            -
                : | 
| 28 | 
            -
                 | 
| 29 | 
            -
                : | 
| 30 | 
            -
                : | 
| 32 | 
            +
                :elevation,
         | 
| 33 | 
            +
                ## Place
         | 
| 34 | 
            +
                :iso_3166_1_alpha_2,
         | 
| 35 | 
            +
                :iso_3166_1_alpha_3,
         | 
| 36 | 
            +
                :iso_3166_1_numeric,
         | 
| 37 | 
            +
                ## Admin
         | 
| 38 | 
            +
                :timestamp_string,
         | 
| 39 | 
            +
                :uuid_string,
         | 
| 40 | 
            +
                :zid_string,
         | 
| 41 | 
            +
                ## Vendor
         | 
| 42 | 
            +
                :freebase,
         | 
| 31 43 | 
             
              ] do
         | 
| 32 44 | 
             
                assert(ActiveRecordMigrationMock.tables['foos'].has_column?(col),"has_column?(:#{col})")
         | 
| 33 45 | 
             
              end
         | 
| @@ -45,17 +57,32 @@ class CreateFoos < ActiveRecordMigrationMock | |
| 45 57 |  | 
| 46 58 | 
             
              def self.up
         | 
| 47 59 | 
             
                create_table 'foos', :force => true do |t|
         | 
| 60 | 
            +
                  ## Contact
         | 
| 61 | 
            +
                  t.name
         | 
| 48 62 | 
             
                  t.email
         | 
| 63 | 
            +
                  t.phone
         | 
| 64 | 
            +
                  t.uri
         | 
| 65 | 
            +
                  t.hostname
         | 
| 66 | 
            +
                  ## Size
         | 
| 49 67 | 
             
                  t.height
         | 
| 50 68 | 
             
                  t.length
         | 
| 51 69 | 
             
                  t.width
         | 
| 52 70 | 
             
                  t.depth
         | 
| 53 71 | 
             
                  t.mass
         | 
| 72 | 
            +
                  ## Geolocation
         | 
| 54 73 | 
             
                  t.latitude
         | 
| 55 74 | 
             
                  t.longitude
         | 
| 56 75 | 
             
                  t.altitude
         | 
| 57 | 
            -
                  t. | 
| 58 | 
            -
                   | 
| 76 | 
            +
                  t.elevation
         | 
| 77 | 
            +
                  ## Place
         | 
| 78 | 
            +
                  t.iso_3166_1_alpha_2
         | 
| 79 | 
            +
                  t.iso_3166_1_alpha_3
         | 
| 80 | 
            +
                  t.iso_3166_1_numeric
         | 
| 81 | 
            +
                  ## Admin
         | 
| 82 | 
            +
                  t.timestamp_string
         | 
| 83 | 
            +
                  t.uuid_string
         | 
| 84 | 
            +
                  t.zid_string
         | 
| 85 | 
            +
                  ## Vendor
         | 
| 59 86 | 
             
                  t.freebase
         | 
| 60 87 | 
             
                end
         | 
| 61 88 | 
             
              end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: sixarm_ruby_migration_helper_extensions
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 5.0.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - SixArm
         | 
| @@ -39,7 +39,7 @@ cert_chain: | |
| 39 39 | 
             
              tzpk/VnZXj7Ek/earx+N/Z+Wtnl2xENm5IF8SFPeI1HFa9NH47pqtxF1YKpNIEVc
         | 
| 40 40 | 
             
              2xa2BNHSePe7tys/2hbmZuyMu8X5ERmovsabSXB3a+YwtJh5c2jhA21wF7986s0q
         | 
| 41 41 | 
             
              -----END CERTIFICATE-----
         | 
| 42 | 
            -
            date:  | 
| 42 | 
            +
            date: 2019-03-30 00:00:00.000000000 Z
         | 
| 43 43 | 
             
            dependencies:
         | 
| 44 44 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 45 45 | 
             
              name: activerecord
         | 
| @@ -294,8 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 294 294 | 
             
                - !ruby/object:Gem::Version
         | 
| 295 295 | 
             
                  version: '0'
         | 
| 296 296 | 
             
            requirements: []
         | 
| 297 | 
            -
             | 
| 298 | 
            -
            rubygems_version: 2.7.7
         | 
| 297 | 
            +
            rubygems_version: 3.0.2
         | 
| 299 298 | 
             
            signing_key: 
         | 
| 300 299 | 
             
            specification_version: 4
         | 
| 301 300 | 
             
            summary: SixArm.com → Ruby → Migration helper extensions
         | 
    
        metadata.gz.sig
    CHANGED
    
    | Binary file |