Sha256: 04bc60b7004b10299c1a76b29a61367d68f02923e11268fca1c4d414dffc658d

Contents?: true

Size: 767 Bytes

Versions: 13

Compression:

Stored size: 767 Bytes

Contents

require "rails/generators"

module Bard
  class Utf8mb4MigrationGenerator < Rails::Generators::Base
    include Rails::Generators::Migration

    source_root File.expand_path("templates", __dir__)

    def self.next_migration_number(dirname)
      next_migration_number = current_migration_number(dirname) + 1
      ActiveRecord::Migration.next_migration_number(next_migration_number)
    end

    def install_migration
      migration_template "migration.rb", "db/migrate/convert_to_utf8mb4.rb"
    end

    def specify_charset_and_collation_in_database_yml
      ["config/database.yml", "config/database.sample.yml"].each do |file|
        inject_into_file file, "  charset: utf8mb4\n", after: "  socket: /var/run/mysqld/mysqld.sock\n"
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
bard-rake-0.24.0 lib/generators/bard/utf8mb4_migration/utf8mb4_migration_generator.rb
bard-rake-0.23.1 lib/generators/bard/utf8mb4_migration/utf8mb4_migration_generator.rb
bard-rake-0.23.0 lib/generators/bard/utf8mb4_migration/utf8mb4_migration_generator.rb
bard-rake-0.22.1 lib/generators/bard/utf8mb4_migration/utf8mb4_migration_generator.rb
bard-rake-0.22.0 lib/generators/bard/utf8mb4_migration/utf8mb4_migration_generator.rb
bard-rake-0.21.0 lib/generators/bard/utf8mb4_migration/utf8mb4_migration_generator.rb
bard-rake-0.20.0 lib/generators/bard/utf8mb4_migration/utf8mb4_migration_generator.rb
bard-rake-0.19.1 lib/generators/bard/utf8mb4_migration/utf8mb4_migration_generator.rb
bard-rake-0.18.5 lib/generators/bard/utf8mb4_migration/utf8mb4_migration_generator.rb
bard-rake-0.18.4 lib/generators/bard/utf8mb4_migration/utf8mb4_migration_generator.rb
bard-rake-0.18.3 lib/generators/bard/utf8mb4_migration/utf8mb4_migration_generator.rb
bard-rake-0.18.2 lib/generators/bard/utf8mb4_migration/utf8mb4_migration_generator.rb
bard-rake-0.18.1 lib/generators/bard/utf8mb4_migration/utf8mb4_migration_generator.rb