Module: SequelColumnTypes
- Included in:
 - Sequel::Schema::AlterTableGenerator, Sequel::Schema::CreateTableGenerator
 - Defined in:
 - common/db/db_migrator.rb
 
Overview
Sequel uses a nice DSL for creating tables but not for altering tables. The definitions below try to provide a reasonable experience for both cases. Creation is the normal:
HalfLongString :title, :null => true
while altering is (to add a column):
HalfLongString :title
Instance Method Summary (collapse)
- 
  
    
      - (Object) apply_mtime_columns(create_time = true) 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      - (Object) apply_name_columns 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      - (Object) BlobField(field, opts = {}) 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      - (Object) create_column(*column_def) 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      - (Object) DynamicEnum(field, opts = {}) 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      - (Object) HalfLongString(field, opts = {}) 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      - (Object) LongString(field, opts = {}) 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      - (Object) MediumBlobField(field, opts = {}) 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      - (Object) TextBlobField(field, opts = {}) 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      - (Object) TextField(field, opts = {}) 
    
    
  
  
  
  
  
  
  
  
  
    
 
Instance Method Details
- (Object) apply_mtime_columns(create_time = true)
      139 140 141 142 143 144 145 146 147 148 149  | 
    
      # File 'common/db/db_migrator.rb', line 139 def apply_mtime_columns(create_time = true) String :created_by String :last_modified_by if create_time DateTime :create_time, :null => false end DateTime :system_mtime, :null => false, :index => true DateTime :user_mtime, :null => false, :index => true end  | 
  
- (Object) apply_name_columns
      128 129 130 131 132 133 134 135 136  | 
    
      # File 'common/db/db_migrator.rb', line 128 def apply_name_columns String :authority_id, :null => true String :dates, :null => true TextField :qualifier, :null => true DynamicEnum :source_id, :null => true DynamicEnum :rules_id, :null => true TextField :sort_name, :null => false Integer :sort_name_auto_generate end  | 
  
- (Object) BlobField(field, opts = {})
      112 113 114  | 
    
      # File 'common/db/db_migrator.rb', line 112 def BlobField(field, opts = {}) create_column(*ColumnDefs.blobField(field, opts)) end  | 
  
- (Object) create_column(*column_def)
      84 85 86 87 88 89 90  | 
    
      # File 'common/db/db_migrator.rb', line 84 def create_column(*column_def) if self.respond_to?(:column) column(*column_def) else add_column(*column_def) end end  | 
  
- (Object) DynamicEnum(field, opts = {})
      122 123 124 125  | 
    
      # File 'common/db/db_migrator.rb', line 122 def DynamicEnum(field, opts = {}) Integer field, opts foreign_key([field], :enumeration_value, :key => :id) end  | 
  
- (Object) HalfLongString(field, opts = {})
      102 103 104  | 
    
      # File 'common/db/db_migrator.rb', line 102 def HalfLongString(field, opts = {}) create_column(*ColumnDefs.halfLongString(field, opts)) end  | 
  
- (Object) LongString(field, opts = {})
      98 99 100  | 
    
      # File 'common/db/db_migrator.rb', line 98 def LongString(field, opts = {}) create_column(*ColumnDefs.longString(field, opts)) end  | 
  
- (Object) MediumBlobField(field, opts = {})
      117 118 119  | 
    
      # File 'common/db/db_migrator.rb', line 117 def MediumBlobField(field, opts = {}) create_column(*ColumnDefs.mediumBlobField(field, opts)) end  | 
  
- (Object) TextBlobField(field, opts = {})
      107 108 109  | 
    
      # File 'common/db/db_migrator.rb', line 107 def TextBlobField(field, opts = {}) create_column(*ColumnDefs.textBlobField(field, opts)) end  | 
  
- (Object) TextField(field, opts = {})
      93 94 95  | 
    
      # File 'common/db/db_migrator.rb', line 93 def TextField(field, opts = {}) create_column(*ColumnDefs.textField(field, opts)) end  |