Changeset 3413 for pykota/trunk/initscripts/sqlite
- Timestamp:
- 09/27/08 22:02:37 (16 years ago)
- Location:
- pykota/trunk/initscripts/sqlite
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/initscripts/sqlite/pykota-sqlite.sql
r3279 r3413 7 7 -- the Free Software Foundation, either version 3 of the License, or 8 8 -- (at your option) any later version. 9 -- 9 -- 10 10 -- This program is distributed in the hope that it will be useful, 11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of 12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 13 -- GNU General Public License for more details. 14 -- 14 -- 15 15 -- You should have received a copy of the GNU General Public License 16 16 -- along with this program. If not, see <http://www.gnu.org/licenses/>. … … 32 32 CREATE TABLE users(id INTEGER PRIMARY KEY NOT NULL, 33 33 username TEXT UNIQUE NOT NULL, 34 email TEXT, 34 email TEXT, 35 35 balance FLOAT DEFAULT 0.0, 36 36 lifetimepaid FLOAT DEFAULT 0.0, … … 38 38 description TEXT, 39 39 overcharge FLOAT NOT NULL DEFAULT 1.0); 40 40 41 41 -- 42 42 -- Create the groups table … … 46 46 description TEXT, 47 47 limitby TEXT DEFAULT 'quota'); 48 48 49 49 -- 50 50 -- Create the printers table … … 57 57 passthrough BOOLEAN DEFAULT FALSE, 58 58 maxjobsize INT4); 59 59 60 60 -- 61 61 -- Create the print quota table for users … … 70 70 datelimit TEXT, 71 71 maxjobsize INT4, 72 warncount INT4 DEFAULT 0); 72 warncount INT4 DEFAULT 0); 73 73 CREATE INDEX userpquota_u_id_ix ON userpquota (userid); 74 74 CREATE INDEX userpquota_p_id_ix ON userpquota (printerid); 75 75 CREATE UNIQUE INDEX userpquota_up_id_ix ON userpquota (userid, printerid); 76 76 77 77 -- 78 78 -- Create the job history table … … 103 103 CREATE INDEX jobhistory_pd_id_ix ON jobhistory (printerid, jobdate); 104 104 CREATE INDEX jobhistory_hostname_ix ON jobhistory (hostname); 105 105 106 106 -- 107 107 -- Create the print quota table for groups … … 117 117 CREATE INDEX grouppquota_p_id_ix ON grouppquota (printerid); 118 118 CREATE UNIQUE INDEX grouppquota_up_id_ix ON grouppquota (groupid, printerid); 119 120 -- 119 120 -- 121 121 -- Create the groups/members relationship 122 122 -- … … 124 124 userid INT4 REFERENCES users(id), 125 125 PRIMARY KEY (groupid, userid)); 126 127 -- 126 127 -- 128 128 -- Create the printer groups relationship 129 129 -- … … 133 133 -- 134 134 -- Create the table for payments 135 -- 135 -- 136 136 CREATE TABLE payments (id INTEGER PRIMARY KEY NOT NULL, 137 137 userid INT4 REFERENCES users(id), … … 141 141 CREATE INDEX payments_date_ix ON payments (date); 142 142 143 -- 143 -- 144 144 -- Create the table for coefficients wrt paper sizes and the like 145 145 -- 146 CREATE TABLE coefficients (id INTEGER PRIMARY KEY NOT NULL, 147 printerid INTEGER NOT NULL REFERENCES printers(id), 148 label TEXT NOT NULL, 149 coefficient FLOAT DEFAULT 1.0, 146 CREATE TABLE coefficients (id INTEGER PRIMARY KEY NOT NULL, 147 printerid INTEGER NOT NULL REFERENCES printers(id), 148 label TEXT NOT NULL, 149 coefficient FLOAT DEFAULT 1.0, 150 150 CONSTRAINT coeffconstraint UNIQUE (printerid, label)); 151 151 152 -- 152 -- 153 153 -- Create the table for the billing codes 154 154 -- -
pykota/trunk/initscripts/sqlite/README.sqlite
r3279 r3413 27 27 for use with PyKota, in the case you don't want to use 28 28 either PostgreSQL, MySQL, or LDAP : 29 29 30 30 NB : an SQLite3 database can't be shared between several 31 31 PyKota managed print servers, contrarily to the other 32 32 database backends. 33 33 34 34 HowTo : 35 35 36 36 - Install SQLite v3.2.1 or higher, and its development files, 37 37 for example on my Debian box : 38 38 39 39 # apt-get install sqlite3 libsqlite3-dev 40 41 You can also download SQLite from http://www.sqlite.org 40 41 You can also download SQLite from http://www.sqlite.org 42 42 43 43 - Download and install PySQLite v2.0.5 or higher from : 44 44 45 45 http://www.pysqlite.org 46 46 … … 50 50 # cd pysqlite-2.0.5 51 51 # python setup.py install 52 52 53 53 Under Debian, if the package exists for your version of Debian, 54 54 simply do : 55 55 56 56 # apt-get install python-pysqlite2 57 57 58 58 - Create an SQLite3 database for PyKota : 59 59 … … 62 62 # chmod 660 ~pykota/pykota.db 63 63 # chown pykota.pykota ~pykota (seems to be necessary) 64 64 65 65 NB : adapt the permissions so that the user your printing 66 66 system runs as (e.g. user 'lp') can read and write 67 67 to the /etc/pykota/pykota.db file. 68 68 69 69 - In ~pykota/pykotadmin.conf, just comment out all the lines 70 70 … … 74 74 storagebackend : sqlitestorage 75 75 storagename : /etc/pykota/pykota.db 76 76 77 77 And comment out all other directives which name begins with 'storage'. 78 78 NB : feel free to use a different path to store pykota.db, and 79 79 adapt your configuration files and permissions accordingly. 80 81 Your PyKota setup is now ready to be used with an SQLite3 database. 80 81 Your PyKota setup is now ready to be used with an SQLite3 database. 82 82 83 83 IMPORTANT : with PyKota's SQLite backend there's no possibility to separate