Module: AwesomePrint::DbSchema
- Defined in:
- lib/db_schema/awesome_print.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
9 10 11 12 |
# File 'lib/db_schema/awesome_print.rb', line 9 def self.included(base) base.send :alias_method, :cast_without_dbschema, :cast base.send :alias_method, :cast, :cast_with_dbschema end |
Instance Method Details
#cast_with_dbschema(object, type) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/db_schema/awesome_print.rb', line 14 def cast_with_dbschema(object, type) case object when ::DbSchema::Operations::CreateTable :dbschema_create_table when ::DbSchema::Operations::DropTable :dbschema_drop_table when ::DbSchema::Operations::AlterTable :dbschema_alter_table when ::DbSchema::Operations::CreateColumn :dbschema_create_column when ::DbSchema::Operations::ColumnOperation :dbschema_column_operation when ::DbSchema::Operations::RenameOperation :dbschema_rename when ::DbSchema::Operations::AlterColumnType :dbschema_alter_column_type when ::DbSchema::Operations::AlterColumnDefault :dbschema_alter_column_default when ::DbSchema::Operations::CreateIndex :dbschema_create_index when ::DbSchema::Operations::DropIndex :dbschema_drop_index when ::DbSchema::Operations::CreateCheckConstraint :dbschema_create_check_constraint when ::DbSchema::Operations::CreateForeignKey :dbschema_create_foreign_key when ::DbSchema::Operations::DropForeignKey :dbschema_drop_foreign_key when ::DbSchema::Operations::CreateEnum :dbschema_create_enum when ::DbSchema::Operations::AlterEnumValues :dbschema_alter_enum_values when ::DbSchema::Operations::CreateExtension :dbschema_create_extension else cast_without_dbschema(object, type) end end |