Module: DBCode
- Extended by:
- DBCode
- Included in:
- DBCode
- Defined in:
- lib/dbcode.rb,
lib/dbcode/graph.rb,
lib/dbcode/schema.rb,
lib/dbcode/railtie.rb,
lib/dbcode/version.rb,
lib/dbcode/sql_file.rb
Defined Under Namespace
Classes: Graph, Railtie, SQLFile, Schema, SearchPath
Constant Summary collapse
- LoadError =
Class.new RuntimeError
- VERSION =
'0.0.1'
Instance Attribute Summary collapse
-
#code_schema_name ⇒ Object
Returns the value of attribute code_schema_name.
-
#sql_file_path ⇒ Object
Returns the value of attribute sql_file_path.
Instance Method Summary collapse
Instance Attribute Details
#code_schema_name ⇒ Object
Returns the value of attribute code_schema_name.
6 7 8 |
# File 'lib/dbcode.rb', line 6 def code_schema_name @code_schema_name end |
#sql_file_path ⇒ Object
Returns the value of attribute sql_file_path.
6 7 8 |
# File 'lib/dbcode.rb', line 6 def sql_file_path @sql_file_path end |
Instance Method Details
#ensure_freshness! ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/dbcode.rb', line 9 def ensure_freshness! code = Schema.new connection: ActiveRecord::Base.connection, name: code_schema_name code.within_schema do unless code.digest == graph.digest code.reset! code.execute graph.to_sql code.digest = graph.digest end end code.append_path!(ActiveRecord::Base.connection_config) end |
#file_names ⇒ Object
25 26 27 |
# File 'lib/dbcode.rb', line 25 def file_names Dir[sql_file_path.join('**/*.sql').] end |