Sha256: 1c4eeeb41260e9406404fcfdc91c5b7db94bf741811a44c5f1c9712c47d6431e

Contents?: true

Size: 999 Bytes

Versions: 7

Compression:

Stored size: 999 Bytes

Contents

class UserModelMigration < Migration
  def self.up(site)
    site.records.create_model :users do |users|
      add_field :first_name, :string
      add_field :last_name, :string
      add_field :email, :email, validations: {required: {}, unique: {}}, searchable: false
      add_field :oauth_id, :string, index: true, searchable: false
      add_field :username, :string, index: true, validations: {required: {}, unique: {}}, searchable: false
      add_field :password, :password, validations: {required: {}}, searchable: false
      add_field :password_salt, :string, display: false, searchable: false
      add_field :created_at, :time, display: false
      add_many  :groups, default: [site.groups['Users'].id]
      add_field :owner, :self
      
      add_field :name, :function, fn: 'format("{{first_name}} {{last_name}}").strip()'
      users.icon = '/admin/images/user_icon.png'
      users.record_class_name = 'User'
    end
  end
  
  def self.down(site)
    site.users.destroy
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
yodel-0.0.7 lib/yodel/models/migrations/05_user_model.rb
yodel_production_environment-0.0.7 lib/migrations/yodel/05_user_model.rb
yodel_development_environment-0.0.7 lib/migrations/yodel/05_user_model.rb
yodel-0.0.4 lib/yodel/models/migrations/05_user_model.rb
yodel-0.0.3 lib/yodel/models/migrations/05_user_model.rb
yodel-0.0.2 lib/yodel/models/migrations/05_user_model.rb
yodel-0.0.1 lib/yodel/models/migrations/05_user_model.rb