Class: GraphQL::AnyCable::PostgreSQLStore::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/generators/graphql/anycable/postgresql_store/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/generators/graphql/anycable/postgresql_store/install_generator.rb', line 21

def self.next_migration_number(dirname)
  if defined?(ActiveRecord::Generators::Base)
    ActiveRecord::Generators::Base.next_migration_number(dirname)
  else
    Time.now.utc.strftime("%Y%m%d%H%M%S")
  end
end

Instance Method Details

#create_migrationObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/generators/graphql/anycable/postgresql_store/install_generator.rb', line 29

def create_migration
  unless respond_to?(:migration_template, true)
    say_status :skip, "ActiveRecord generators are not available", :yellow
    return
  end

  migration_template(
    "create_graphql_anycable_postgresql_store_tables.rb",
    "db/migrate/create_graphql_anycable_postgresql_store_tables.rb"
  )
end