44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/junebug/models.rb', line 44
def self.up
create_table :junebug_users do |t|
t.column :id, :integer, :null => false
t.column :username, :string, :null => false
t.column :password, :string, :null => false
t.column :role, :integer, :default => 0
end
create_table :junebug_pages do |t|
t.column :title, :string, :limit => 255
t.column :body, :text
t.column :user_id, :integer, :null => false
t.column :readonly, :boolean, :default => false
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
Page.create_versioned_table
Page.reset_column_information
if ENV['INTERACTIVE']
print "Create an initial user account\n"
print "\nEnter your username (3-30 chars, no spaces or punctuation): "
username = STDIN.gets.strip
print "\nEnter your password (5-30 chars, no spaces or punctuation): "
password = STDIN.gets.strip
else
username = 'admin'
password = 'password'
end
admin = User.create :username => username, :password => password, :role => User::ROLE_ADMIN
pages_file = File.dirname(__FILE__) + "/../../fixtures/junebug_pages.yml"
YAML.load_file(pages_file).each {|page_data|Page.create(page_data) } if File.exist?(pages_file)
end
|