Deleting create_db script, as it is obsolete

This commit is contained in:
Alexey Verkhovsky 2006-03-19 20:08:50 +00:00
parent 6f0434bf83
commit da24698a4c
2 changed files with 0 additions and 70 deletions

View file

@ -1,46 +0,0 @@
require 'erb'
def create_options
if @db == 'mysql'
'ENGINE = ' + (mysql_engine rescue @mysql_engine)
end
end
def db_quote(column)
case @db
when 'postgresql'
return "\"#{column}\""
when 'sqlite', 'sqlite3'
return "'#{column}'"
when 'mysql'
return "`#{column}`"
end
end
def db_structure(db)
db.downcase!
@db = db
case db
when 'postgresql'
@pk = 'SERIAL PRIMARY KEY'
@datetime = 'TIMESTAMP'
@boolean = "BOOLEAN"
when 'sqlite', 'sqlite3'
@pk = 'INTEGER PRIMARY KEY'
@datetime = 'DATETIME'
@boolean = "INTEGER"
when 'mysql'
@pk = 'INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'
@datetime = 'DATETIME'
@boolean = "TINYINT"
@mysql_engine = 'InnoDB'
else
raise "Unknown db type #{db}"
end
s = ''
Dir[RAILS_ROOT + '/db/*.erbsql'].each do |filename|
s += ERB.new(File.read(filename)).result
end
s
end

View file

@ -1,24 +0,0 @@
#!/usr/bin/env ruby
APP_ROOT = File.expand_path(File.dirname(__FILE__)) + '/../'
require APP_ROOT + 'config/environment'
require 'db_structure'
config = ActiveRecord::Base.configurations
['production', 'test', 'development'].each do |target|
begin
ENV['RAILS_ENV'] = target
load APP_ROOT + 'config/environment.rb'
puts "Creating tables for #{target}..."
db_structure(config[target]['adapter']).split(/\s*;\s*/).each do |sql|
ActiveRecord::Base.connection.execute(sql)
end
puts "done."
rescue => e
puts "failed: " + e.inspect
end
end