Sha256: f6498ec45f6073ba38cda037d95fc6e78efc6e752581eba80e338379b086dad8
Contents?: true
Size: 1.11 KB
Versions: 4
Compression:
Stored size: 1.11 KB
Contents
class TestDatabase def initialize(config) @config = config end # Creates the percona_migrator_test database and comments table in it def create_test_database %x(#{mysql_command} "DROP DATABASE IF EXISTS percona_migrator_test; CREATE DATABASE percona_migrator_test DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci") %x(#{mysql_command} "USE percona_migrator_test; DROP TABLE IF EXISTS comments; CREATE TABLE comments (id int(12) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;") end # Creates the ActiveRecord's schema_migrations table required for # migrations to work def create_schema_migrations_table %x(#{mysql_command} "USE percona_migrator_test; DROP TABLE IF EXISTS schema_migrations; CREATE TABLE schema_migrations ( version varchar(255) COLLATE utf8_unicode_ci NOT NULL, UNIQUE KEY unique_schema_migrations (version)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci") end private attr_reader :config def mysql_command "mysql --user=#{config['username']} --password=#{config['password']} -e" end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
percona_migrator-0.1.0.rc.4 | test_database.rb |
percona_migrator-0.1.0.rc.3 | test_database.rb |
percona_migrator-0.1.0.rc.2 | test_database.rb |
percona_migrator-0.1.0.rc.1 | test_database.rb |