Class: Glueby::Contract::WalletAdapterGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Extended by:
Generator::MigrateGenerator::ClassMethod
Includes:
Generator::MigrateGenerator, Rails::Generators::Migration
Defined in:
lib/generators/glueby/contract/wallet_adapter_generator.rb

Constant Summary

Constants included from Generator::MigrateGenerator

Generator::MigrateGenerator::MYSQL_ADAPTERS

Instance Method Summary collapse

Methods included from Generator::MigrateGenerator::ClassMethod

next_migration_number

Methods included from Generator::MigrateGenerator

#migration_version, #mysql?, #table_options

Instance Method Details

#create_migration_fileObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/generators/glueby/contract/wallet_adapter_generator.rb', line 10

def create_migration_file
  migration_dir = File.expand_path("db/migrate")

  if self.class.migration_exists?(migration_dir, "create_wallet")
    ::Kernel.warn "Migration already exists: create_wallet"
  else
    migration_template(
      "wallet_table.rb.erb",
      "db/migrate/create_wallet.rb",
      migration_version: migration_version,
      table_options: table_options,
    )
  end
  if self.class.migration_exists?(migration_dir, "create_key")
    ::Kernel.warn "Migration already exists: create_key"
  else
    migration_template(
      "key_table.rb.erb",
      "db/migrate/create_key.rb",
      migration_version: migration_version,
      table_options: table_options,
    )
  end
  if self.class.migration_exists?(migration_dir, "create_utxo")
    ::Kernel.warn "Migration already exists: create_utxo"
  else
    migration_template(
      "utxo_table.rb.erb",
      "db/migrate/create_utxo.rb",
      migration_version: migration_version,
      table_options: table_options,
    )
  end
end