Sha256: a347a907268d1f6e04826aad08206147177b4fd9b36f63096475b8f2164ac9a3

Contents?: true

Size: 924 Bytes

Versions: 19

Compression:

Stored size: 924 Bytes

Contents

class AddUsersProfile < ActiveRecord::Migration
  class Profile < ActiveRecord::Base
    include BareMigration

    # there's technically no need for these serialize declaration because in
    # this script active_config and staged_config will always be NULL anyway.
    serialize :active_config
    serialize :staged_config
  end

  def self.up
    STDERR.puts "Creating users profiles"
    create_table :profiles do |t|
      t.column :label, :string
      t.column :nicename, :string
      add_column(:users, :profile_id, :integer, :default => 1)
    end

    Profile.transaction do
      admin = Profile.create(:label => 'admin', :nicename => 'Typo administrator')
      Profile.create(:label => 'publisher', :nicename => 'Blog publisher')
      Profile.create(:label => 'contributor', :nicename => 'Contributor')
    end
  end

  def self.down
    drop_table :profiles
    remove_column :users, :profile_id
  end
end


Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
typo-5.5 db/migrate/064_add_users_profile.rb
typo-5.4.4 db/migrate/064_add_users_profile.rb
typo-5.4.3 db/migrate/064_add_users_profile.rb
typo-5.4.2 db/migrate/064_add_users_profile.rb
typo-5.4.1 db/migrate/064_add_users_profile.rb
typo-5.4 db/migrate/064_add_users_profile.rb
typo-5.0.1 db/migrate/064_add_users_profile.rb
typo-5.0.2 db/migrate/064_add_users_profile.rb
typo-5.0.3.98.1 db/migrate/064_add_users_profile.rb
typo-5.0.3.98 db/migrate/064_add_users_profile.rb
typo-5.0 db/migrate/064_add_users_profile.rb
typo-5.1.1 db/migrate/064_add_users_profile.rb
typo-5.1.2 db/migrate/064_add_users_profile.rb
typo-5.1.3 db/migrate/064_add_users_profile.rb
typo-5.1 db/migrate/064_add_users_profile.rb
typo-5.1.98 db/migrate/064_add_users_profile.rb
typo-5.2 db/migrate/064_add_users_profile.rb
typo-5.2.98 db/migrate/064_add_users_profile.rb
typo-5.3 db/migrate/064_add_users_profile.rb