class Migrate::Lang::Go
Public Class Methods
new()
click to toggle source
# File lib/migrate/lang/go.rb, line 4 def initialize @ext = "go" end
Public Instance Methods
create_migration(dir)
click to toggle source
# File lib/migrate/lang/go.rb, line 8 def create_migration(dir) File.open("#{dir}/up.#{@ext}", "w") do |f| f.puts <<-eot package main func main() { // Here goes your Go migration forward } eot end File.open("#{dir}/down.#{@ext}", "w") do |f| f.puts <<-eot package main func main() { // Here goes your Go migration backward } eot end end
exec_migration(dir, is_up)
click to toggle source
# File lib/migrate/lang/go.rb, line 30 def exec_migration(dir, is_up) script = "#{dir}/#{is_up ? "up" : "down"}.#{@ext}" Log.info("Executing #{script}...") `go run #{script}` end