Sha256: aac0955f3eb125c6f36a8beab2bccf85a1fce31b696600d9bb9df11484e5e32d

Contents?: true

Size: 1.34 KB

Versions: 44

Compression:

Stored size: 1.34 KB

Contents

module Souls
  module Api
    module Generate
      class << self
        def create_migration(class_name: "user")
          pluralized_class_name = class_name.underscore.pluralize
          system("rake db:create_migration NAME=create_#{pluralized_class_name}")
        end

        def add_column(class_name: "user")
          pluralized_class_name = class_name.underscore.pluralize
          system("rake db:create_migration NAME=add_column_to_#{pluralized_class_name}")
        end

        def rename_column(class_name: "user")
          pluralized_class_name = class_name.underscore.pluralize
          system("rake db:create_migration NAME=rename_column_to_#{pluralized_class_name}")
        end

        def change_column(class_name: "user")
          pluralized_class_name = class_name.underscore.pluralize
          system("rake db:create_migration NAME=change_column_to_#{pluralized_class_name}")
        end

        def remove_column(class_name: "user")
          pluralized_class_name = class_name.underscore.pluralize
          system("rake db:create_migration NAME=remove_column_to_#{pluralized_class_name}")
        end

        def drop_table(class_name: "user")
          pluralized_class_name = class_name.underscore.pluralize
          system("rake db:create_migration NAME=drop_table_to_#{pluralized_class_name}")
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
souls-0.33.6 lib/souls/api/generate/migration.rb
souls-0.33.5 lib/souls/api/generate/migration.rb
souls-0.33.4 lib/souls/api/generate/migration.rb
souls-0.33.3 lib/souls/api/generate/migration.rb
souls-0.33.2 lib/souls/api/generate/migration.rb
souls-0.33.1 lib/souls/api/generate/migration.rb
souls-0.33.0 lib/souls/api/generate/migration.rb
souls-0.32.18 lib/souls/api/generate/migration.rb
souls-0.32.17 lib/souls/api/generate/migration.rb
souls-0.32.16 lib/souls/api/generate/migration.rb
souls-0.32.15 lib/souls/api/generate/migration.rb
souls-0.32.14 lib/souls/api/generate/migration.rb
souls-0.32.13 lib/souls/api/generate/migration.rb
souls-0.32.12 lib/souls/api/generate/migration.rb
souls-0.32.11 lib/souls/api/generate/migration.rb
souls-0.32.10 lib/souls/api/generate/migration.rb
souls-0.32.9 lib/souls/api/generate/migration.rb
souls-0.32.8 lib/souls/api/generate/migration.rb
souls-0.32.7 lib/souls/api/generate/migration.rb
souls-0.32.6 lib/souls/api/generate/migration.rb