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