gdonald-railsdb 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.txt +674 -0
- data/README.txt +40 -0
- data/README_RAILS.txt +204 -0
- data/Rakefile +31 -0
- data/app/controllers/application.rb +24 -0
- data/app/controllers/database_controller.rb +274 -0
- data/app/controllers/home_controller.rb +366 -0
- data/app/helpers/application_helper.rb +43 -0
- data/app/helpers/home_helper.rb +2 -0
- data/app/models/database.rb +113 -0
- data/app/models/driver.rb +8 -0
- data/app/models/field.rb +117 -0
- data/app/models/group.rb +12 -0
- data/app/models/group_permission.rb +6 -0
- data/app/models/permission.rb +9 -0
- data/app/models/row.rb +26 -0
- data/app/models/switch.rb +85 -0
- data/app/models/table.rb +155 -0
- data/app/models/user.rb +98 -0
- data/app/models/user_group.rb +6 -0
- data/app/views/database/_field.html.erb +20 -0
- data/app/views/database/_field_form.html.erb +28 -0
- data/app/views/database/_insert_form.html.erb +37 -0
- data/app/views/database/_new_field.html.erb +43 -0
- data/app/views/database/_new_field_header.html.erb +12 -0
- data/app/views/database/_pagination.html.erb +14 -0
- data/app/views/database/_row.html.erb +16 -0
- data/app/views/database/_table.html.erb +22 -0
- data/app/views/database/_table_form.html.erb +45 -0
- data/app/views/database/add_fields.html.erb +3 -0
- data/app/views/database/add_table.html.erb +3 -0
- data/app/views/database/blank_field.rjs +6 -0
- data/app/views/database/browse.html.erb +30 -0
- data/app/views/database/del_field.html.erb +31 -0
- data/app/views/database/del_table.html.erb +31 -0
- data/app/views/database/edit_field.html.erb +23 -0
- data/app/views/database/edit_row.html.erb +22 -0
- data/app/views/database/index.html.erb +23 -0
- data/app/views/database/insert.html.erb +3 -0
- data/app/views/database/table.html.erb +30 -0
- data/app/views/home/_database.html.erb +8 -0
- data/app/views/home/_database_form.html.erb +68 -0
- data/app/views/home/_driver.html.erb +5 -0
- data/app/views/home/_driver_form.html.erb +25 -0
- data/app/views/home/_group.html.erb +10 -0
- data/app/views/home/_group_form.html.erb +25 -0
- data/app/views/home/_group_permission.html.erb +4 -0
- data/app/views/home/_permission.html.erb +6 -0
- data/app/views/home/_permission_form.html.erb +32 -0
- data/app/views/home/_user.html.erb +10 -0
- data/app/views/home/_user_form.html.erb +64 -0
- data/app/views/home/_user_group.html.erb +4 -0
- data/app/views/home/add_database.html.erb +3 -0
- data/app/views/home/add_driver.html.erb +3 -0
- data/app/views/home/add_group.html.erb +4 -0
- data/app/views/home/add_permission.html.erb +3 -0
- data/app/views/home/add_user.html.erb +62 -0
- data/app/views/home/bottom.html.erb +17 -0
- data/app/views/home/databases.html.erb +22 -0
- data/app/views/home/del_database.html.erb +31 -0
- data/app/views/home/del_driver.html.erb +32 -0
- data/app/views/home/del_group.html.erb +32 -0
- data/app/views/home/del_group_permission.html.erb +32 -0
- data/app/views/home/del_permission.html.erb +32 -0
- data/app/views/home/del_user.html.erb +33 -0
- data/app/views/home/del_user_group.html.erb +32 -0
- data/app/views/home/drivers.html.erb +20 -0
- data/app/views/home/edit_database.html.erb +3 -0
- data/app/views/home/edit_driver.html.erb +3 -0
- data/app/views/home/edit_group.html.erb +4 -0
- data/app/views/home/edit_permission.html.erb +4 -0
- data/app/views/home/edit_user.html.erb +84 -0
- data/app/views/home/group_permissions.html.erb +38 -0
- data/app/views/home/groups.html.erb +20 -0
- data/app/views/home/index.html.erb +21 -0
- data/app/views/home/login.html.erb +42 -0
- data/app/views/home/menu.html.erb +33 -0
- data/app/views/home/permissions.html.erb +21 -0
- data/app/views/home/top.html.erb +22 -0
- data/app/views/home/user_groups.html.erb +44 -0
- data/app/views/home/users.html.erb +27 -0
- data/app/views/layouts/application.html.erb +18 -0
- data/config/boot.rb +109 -0
- data/config/database.yml +14 -0
- data/config/environment.rb +114 -0
- data/config/environments/development.rb +18 -0
- data/config/environments/production.rb +19 -0
- data/config/environments/test.rb +22 -0
- data/config/initializers/inflections.rb +10 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/routes.rb +135 -0
- data/db/migrate/001_create_sessions.rb +17 -0
- data/db/migrate/002_create_users.rb +26 -0
- data/db/migrate/003_create_groups.rb +17 -0
- data/db/migrate/004_create_permissions.rb +18 -0
- data/db/migrate/005_create_group_permissions.rb +22 -0
- data/db/migrate/006_create_user_groups.rb +19 -0
- data/db/migrate/007_create_drivers.rb +17 -0
- data/db/migrate/008_create_databases.rb +43 -0
- data/db/schema.rb +91 -0
- data/lib/ignore +0 -0
- data/log/ignore +0 -0
- data/public/404.html +30 -0
- data/public/422.html +30 -0
- data/public/500.html +30 -0
- data/public/dispatch.cgi +10 -0
- data/public/dispatch.fcgi +24 -0
- data/public/dispatch.rb +10 -0
- data/public/favicon.ico +0 -0
- data/public/images/rails.png +0 -0
- data/public/images/ss1.png +0 -0
- data/public/images/ss2.png +0 -0
- data/public/images/ss3.png +0 -0
- data/public/images/ss4.png +0 -0
- data/public/images/ss5.png +0 -0
- data/public/images/ss6.png +0 -0
- data/public/javascripts/application.js +25 -0
- data/public/javascripts/controls.js +963 -0
- data/public/javascripts/dragdrop.js +972 -0
- data/public/javascripts/effects.js +1120 -0
- data/public/javascripts/prototype.js +4225 -0
- data/public/robots.txt +4 -0
- data/public/stylesheets/railsdb.css +227 -0
- data/script/about +3 -0
- data/script/console +3 -0
- data/script/destroy +3 -0
- data/script/generate +3 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/performance/request +3 -0
- data/script/plugin +3 -0
- data/script/process/inspector +3 -0
- data/script/process/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/test/fixtures/databases.yml +7 -0
- data/test/fixtures/drivers.yml +7 -0
- data/test/fixtures/group_permissions.yml +7 -0
- data/test/fixtures/groups.yml +7 -0
- data/test/fixtures/permissions.yml +7 -0
- data/test/fixtures/user_groups.yml +7 -0
- data/test/fixtures/users.yml +18 -0
- data/test/functional/home_controller_test.rb +8 -0
- data/test/test_helper.rb +38 -0
- data/test/unit/database_test.rb +8 -0
- data/test/unit/driver_test.rb +8 -0
- data/test/unit/group_permission_test.rb +8 -0
- data/test/unit/group_test.rb +8 -0
- data/test/unit/permission_test.rb +8 -0
- data/test/unit/user_group_test.rb +8 -0
- data/test/unit/user_test.rb +9 -0
- data/tmp/pids/ignore +0 -0
- data/tmp/sessions/ignore +0 -0
- data/tmp/sockets/ignore +0 -0
- metadata +287 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The test environment is used exclusively to run your application's
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
7
|
+
config.cache_classes = true
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Disable request forgery protection in test environment
|
17
|
+
config.action_controller.allow_forgery_protection = false
|
18
|
+
|
19
|
+
# Tell ActionMailer not to deliver emails to the real world.
|
20
|
+
# The :test delivery method accumulates sent emails in the
|
21
|
+
# ActionMailer::Base.deliveries array.
|
22
|
+
config.action_mailer.delivery_method = :test
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
3
|
+
|
4
|
+
# Sample of regular route:
|
5
|
+
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
6
|
+
# Keep in mind you can assign values other than :controller and :action
|
7
|
+
|
8
|
+
# Sample of named route:
|
9
|
+
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
10
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
11
|
+
|
12
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
13
|
+
# map.resources :products
|
14
|
+
|
15
|
+
# Sample resource route with options:
|
16
|
+
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
|
17
|
+
|
18
|
+
# Sample resource route with sub-resources:
|
19
|
+
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
|
20
|
+
|
21
|
+
# Sample resource route within a namespace:
|
22
|
+
# map.namespace :admin do |admin|
|
23
|
+
# # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
|
24
|
+
# admin.resources :products
|
25
|
+
# end
|
26
|
+
|
27
|
+
map.connect 'database/:id/blank_field',
|
28
|
+
:controller => 'database',
|
29
|
+
:action => 'blank_field',
|
30
|
+
:requirements => { :id => /[0-9]{1,11}/ }
|
31
|
+
|
32
|
+
map.connect 'database/:id/edit',
|
33
|
+
:controller => 'home',
|
34
|
+
:action => 'edit_database',
|
35
|
+
:requirements => { :id => /[0-9]{1,11}/ }
|
36
|
+
|
37
|
+
map.connect 'database/:id/del',
|
38
|
+
:controller => 'home',
|
39
|
+
:action => 'del_database',
|
40
|
+
:requirements => { :id => /[0-9]{1,11}/ }
|
41
|
+
|
42
|
+
map.connect 'database/:id/:table/add',
|
43
|
+
:controller => 'database',
|
44
|
+
:action => 'add_fields',
|
45
|
+
:requirements => { :id => /[0-9]{1,11}/,
|
46
|
+
:table => /[\.0-9a-z\-_]{1,64}/ }
|
47
|
+
|
48
|
+
map.connect 'database/:id/:table/:pk/edit',
|
49
|
+
:controller => 'database',
|
50
|
+
:action => 'edit_row',
|
51
|
+
:requirements => { :id => /[0-9]{1,11}/,
|
52
|
+
:table => /[\.0-9a-z\-_]{1,64}/,
|
53
|
+
:pk => /[0-9]{1,11}/ }
|
54
|
+
|
55
|
+
map.connect 'database/:id/:table/:pk/del',
|
56
|
+
:controller => 'database',
|
57
|
+
:action => 'del_row',
|
58
|
+
:requirements => { :id => /[0-9]{1,11}/,
|
59
|
+
:table => /[\.0-9a-z\-_]{1,64}/,
|
60
|
+
:pk => /[0-9]{1,11}/ }
|
61
|
+
|
62
|
+
map.connect 'database/:id/:table/:field/edit',
|
63
|
+
:controller => 'database',
|
64
|
+
:action => 'edit_field',
|
65
|
+
:requirements => { :id => /[0-9]{1,11}/,
|
66
|
+
:table => /[\.0-9a-z\-_]{1,64}/,
|
67
|
+
:field => /[\.0-9a-z\-_]{1,64}/ }
|
68
|
+
|
69
|
+
map.connect 'database/:id/:table/:field/del',
|
70
|
+
:controller => 'database',
|
71
|
+
:action => 'del_field',
|
72
|
+
:requirements => { :id => /[0-9]{1,11}/,
|
73
|
+
:table => /[\.0-9a-z\-_]{1,64}/,
|
74
|
+
:field => /[\.0-9a-z\-_]{1,64}/ }
|
75
|
+
|
76
|
+
map.connect 'database/:id/add',
|
77
|
+
:controller => 'database',
|
78
|
+
:action => 'add_table',
|
79
|
+
:requirements => { :id => /[0-9]{1,11}/ }
|
80
|
+
|
81
|
+
map.connect 'database/:id/:table/edit',
|
82
|
+
:controller => 'database',
|
83
|
+
:action => 'edit_table',
|
84
|
+
:requirements => { :id => /[0-9]{1,11}/,
|
85
|
+
:table => /[\.0-9a-z\-_]{1,64}/ }
|
86
|
+
|
87
|
+
map.connect 'database/:id/:table/del',
|
88
|
+
:controller => 'database',
|
89
|
+
:action => 'del_table',
|
90
|
+
:requirements => { :id => /[0-9]{1,11}/,
|
91
|
+
:table => /[\.0-9a-z\-_]{1,64}/ }
|
92
|
+
|
93
|
+
map.connect 'database/:id/:table/browse/:page',
|
94
|
+
:controller => 'database',
|
95
|
+
:action => 'browse',
|
96
|
+
:requirements => { :id => /[0-9]{1,11}/,
|
97
|
+
:table => /[\.0-9a-z\-_]{1,64}/,
|
98
|
+
:page => /[0-9]{1,11}/ }
|
99
|
+
|
100
|
+
map.connect 'database/:id/:table/insert',
|
101
|
+
:controller => 'database',
|
102
|
+
:action => 'insert',
|
103
|
+
:requirements => { :id => /[0-9]{1,11}/,
|
104
|
+
:table => /[\.0-9a-z\-_]{1,64}/ }
|
105
|
+
|
106
|
+
map.connect 'database/:id/:table/browse',
|
107
|
+
:controller => 'database',
|
108
|
+
:action => 'browse',
|
109
|
+
:requirements => { :id => /[0-9]{1,11}/,
|
110
|
+
:table => /[\.0-9a-z\-_]{1,64}/ }
|
111
|
+
|
112
|
+
map.connect 'database/:id/:table',
|
113
|
+
:controller => 'database',
|
114
|
+
:action => 'table',
|
115
|
+
:requirements => { :id => /[0-9]{1,11}/,
|
116
|
+
:table => /[\.0-9a-z\-_]{1,64}/ }
|
117
|
+
|
118
|
+
map.connect 'database/add',
|
119
|
+
:controller => 'home',
|
120
|
+
:action => 'add_database'
|
121
|
+
|
122
|
+
map.connect 'database/:id',
|
123
|
+
:controller => 'database',
|
124
|
+
:action => 'index',
|
125
|
+
:requirements => { :id => /[0-9]{1,11}/ }
|
126
|
+
|
127
|
+
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
|
128
|
+
map.root :controller => 'home'
|
129
|
+
|
130
|
+
# See how all your routes lay out with "rake routes"
|
131
|
+
|
132
|
+
# Install the default routes as the lowest priority.
|
133
|
+
map.connect ':controller/:action/:id'
|
134
|
+
map.connect ':controller/:action/:id.:format'
|
135
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateSessions < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table :sessions, :force => true do |t|
|
5
|
+
t.string :session_id, :null => false
|
6
|
+
t.text :data
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :sessions, :session_id
|
10
|
+
add_index :sessions, :updated_at
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :sessions
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class CreateUsers < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table :users, :force => true do |t|
|
5
|
+
t.column :username, :string, :null => false, :limit => 16
|
6
|
+
t.column :email, :string, :null => false, :limit => 48
|
7
|
+
t.column :passwd_hash, :string, :limit => 40
|
8
|
+
t.column :passwd_salt, :string, :limit => 40
|
9
|
+
t.column :fname, :string, :null => false, :limit => 32
|
10
|
+
t.column :lname, :string, :null => false, :limit => 32
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
add_index :users, :email, :unique => true
|
14
|
+
add_index :users, :username, :unique => true
|
15
|
+
User.create( :fname => 'Admin',
|
16
|
+
:lname => 'User',
|
17
|
+
:username => 'railsdb',
|
18
|
+
:email => 'user@example.com',
|
19
|
+
:password => 'changeme' )
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.down
|
23
|
+
drop_table :users
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateGroups < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table :groups, :force => true do |t|
|
5
|
+
t.column :name, :string, :null => false, :limit => 32
|
6
|
+
t.timestamps
|
7
|
+
end
|
8
|
+
add_index :groups, :name, :unique => true
|
9
|
+
Group.create( :name => 'admin' )
|
10
|
+
Group.create( :name => 'user' )
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :groups
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreatePermissions < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table :permissions, :force => true do |t|
|
5
|
+
t.column :name, :string, :null => false, :limit => 32
|
6
|
+
t.column :description, :string, :limit => 255
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :permissions, :name, :unique => true
|
10
|
+
Permission.create( :name => 'admin', :description => 'required for using admin functions' )
|
11
|
+
Permission.create( :name => 'user', :description => 'required for using any functions' )
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
drop_table :permissions
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateGroupPermissions < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table :group_permissions, :force => true do |t|
|
5
|
+
t.column :group_id, :int, :null => false
|
6
|
+
t.column :permission_id, :int, :null => false
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :group_permissions, [ :group_id, :permission_id ], :unique => true, :name => 'group_perms_group_perm'
|
10
|
+
@admin_g = Group.find_by_name( 'admin' )
|
11
|
+
@user_g = Group.find_by_name( 'user' )
|
12
|
+
@admin_p = Permission.find_by_name( 'admin' )
|
13
|
+
@user_p = Permission.find_by_name( 'user' )
|
14
|
+
GroupPermission.create( :group => @admin_g, :permission => @admin_p )
|
15
|
+
GroupPermission.create( :group => @user_g, :permission => @user_p )
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.down
|
19
|
+
drop_table :group_permissions
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateUserGroups < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table :user_groups, :force => true do |t|
|
5
|
+
t.column :user_id, :int, :null => false
|
6
|
+
t.column :group_id, :int, :null => false
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :user_groups, [ :user_id, :group_id ], :unique => true, :name => 'user_groups_user_group'
|
10
|
+
@railsdb_u = User.find_by_username( 'railsdb' )
|
11
|
+
@admin_g = Group.find_by_name( 'admin' )
|
12
|
+
UserGroup.create( :user => @railsdb_u, :group => @admin_g )
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table :user_groups
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateDrivers < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table :drivers do |t|
|
5
|
+
t.string :name, :limit => 64
|
6
|
+
t.timestamps
|
7
|
+
end
|
8
|
+
%w( mysql oracle postgresql sqlite3 ).sort.each do |d|
|
9
|
+
Driver.create( :name => d )
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :drivers
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
class CreateDatabases < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table :databases do |t|
|
5
|
+
t.integer :driver_id
|
6
|
+
t.string :name, :limit => 64
|
7
|
+
t.string :path, :limit => 255, :default => nil
|
8
|
+
t.string :description, :limit => 255, :default => nil
|
9
|
+
t.string :host, :limit => 255, :default => nil
|
10
|
+
t.string :username, :limit => 32, :default => nil
|
11
|
+
t.string :password, :limit => 40, :default => nil
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
@mysql = Driver.find_by_name( 'mysql' )
|
15
|
+
@oracle = Driver.find_by_name( 'oracle' )
|
16
|
+
@postgresql = Driver.find_by_name( 'postgresql' )
|
17
|
+
@sqlite3 = Driver.find_by_name( 'sqlite3' )
|
18
|
+
Database.create( :name => 'mysql',
|
19
|
+
:description => 'This is an example MySQL database.',
|
20
|
+
:driver => @mysql,
|
21
|
+
:host => 'localhost',
|
22
|
+
:username => 'root' )
|
23
|
+
Database.create( :name => 'oracle',
|
24
|
+
:description => 'This is an example Oracle/XE database.',
|
25
|
+
:driver => @oracle,
|
26
|
+
:host => 'localhost',
|
27
|
+
:username => 'root' )
|
28
|
+
Database.create( :name => 'postgresql',
|
29
|
+
:description => 'This is an example PostgreSQL database.',
|
30
|
+
:driver => @postgresql,
|
31
|
+
:host => 'localhost',
|
32
|
+
:username => 'root' )
|
33
|
+
Database.create( :name => "#{ RAILS_ENV }.sqlite3",
|
34
|
+
:path => "#{ RAILS_ROOT }/db/#{ RAILS_ENV }.sqlite3",
|
35
|
+
:description => 'This is the main application database.',
|
36
|
+
:driver => @sqlite3 )
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.down
|
40
|
+
drop_table :databases
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
data/db/schema.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead of editing this file,
|
2
|
+
# please use the migrations feature of ActiveRecord to incrementally modify your database, and
|
3
|
+
# then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
|
6
|
+
# to create the application database on another system, you should be using db:schema:load, not running
|
7
|
+
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
8
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
9
|
+
#
|
10
|
+
# It's strongly recommended to check this file into your version control system.
|
11
|
+
|
12
|
+
ActiveRecord::Schema.define(:version => 8) do
|
13
|
+
|
14
|
+
create_table "databases", :force => true do |t|
|
15
|
+
t.integer "driver_id"
|
16
|
+
t.string "name", :limit => 64
|
17
|
+
t.string "path"
|
18
|
+
t.string "description"
|
19
|
+
t.string "host"
|
20
|
+
t.string "username", :limit => 32
|
21
|
+
t.string "password", :limit => 40
|
22
|
+
t.datetime "created_at"
|
23
|
+
t.datetime "updated_at"
|
24
|
+
end
|
25
|
+
|
26
|
+
create_table "drivers", :force => true do |t|
|
27
|
+
t.string "name", :limit => 64
|
28
|
+
t.datetime "created_at"
|
29
|
+
t.datetime "updated_at"
|
30
|
+
end
|
31
|
+
|
32
|
+
create_table "group_permissions", :force => true do |t|
|
33
|
+
t.integer "group_id", :null => false
|
34
|
+
t.integer "permission_id", :null => false
|
35
|
+
t.datetime "created_at"
|
36
|
+
t.datetime "updated_at"
|
37
|
+
end
|
38
|
+
|
39
|
+
add_index "group_permissions", ["group_id", "permission_id"], :name => "group_perms_group_perm", :unique => true
|
40
|
+
|
41
|
+
create_table "groups", :force => true do |t|
|
42
|
+
t.string "name", :limit => 32, :null => false
|
43
|
+
t.datetime "created_at"
|
44
|
+
t.datetime "updated_at"
|
45
|
+
end
|
46
|
+
|
47
|
+
add_index "groups", ["name"], :name => "index_groups_on_name", :unique => true
|
48
|
+
|
49
|
+
create_table "permissions", :force => true do |t|
|
50
|
+
t.string "name", :limit => 32, :null => false
|
51
|
+
t.string "description"
|
52
|
+
t.datetime "created_at"
|
53
|
+
t.datetime "updated_at"
|
54
|
+
end
|
55
|
+
|
56
|
+
add_index "permissions", ["name"], :name => "index_permissions_on_name", :unique => true
|
57
|
+
|
58
|
+
create_table "sessions", :force => true do |t|
|
59
|
+
t.string "session_id", :null => false
|
60
|
+
t.text "data"
|
61
|
+
t.datetime "created_at"
|
62
|
+
t.datetime "updated_at"
|
63
|
+
end
|
64
|
+
|
65
|
+
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
|
66
|
+
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
|
67
|
+
|
68
|
+
create_table "user_groups", :force => true do |t|
|
69
|
+
t.integer "user_id", :null => false
|
70
|
+
t.integer "group_id", :null => false
|
71
|
+
t.datetime "created_at"
|
72
|
+
t.datetime "updated_at"
|
73
|
+
end
|
74
|
+
|
75
|
+
add_index "user_groups", ["user_id", "group_id"], :name => "user_groups_user_group", :unique => true
|
76
|
+
|
77
|
+
create_table "users", :force => true do |t|
|
78
|
+
t.string "username", :limit => 16, :null => false
|
79
|
+
t.string "email", :limit => 48, :null => false
|
80
|
+
t.string "passwd_hash", :limit => 40
|
81
|
+
t.string "passwd_salt", :limit => 40
|
82
|
+
t.string "fname", :limit => 32, :null => false
|
83
|
+
t.string "lname", :limit => 32, :null => false
|
84
|
+
t.datetime "created_at"
|
85
|
+
t.datetime "updated_at"
|
86
|
+
end
|
87
|
+
|
88
|
+
add_index "users", ["username"], :name => "index_users_on_username", :unique => true
|
89
|
+
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
|
90
|
+
|
91
|
+
end
|