Module: SqlMigrations
- Extended by:
- SqlMigrations
- Included in:
- SqlMigrations
- Defined in:
- lib/sql_migrations.rb,
lib/sql_migrations/file.rb,
lib/sql_migrations/seed.rb,
lib/sql_migrations/config.rb,
lib/sql_migrations/script.rb,
lib/sql_migrations/version.rb,
lib/sql_migrations/database.rb,
lib/sql_migrations/migration.rb
Overview
Defined Under Namespace
Modules: Config
Classes: Database, File, Migration, Script, Seed
Constant Summary
collapse
- VERSION =
'2.4.0'
Instance Method Summary
collapse
Instance Method Details
#databases ⇒ Object
29
30
31
32
33
34
|
# File 'lib/sql_migrations.rb', line 29
def databases
Config.databases.each do |name, config|
db = Database.new(name, config)
yield db if block_given?
end
end
|
#load_tasks! ⇒ Object
36
37
38
39
40
|
# File 'lib/sql_migrations.rb', line 36
def load_tasks!
load 'sql_migrations/tasks/migrate.rake'
load 'sql_migrations/tasks/seed.rake'
load 'sql_migrations/tasks/scripts.rake'
end
|
#migrate ⇒ Object
14
15
16
|
# File 'lib/sql_migrations.rb', line 14
def migrate
databases(&:migrate)
end
|
#scripts ⇒ Object
22
23
24
25
26
27
|
# File 'lib/sql_migrations.rb', line 22
def scripts
Config.databases.each do |name, _config|
Migration.find(name).each { |migration| puts migration }
Seed.find(name).each { |seed| puts seed }
end
end
|
#seed ⇒ Object
18
19
20
|
# File 'lib/sql_migrations.rb', line 18
def seed
databases(&:seed)
end
|