Parent Directory
|
Revision Log
Revision 6661 - (view) (download)
| 1 : | sh002i | 1696 | #!perl |
| 2 : | ################################################################################ | ||
| 3 : | # WeBWorK Online Homework Delivery System | ||
| 4 : | sh002i | 5319 | # Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ |
| 5 : | gage | 6113 | # $CVSHeader: webwork2/conf/database.conf.dist,v 1.38 2007/08/13 22:59:51 sh002i Exp $ |
| 6 : | sh002i | 1696 | # |
| 7 : | # This program is free software; you can redistribute it and/or modify it under | ||
| 8 : | # the terms of either: (a) the GNU General Public License as published by the | ||
| 9 : | # Free Software Foundation; either version 2, or (at your option) any later | ||
| 10 : | # version, or (b) the "Artistic License" which comes with this package. | ||
| 11 : | # | ||
| 12 : | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 13 : | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 14 : | # FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the | ||
| 15 : | # Artistic License for more details. | ||
| 16 : | ################################################################################ | ||
| 17 : | |||
| 18 : | =head1 NAME | ||
| 19 : | |||
| 20 : | glarose | 4904 | database.conf - define standard database layouts |
| 21 : | sh002i | 1696 | |
| 22 : | =head1 SYNOPSIS | ||
| 23 : | |||
| 24 : | In global.conf: | ||
| 25 : | |||
| 26 : | include "conf/database.conf"; | ||
| 27 : | *dbLayout = $dbLayouts{layoutName}; | ||
| 28 : | |||
| 29 : | =head1 DESCRIPTION | ||
| 30 : | |||
| 31 : | This file contains definitions for the commonly-used database layouts. Database | ||
| 32 : | layouts consist of all the information necessary to describe how to access data | ||
| 33 : | used by WeBWorK. For more information on the format of a database layout, | ||
| 34 : | consult the documentation for the WeBWorK::DB module. | ||
| 35 : | |||
| 36 : | A database layout is selected from the list of possible layouts by adding a | ||
| 37 : | line like the one below to the F<global.conf> or F<course.conf> file. | ||
| 38 : | |||
| 39 : | sh002i | 2310 | $dbLayoutName = "layoutName"; |
| 40 : | *dbLayout = $dbLayouts{$dbLayoutName}; | ||
| 41 : | sh002i | 1696 | |
| 42 : | =cut | ||
| 43 : | |||
| 44 : | %dbLayouts = (); # layouts are added to this hash below | ||
| 45 : | |||
| 46 : | sh002i | 4085 | =head2 THE SQL_SINGLE DATABASE LAYOUT |
| 47 : | sh002i | 2830 | |
| 48 : | sh002i | 3822 | The C<sql_single> layout is similar to the C<sql> layout, excpet that it uses a |
| 49 : | single database for all courses. This is accomplised by prefixing each table | ||
| 50 : | name with the name of the course. The names and passwords of these accounts are | ||
| 51 : | given as parameters to each table in the layout. | ||
| 52 : | sh002i | 2830 | |
| 53 : | sh002i | 4521 | username the username to use when connecting to the database |
| 54 : | password the password to use when connecting to the database | ||
| 55 : | sh002i | 1696 | |
| 56 : | sh002i | 4521 | Be default, username is "webworkRead" and password is "". It is not recommended |
| 57 : | that you use only a non-empty password to secure database access. Most RDBMSs | ||
| 58 : | allow IP-based authorization as well. As the system administrator, IT IS YOUR | ||
| 59 : | RESPONSIBILITY TO SECURE DATABASE ACCESS. | ||
| 60 : | sh002i | 1698 | |
| 61 : | sh002i | 4521 | Don't confuse the account information above with the accounts of the users of a |
| 62 : | course. This is a system-wide account which allow WeBWorK to talk to the | ||
| 63 : | database server. | ||
| 64 : | sh002i | 1696 | |
| 65 : | Other parameters that can be given are as follows: | ||
| 66 : | |||
| 67 : | tableOverride an alternate name to use when referrring to the table (used | ||
| 68 : | when a table name is a resereved word) | ||
| 69 : | fieldOverride a hash mapping WeBWorK field names to alternate names to use | ||
| 70 : | when referring to those fields (used when one or more field | ||
| 71 : | names are reserved words) | ||
| 72 : | debug if true, SQL statments are printed before being executed | ||
| 73 : | |||
| 74 : | =cut | ||
| 75 : | |||
| 76 : | sh002i | 4072 | # params common to all tables |
| 77 : | sh002i | 1696 | my %sqlParams = ( |
| 78 : | sh002i | 4521 | username => $database_username, |
| 79 : | password => $database_password, | ||
| 80 : | debug => $database_debug, | ||
| 81 : | sh002i | 5208 | # kinda hacky, but needed for table dumping |
| 82 : | mysql_path => $externalPrograms{mysql}, | ||
| 83 : | mysqldump_path => $externalPrograms{mysqldump}, | ||
| 84 : | sh002i | 1696 | ); |
| 85 : | |||
| 86 : | sh002i | 2689 | $dbLayouts{sql_single} = { |
| 87 : | glarose | 4904 | locations => { |
| 88 : | record => "WeBWorK::DB::Record::Locations", | ||
| 89 : | schema => "WeBWorK::DB::Schema::NewSQL::Std", | ||
| 90 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 91 : | source => $database_dsn, | ||
| 92 : | params => { %sqlParams, | ||
| 93 : | non_native => 1, | ||
| 94 : | }, | ||
| 95 : | }, | ||
| 96 : | location_addresses => { | ||
| 97 : | record => "WeBWorK::DB::Record::LocationAddresses", | ||
| 98 : | schema => "WeBWorK::DB::Schema::NewSQL::Std", | ||
| 99 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 100 : | source => $database_dsn, | ||
| 101 : | params => { %sqlParams, | ||
| 102 : | non_native => 1, | ||
| 103 : | }, | ||
| 104 : | }, | ||
| 105 : | sh002i | 2689 | password => { |
| 106 : | record => "WeBWorK::DB::Record::Password", | ||
| 107 : | sh002i | 4559 | schema => "WeBWorK::DB::Schema::NewSQL::Std", |
| 108 : | sh002i | 2689 | driver => "WeBWorK::DB::Driver::SQL", |
| 109 : | sh002i | 4072 | source => $database_dsn, |
| 110 : | sh002i | 2689 | params => { %sqlParams, |
| 111 : | tableOverride => "${courseName}_password", | ||
| 112 : | }, | ||
| 113 : | }, | ||
| 114 : | permission => { | ||
| 115 : | record => "WeBWorK::DB::Record::PermissionLevel", | ||
| 116 : | sh002i | 4559 | schema => "WeBWorK::DB::Schema::NewSQL::Std", |
| 117 : | sh002i | 2689 | driver => "WeBWorK::DB::Driver::SQL", |
| 118 : | sh002i | 4072 | source => $database_dsn, |
| 119 : | sh002i | 2689 | params => { %sqlParams, |
| 120 : | tableOverride => "${courseName}_permission", | ||
| 121 : | }, | ||
| 122 : | }, | ||
| 123 : | key => { | ||
| 124 : | record => "WeBWorK::DB::Record::Key", | ||
| 125 : | sh002i | 4559 | schema => "WeBWorK::DB::Schema::NewSQL::Std", |
| 126 : | sh002i | 2689 | driver => "WeBWorK::DB::Driver::SQL", |
| 127 : | sh002i | 4072 | source => $database_dsn, |
| 128 : | sh002i | 2689 | params => { %sqlParams, |
| 129 : | tableOverride => "${courseName}_key", | ||
| 130 : | fieldOverride => { key => "key_not_a_keyword" }, | ||
| 131 : | }, | ||
| 132 : | }, | ||
| 133 : | user => { | ||
| 134 : | record => "WeBWorK::DB::Record::User", | ||
| 135 : | sh002i | 4559 | schema => "WeBWorK::DB::Schema::NewSQL::Std", |
| 136 : | sh002i | 2689 | driver => "WeBWorK::DB::Driver::SQL", |
| 137 : | sh002i | 4072 | source => $database_dsn, |
| 138 : | sh002i | 2689 | params => { %sqlParams, |
| 139 : | tableOverride => "${courseName}_user", | ||
| 140 : | }, | ||
| 141 : | }, | ||
| 142 : | set => { | ||
| 143 : | record => "WeBWorK::DB::Record::Set", | ||
| 144 : | sh002i | 4559 | schema => "WeBWorK::DB::Schema::NewSQL::Std", |
| 145 : | sh002i | 2689 | driver => "WeBWorK::DB::Driver::SQL", |
| 146 : | sh002i | 4072 | source => $database_dsn, |
| 147 : | sh002i | 2689 | params => { %sqlParams, |
| 148 : | gage | 6655 | tableOverride => "${courseName}_set", |
| 149 : | fieldOverride => { visible => "published" }, # for compatibility -- visible was originally called published | ||
| 150 : | sh002i | 2689 | }, |
| 151 : | }, | ||
| 152 : | set_user => { | ||
| 153 : | record => "WeBWorK::DB::Record::UserSet", | ||
| 154 : | sh002i | 4792 | schema => "WeBWorK::DB::Schema::NewSQL::NonVersioned", |
| 155 : | sh002i | 2689 | driver => "WeBWorK::DB::Driver::SQL", |
| 156 : | sh002i | 4072 | source => $database_dsn, |
| 157 : | sh002i | 2689 | params => { %sqlParams, |
| 158 : | gage | 6655 | tableOverride => "${courseName}_set_user", |
| 159 : | fieldOverride => { visible => "published" }, # for compatibility -- visible was originally called published | ||
| 160 : | sh002i | 2689 | }, |
| 161 : | }, | ||
| 162 : | sh002i | 4559 | set_merged => { |
| 163 : | record => "WeBWorK::DB::Record::UserSet", | ||
| 164 : | schema => "WeBWorK::DB::Schema::NewSQL::Merge", | ||
| 165 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 166 : | source => $database_dsn, | ||
| 167 : | depend => [qw/set_user set/], | ||
| 168 : | params => { %sqlParams, | ||
| 169 : | sh002i | 4560 | non_native => 1, |
| 170 : | merge => [qw/set_user set/], | ||
| 171 : | sh002i | 4559 | }, |
| 172 : | }, | ||
| 173 : | sh002i | 4792 | set_version => { |
| 174 : | record => "WeBWorK::DB::Record::SetVersion", | ||
| 175 : | schema => "WeBWorK::DB::Schema::NewSQL::Versioned", | ||
| 176 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 177 : | source => $database_dsn, | ||
| 178 : | params => { %sqlParams, | ||
| 179 : | non_native => 1, | ||
| 180 : | tableOverride => "${courseName}_set_user", | ||
| 181 : | gage | 6661 | fieldOverride => { visible => "published" }, # for compatibility -- visible was originally called published |
| 182 : | |||
| 183 : | sh002i | 4792 | }, |
| 184 : | }, | ||
| 185 : | glarose | 4797 | set_version_merged => { |
| 186 : | record => "WeBWorK::DB::Record::SetVersion", | ||
| 187 : | sh002i | 4817 | schema => "WeBWorK::DB::Schema::NewSQL::Merge", |
| 188 : | glarose | 4797 | driver => "WeBWorK::DB::Driver::SQL", |
| 189 : | source => $database_dsn, | ||
| 190 : | depend => [qw/set_version set_user set/], | ||
| 191 : | params => { %sqlParams, | ||
| 192 : | non_native => 1, | ||
| 193 : | sh002i | 4817 | merge => [qw/set_version set_user set/], |
| 194 : | glarose | 4797 | }, |
| 195 : | }, | ||
| 196 : | glarose | 4904 | set_locations => { |
| 197 : | record => "WeBWorK::DB::Record::SetLocations", | ||
| 198 : | schema => "WeBWorK::DB::Schema::NewSQL::Std", | ||
| 199 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 200 : | source => $database_dsn, | ||
| 201 : | params => { %sqlParams, | ||
| 202 : | tableOverride => "${courseName}_set_locations" | ||
| 203 : | }, | ||
| 204 : | }, | ||
| 205 : | set_locations_user => { | ||
| 206 : | record => "WeBWorK::DB::Record::UserSetLocations", | ||
| 207 : | schema => "WeBWorK::DB::Schema::NewSQL::Std", | ||
| 208 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 209 : | source => $database_dsn, | ||
| 210 : | params => { %sqlParams, | ||
| 211 : | tableOverride => "${courseName}_set_locations_user" | ||
| 212 : | }, | ||
| 213 : | }, | ||
| 214 : | sh002i | 2689 | problem => { |
| 215 : | record => "WeBWorK::DB::Record::Problem", | ||
| 216 : | sh002i | 4559 | schema => "WeBWorK::DB::Schema::NewSQL::Std", |
| 217 : | sh002i | 2689 | driver => "WeBWorK::DB::Driver::SQL", |
| 218 : | sh002i | 4072 | source => $database_dsn, |
| 219 : | sh002i | 2689 | params => { %sqlParams, |
| 220 : | tableOverride => "${courseName}_problem" | ||
| 221 : | }, | ||
| 222 : | }, | ||
| 223 : | problem_user => { | ||
| 224 : | record => "WeBWorK::DB::Record::UserProblem", | ||
| 225 : | sh002i | 4792 | schema => "WeBWorK::DB::Schema::NewSQL::NonVersioned", |
| 226 : | sh002i | 2689 | driver => "WeBWorK::DB::Driver::SQL", |
| 227 : | sh002i | 4072 | source => $database_dsn, |
| 228 : | sh002i | 2689 | params => { %sqlParams, |
| 229 : | tableOverride => "${courseName}_problem_user" | ||
| 230 : | }, | ||
| 231 : | }, | ||
| 232 : | sh002i | 4559 | problem_merged => { |
| 233 : | record => "WeBWorK::DB::Record::UserProblem", | ||
| 234 : | schema => "WeBWorK::DB::Schema::NewSQL::Merge", | ||
| 235 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 236 : | source => $database_dsn, | ||
| 237 : | depend => [qw/problem_user problem/], | ||
| 238 : | params => { %sqlParams, | ||
| 239 : | sh002i | 4750 | non_native => 1, |
| 240 : | merge => [qw/problem_user problem/], | ||
| 241 : | sh002i | 4559 | }, |
| 242 : | }, | ||
| 243 : | sh002i | 4792 | problem_version => { |
| 244 : | record => "WeBWorK::DB::Record::ProblemVersion", | ||
| 245 : | schema => "WeBWorK::DB::Schema::NewSQL::Versioned", | ||
| 246 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 247 : | source => $database_dsn, | ||
| 248 : | params => { %sqlParams, | ||
| 249 : | non_native => 1, | ||
| 250 : | tableOverride => "${courseName}_problem_user", | ||
| 251 : | }, | ||
| 252 : | }, | ||
| 253 : | glarose | 4797 | problem_version_merged => { |
| 254 : | record => "WeBWorK::DB::Record::ProblemVersion", | ||
| 255 : | sh002i | 4817 | schema => "WeBWorK::DB::Schema::NewSQL::Merge", |
| 256 : | glarose | 4797 | driver => "WeBWorK::DB::Driver::SQL", |
| 257 : | source => $database_dsn, | ||
| 258 : | depend => [qw/problem_version problem_user problem/], | ||
| 259 : | params => { %sqlParams, | ||
| 260 : | non_native => 1, | ||
| 261 : | sh002i | 4817 | merge => [qw/problem_version problem_user problem/], |
| 262 : | glarose | 4797 | }, |
| 263 : | }, | ||
| 264 : | sh002i | 5215 | setting => { |
| 265 : | record => "WeBWorK::DB::Record::Setting", | ||
| 266 : | schema => "WeBWorK::DB::Schema::NewSQL::Std", | ||
| 267 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 268 : | source => $database_dsn, | ||
| 269 : | params => { %sqlParams, | ||
| 270 : | tableOverride => "${courseName}_setting" | ||
| 271 : | }, | ||
| 272 : | }, | ||
| 273 : | sh002i | 2689 | }; |
| 274 : | sh002i | 4074 | |
| 275 : | |||
| 276 : | sh002i | 4085 | =head1 DATABASE LAYOUT METADATA |
| 277 : | |||
| 278 : | =over | ||
| 279 : | |||
| 280 : | =item @dbLayout_order | ||
| 281 : | |||
| 282 : | Database layouts listed in this array will be displayed first, in the order | ||
| 283 : | specified, wherever database layouts are listed. (For example, in the "Add | ||
| 284 : | Course" tool.) Other layouts are listed after these. | ||
| 285 : | |||
| 286 : | =cut | ||
| 287 : | |||
| 288 : | @dbLayout_order = qw/sql_single sql_moodle/; | ||
| 289 : | |||
| 290 : | =item %dbLayout_descr | ||
| 291 : | |||
| 292 : | Hash mapping database layout names to textual descriptions. | ||
| 293 : | |||
| 294 : | =cut | ||
| 295 : | |||
| 296 : | sh002i | 4086 | %dbLayout_descr = ( |
| 297 : | sh002i | 4085 | sql_single => "Uses a single SQL database to record WeBWorK data for all courses using this layout. This is the recommended layout for new courses.", |
| 298 : | gage | 6113 | # sql_moodle => "Simiar to sql_single, but uses a Moodle database for user, password, and permission information. This layout should be used for courses used with wwmoodle.", |
| 299 : | sh002i | 4085 | ); |
| 300 : | |||
| 301 : | =back | ||
| 302 : | |||
| 303 : | =cut |
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |