]> git.imager.perl.org - bse.git/blame - schema/bse.sql
0.15_50 commit
[bse.git] / schema / bse.sql
CommitLineData
41b9d8ec 1-- represents sections, articles
a051492d 2DROP TABLE IF EXISTS article;
41b9d8ec 3CREATE TABLE article (
85802bd5 4 id integer NOT NULL auto_increment,
41b9d8ec
TC
5
6 -- 0 for the entry page
7 -- -1 for top-level sections (shown in side menu)
8 parentid integer DEFAULT '0' NOT NULL,
9
10 -- the order to display articles in
11 -- used for ordering sibling articles
12 displayOrder integer not NULL default 0,
6e3d2da5 13 title varchar(255) DEFAULT '' NOT NULL,
41b9d8ec
TC
14 titleImage varchar(64) not null,
15 body text NOT NULL,
16
17 -- thumbnail image
18 thumbImage varchar(64) not null default '',
19 thumbWidth integer not null,
20 thumbHeight integer not null,
21
22 -- position of first image for this article
23 imagePos char(2) not null,
24 release datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
25 expire datetime DEFAULT '9999-12-31 23:59:59' NOT NULL,
d44b5da9 26 keyword varchar(255) not null default '',
41b9d8ec
TC
27
28 -- the template in $TMPLDIR used to generate this as HTML
29 template varchar(127) DEFAULT '' NOT NULL,
30
31 -- a link to the page generated for this article
32 -- if this is blank then no page is generated
33 -- this is combined with the base of the site to get the file
34 -- written to during generation
63e99d77 35 link varchar(255) not null,
41b9d8ec
TC
36 admin varchar(64) not null,
37
38 -- if there are more child articles than this, display links/summaries
39 -- if the same of fewer, embed the articles
40 -- the template can ignore this
41 threshold integer not null default 3,
42
43 -- the length of summary to display for this article
44 summaryLength smallint(5) unsigned DEFAULT '200' NOT NULL,
45
46 -- the class whose generate() method generates the page
37dd20ad 47 generator varchar(40) not null default 'article',
41b9d8ec
TC
48
49 -- the level of the article, 1 for top-level
50 level smallint not null,
51
52 -- for listed:
53 -- 0 - don't list
54 -- 1 - list everywhere
55 -- 2 - list in sections, but not on the menu
56 listed smallint not null default 1,
57 -- date last modified
41f10371 58 lastModified datetime not null,
918735d1
TC
59
60 -- flags specified via the config file
61 -- used by code and templates
62 flags varchar(80) not null default '',
63
331fd099
TC
64 -- custom fields for local usage
65 customDate1 datetime null,
66 customDate2 datetime null,
67
68 customStr1 varchar(255) null,
69 customStr2 varchar(255) null,
70
9063386f
TC
71 customInt1 integer null,
72 customInt2 integer null,
73 customInt3 integer null,
74 customInt4 integer null,
75
9604a90c
TC
76 -- added by adrian
77 lastModifiedBy varchar(60) default '' not null,
78 created datetime default '0000-00-00 00:00:00' not null,
79 createdBy varchar(60) default '' not null,
80 author varchar(255) default '' not null,
81 pageTitle varchar(255) default '' not null,
82
efcc5a30
TC
83 force_dynamic integer not null default 0,
84 cached_dynamic integer not null default 0,
85 inherit_siteuser_rights integer not null default 1,
86
12bcb7ac
TC
87 metaDescription varchar(255) default '' not null,
88 metaKeywords varchar(255) default '' not null,
89
41b9d8ec
TC
90 PRIMARY KEY (id),
91
92 -- if we keep id in the indexes MySQL will sometimes be able to
93 -- perform a query using _just_ the index, without scanning through
94 -- all our main records with their blobs
95 -- Unfortunately MySQL can only do this on fixed-width columns
96 -- other databases may not need the id in the index, and may also be
97 -- able to handle the variable length columns in the index
98 INDEX article_date_index (release,expire, id),
99 INDEX article_displayOrder_index (displayOrder),
100 INDEX article_parentId_index (parentId),
101 INDEX article_level_index (level, id)
102);
103
104#
105# Table structure for table 'searchindex'
106#
a051492d
TC
107
108DROP TABLE IF EXISTS searchindex;
41b9d8ec 109CREATE TABLE searchindex (
85802bd5 110 id varbinary(200) DEFAULT '' NOT NULL,
41b9d8ec
TC
111 -- a comma-separated lists of article and section ids
112 articleIds varchar(255) default '' not null,
113 sectionIds varchar(255) default '' not null,
114 scores varchar(255) default '' not null,
115 PRIMARY KEY (id)
116);
117
118#
119# Table structure for table 'image'
120#
a051492d 121DROP TABLE IF EXISTS image;
41b9d8ec
TC
122CREATE TABLE image (
123 id mediumint(8) unsigned NOT NULL auto_increment,
124 articleId integer not null,
125 image varchar(64) DEFAULT '' NOT NULL,
126 alt varchar(255) DEFAULT '[Image]' NOT NULL,
127 width smallint(5) unsigned,
128 height smallint(5) unsigned,
6dc52c17 129 url varchar(255),
ca9aa2bf 130 displayOrder integer not null default 0,
4772671f 131 name varchar(255) default '' not null,
6dc52c17 132
41b9d8ec
TC
133 PRIMARY KEY (id)
134);
135
136# used for session tracking with Apache::Session::MySQL
a051492d 137DROP TABLE IF EXISTS sessions;
41b9d8ec
TC
138CREATE TABLE sessions (
139 id char(32) not null primary key,
140 a_session text,
141 -- so we can age this table
142 whenChanged timestamp
143);
144
145-- these share data with the article table
a051492d 146DROP TABLE IF EXISTS product;
41b9d8ec
TC
147create table product (
148 -- fkey to article id
149 articleId integer not null,
150
151 summary varchar(255) not null,
152
153 -- number of days it typically takes to supply this item
154 leadTime integer not null default 0,
155
156 -- prices are in cents
157 retailPrice integer not null,
158 wholesalePrice integer,
159
160 -- amount of GST on this item
161 gst integer not null,
6dc52c17
TC
162
163 -- options that can be specified for this product
164 options varchar(255) not null,
0ec4ac8a
TC
165
166 subscription_id integer not null default -1,
167 subscription_period integer not null default 0,
168 subscription_usage integer not null default 3,
169 subscription_required integer not null default -1,
41b9d8ec
TC
170
171 primary key(articleId)
172);
173
174-- order is a reserved word
175-- I couldn't think of/find another word here
a051492d 176DROP TABLE IF EXISTS orders;
41b9d8ec
TC
177create table orders (
178 id integer not null auto_increment,
179
180 -- delivery address
181 delivFirstName varchar(127) not null default '',
182 delivLastName varchar(127) not null default '',
183 delivStreet varchar(127) not null default '',
184 delivSuburb varchar(127) not null default '',
185 delivState varchar(40) not null default '',
186 delivPostCode varchar(40) not null default '',
187 delivCountry varchar(127) not null default 'Australia',
188
189 -- billing address
190 billFirstName varchar(127) not null default '',
191 billLastName varchar(127) not null default '',
192 billStreet varchar(127) not null default '',
193 billSuburb varchar(127) not null default '',
194 billState varchar(40) not null default '',
195 billPostCode varchar(40) not null default '',
196 billCountry varchar(127) not null default 'Australia',
197
198 telephone varchar(80) not null default '',
199 facsimile varchar(80) not null default '',
200 emailAddress varchar(255) not null default '',
201
202 -- total price
203 total integer not null,
204 wholesaleTotal integer not null default 0,
205 gst integer not null,
206
207 orderDate datetime not null,
208
209 -- credit card information
210 ccNumberHash varchar(127) not null default '',
211 ccName varchar(127) not null default '',
212 ccExpiryHash varchar(127) not null default '',
213 ccType varchar(30) not null,
214
6dc52c17
TC
215 -- non-zero if the order was filled
216 filled integer not null default 0,
217 whenFilled datetime,
218 whoFilled varchar(40) not null default '',
219
220 -- if the order has been paid for
221 paidFor integer not null default 0,
222 paymentReceipt varchar(40),
223
224 -- hard to guess identifier
225 randomId varchar(40),
226
227 -- order was cancelled
228 cancelled integer not null default 0,
229
edc5d096
TC
230 -- user id of the person who made the order
231 -- an empty string if there's no user
232 userId varchar(40) not null,
233
08123550
TC
234 paymentType integer not null default 0,
235
236 -- intended for custom uses
237 customInt1 integer null,
238 customInt2 integer null,
239 customInt3 integer null,
240 customInt4 integer null,
241 customInt5 integer null,
242
243 customStr1 varchar(255) null,
244 customStr2 varchar(255) null,
245 customStr3 varchar(255) null,
246 customStr4 varchar(255) null,
247 customStr5 varchar(255) null,
248
9063386f
TC
249 instructions text not null default '',
250 billTelephone varchar(80) not null default '',
251 billFacsimile varchar(80) not null default '',
252 billEmail varchar(255) not null default '',
253
0ec4ac8a
TC
254 siteuser_id integer,
255 affiliate_code varchar(40) not null default '',
256
257 shipping_cost integer not null default 0,
258
e3d242f7
TC
259 delivMobile varchar(80) not null default '',
260 billMobile varchar(80) not null default '',
261
41e7c841
TC
262 -- information from online credit card processing
263 -- non-zero if we did online CC processing
264 ccOnline integer not null default 0,
265 -- non-zero if processing was successful
266 ccSuccess integer not null default 0,
267 -- receipt number
268 ccReceipt varchar(80) not null default '',
269 -- main status code (value depends on driver)
270 ccStatus integer not null default 0,
271 ccStatusText varchar(80) not null default '',
272 -- secondary status code (if any)
273 ccStatus2 integer not null default 0,
274 -- card processor transaction identifier
275 -- the ORDER_NUMBER for Inpho
276 ccTranId varchar(40) not null default '',
277
5d88571c
TC
278 -- order was completed by the customer
279 complete integer not null default 1,
280
37dd20ad
TC
281 delivOrganization varchar(127) not null default '',
282 billOrganization varchar(127) not null default '',
283
284 delivStreet2 varchar(127) not null default '',
285 billStreet2 varchar(127) not null default '',
286
41b9d8ec 287 primary key (id),
edc5d096
TC
288 index order_cchash(ccNumberHash),
289 index order_userId(userId, orderDate)
41b9d8ec
TC
290);
291
a051492d 292DROP TABLE IF EXISTS order_item;
41b9d8ec
TC
293create table order_item (
294 id integer not null auto_increment,
295 -- foreign key to product
296 productId integer not null,
297
298 -- foreign key to order
299 orderId integer not null,
300
301 -- how many :)
302 units integer not null,
303
304 -- unit prices
305 price integer not null,
306 wholesalePrice integer not null,
307 gst integer not null,
308
6dc52c17
TC
309 -- options (if any) specified on this item in the order
310 options varchar(255) not null,
311
81f3292d
TC
312 customInt1 integer null,
313 customInt2 integer null,
314 customInt3 integer null,
315
316 customStr1 varchar(255) null,
317 customStr2 varchar(255) null,
318 customStr3 varchar(255) null,
319
0ec4ac8a
TC
320 -- transferred from the product
321 title varchar(255) not null default '',
322 summary varchar(255) not null default '',
323 subscription_id integer not null default -1,
324 subscription_period integer not null default 0,
325
af74f0b4
TC
326 -- transferred from the subscription
327 max_lapsed integer not null default 0,
328
718a070d
TC
329 -- session for a seminar
330 session_id integer not null default -1,
331
41b9d8ec
TC
332 primary key (id),
333 index order_item_order(orderId, id)
334);
aaf38b76
TC
335
336drop table if exists other_parents;
337create table other_parents (
338 id integer not null auto_increment,
339
340 parentId integer not null,
341 childId integer not null,
342
343 -- order as seen from the parent
344 parentDisplayOrder integer not null,
345 -- order as seen from the child
346 childDisplayOrder integer not null,
347
99ef7979
TC
348 release datetime default '0000-00-00 00:00:00' not null,
349 expire datetime default '9999-12-31 23:59:59' not null,
350
aaf38b76
TC
351 primary key(id),
352 unique (parentId, childId),
99ef7979 353 index (childId, childDisplayOrder)
edc5d096
TC
354);
355
356-- initially we just do paid for files, later we may add unpaid for files
357-- there's some database support here to support unpaid for files
358-- but it won't be implemented yet
359drop table if exists article_files;
360create table article_files (
361 id integer not null auto_increment,
362 articleId integer not null,
363
364 -- the name of the file as displayed
365 displayName varchar(80) not null default '',
366
367 -- the filename as stored in the repository
368 filename varchar(80) not null default '',
369
370 -- how big it is
371 sizeInBytes integer not null,
372
373 -- a description of the file
374 description varchar(255) not null default '',
375
376 -- content type
377 contentType varchar(80) not null default 'application/octet-stream',
378
379 -- used to control the order the files are displayed in
380 displayOrder integer not null,
381
382 -- if non-zero this item is for sale
383 -- it has no public URL and can only be downloaded via a script
384 forSale integer not null default 0,
385
386 -- we try to make the browser download the file rather than display it
387 download integer not null default 0,
388
389 -- when it was uploaded
390 whenUploaded datetime not null,
391
4afdbb1b
TC
392 -- user must be logged in to download this file
393 requireUser integer not null default 0,
394
3f69022d
TC
395 -- more descriptive stuff
396 notes text not null default '',
397
c5286ebe
TC
398 -- identifier for the file for use with filelink[]
399 name varchar(80) not null default '',
400
b8e8b584
TC
401 hide_from_list integer not null default 0,
402
edc5d096
TC
403 primary key (id)
404);
405
0ec4ac8a 406-- these are mailing list subscriptions
b19047a6
TC
407drop table if exists subscription_types;
408create table subscription_types (
409 id integer not null auto_increment,
410
411 -- name as listed to users on the user options page, and as listed
412 -- on the subscriptions management page
413 name varchar(80) not null,
414
415 -- the default title put into the article, and used for the article title
416 -- field when generating the article
417 title varchar(64) not null,
418
419 -- a description for the subscription
420 -- used on user options page to give more info about a subscription
421 description text not null,
422
423 -- description of the frequency of subscriptions
424 -- eg. "weekly", "Every Monday and Thursday"
425 frequency varchar(127) not null,
426
427 -- keyword field for the generated article
428 keyword varchar(255) not null,
429
430 -- do we archive the email to an article?
431 archive integer not null default 1,
432
433 -- template used when we build the article
434 article_template varchar(127) not null,
435
436 -- one or both of the following template needs to be defined
437 -- if you only define the html template then the email won't be sent
438 -- to users who only accept text emails
439 -- template used for the HTML portion of the email
440 html_template varchar(127) not null,
441
442 -- template used for the text portion of the email
443 text_template varchar(127) not null,
444
445 -- which parent to put the generated article under
446 -- can be 0 to indicate no article is generated
447 parentId integer not null,
448
449 -- the last time this was sent out
450 lastSent datetime not null default '0000-00-00 00:00',
4ef01459
TC
451
452 -- if this is non-zero then the subscription is visible to users
453 visible integer not null default 1,
b19047a6
TC
454
455 primary key (id)
456);
457
458-- which lists users are subscribed to
459drop table if exists subscribed_users;
460create table subscribed_users (
461 id integer not null auto_increment,
462 subId integer not null,
463 userId integer not null,
464 primary key(id),
465 unique (subId, userId)
466);
467
edc5d096
TC
468-- contains web site users
469-- there will be a separate admin users table at some point
470drop table if exists site_users;
471create table site_users (
472 id integer not null auto_increment,
473
474 userId varchar(40) not null,
475 password varchar(40) not null,
35c0719f 476 email varchar(255) not null,
edc5d096
TC
477
478 keepAddress integer not null default 1,
479 whenRegistered datetime not null,
480 lastLogon datetime not null,
481
482 -- used to fill in the checkout form
483 name1 varchar(127),
484 name2 varchar(127),
485 address varchar(127),
486 city varchar(127),
487 state varchar(40),
488 postcode varchar(40),
489 telephone varchar(80),
490 facsimile varchar(80),
491 country varchar(127),
492
493 -- the user wants to receive the site newsletter if any
494 -- this should default to NO
b19047a6 495 -- this is probably ignored for now
edc5d096
TC
496 wantLetter integer not null default 0,
497
b19047a6
TC
498 -- if this is non-zero, we have permission to send email to this
499 -- user
500 confirmed integer not null default 0,
501
502 -- the confirmation message we send to a user includes this value
503 -- in the confirmation url
504 confirmSecret varchar(40) not null default '',
505
506 -- non-zero if we sent a confirmation message
507 waitingForConfirmation integer not null default 0,
508
509 textOnlyMail integer not null,
510
35c0719f 511 title varchar(127),
b19047a6
TC
512 organization varchar(127),
513
514 referral integer,
515 otherReferral varchar(127) not null,
516 prompt integer,
517 otherPrompt varchar(127) not null,
518 profession integer not null,
519 otherProfession varchar(127) not null,
520
15fb10f2
TC
521 previousLogon datetime not null,
522
9063386f
TC
523 -- used for billing information on the checkout form
524 billFirstName varchar(127) not null default '',
525 billLastName varchar(127) not null default '',
526 billStreet varchar(127) not null default '',
527 billSuburb varchar(127) not null default '',
528 billState varchar(40) not null default '',
529 billPostCode varchar(40) not null default '',
530 billCountry varchar(127) not null default '',
531
532 instructions text not null default '',
533 billTelephone varchar(80) not null default '',
534 billFacsimile varchar(80) not null default '',
535 billEmail varchar(255) not null default '',
536
537 adminNotes text not null default '',
538
539 disabled integer not null default 0,
540
d49f56a6
TC
541 flags varchar(80) not null default '',
542
4175638b
TC
543 customText1 text,
544 customText2 text,
545 customText3 text,
546 customStr1 varchar(255),
547 customStr2 varchar(255),
548 customStr3 varchar(255),
549
dfdeb4fe
TC
550 affiliate_name varchar(40) not null default '',
551
e3d242f7
TC
552 delivMobile varchar(80) not null default '',
553 billMobile varchar(80) not null default '',
554
37dd20ad
TC
555 delivStreet2 varchar(127) not null default '',
556 billStreet2 varchar(127) not null default '',
557
558 billOrganization varchar(127) not null default '',
559
edc5d096 560 primary key (id),
dfdeb4fe
TC
561 unique (userId),
562 index (affiliate_name)
b19047a6
TC
563);
564
565-- this is used to track email addresses that we've sent subscription
566-- confirmations to
567-- this is used to prevent an attacked creating a few hundred site users
568-- and having the system send confirmation requests to those users
569-- we make sure we only send one confirmation request per 48 hours
570-- and a maximum of 3 unacknowledged confirmation requests
571-- once the 3rd confirmation request is sent we don't send the user
572-- any more requests - ever
573--
574-- each confirmation message also includes a blacklist address the
575-- recipient can use to add themselves to the blacklist
576--
577-- We don't have an unverified mechanism to add users to the blacklist
578-- since someone could use this as a DoS.
579--
580-- Once we receive an acknowledgement from the recipient we remove them
581-- from this table.
582drop table if exists email_requests;
583create table email_requests (
584 -- the table/row classes need this for now
585 id integer not null auto_increment,
586
587 # the actual email address the confirmation was sent to
588 email varchar(127) not null,
589
590 # the genericized email address
591 genEmail varchar(127) not null,
592
593 -- when the last confirmation email was sent
594 lastConfSent datetime not null default '0000-00-00 00:00:00',
595
596 -- how many confirmation messages have been sent
597 unackedConfMsgs integer not null default 0,
598
599 primary key (id),
600 unique (email),
601 unique (genEmail)
602);
603
604-- these are emails that someone has asked not to be subscribed to
605-- any mailing list
606drop table if exists email_blacklist;
607create table email_blacklist (
608 -- the table/row classes need this for now
609 id integer not null auto_increment,
610 email varchar(127) not null,
611
612 -- a short description of why the address was blacklisted
2a295ea9 613 why varchar(80) not null,
b19047a6
TC
614
615 primary key (id),
616 unique (email)
caa7299c
TC
617);
618
619drop table if exists admin_base;
620create table admin_base (
621 id integer not null auto_increment,
622 type char not null,
623 primary key (id)
624);
625
626drop table if exists admin_users;
627create table admin_users (
628 base_id integer not null,
629 logon varchar(60) not null,
630 name varchar(255) not null,
631 password varchar(80) not null,
632 perm_map varchar(255) not null,
633 primary key (base_id),
634 unique (logon)
635);
636
637drop table if exists admin_groups;
638create table admin_groups (
639 base_id integer not null,
640 name varchar(80) not null,
641 description varchar(255) not null,
642 perm_map varchar(255) not null,
4d764c34 643 template_set varchar(80) not null default '',
caa7299c
TC
644 primary key (base_id),
645 unique (name)
646);
647
648drop table if exists admin_membership;
649create table admin_membership (
650 user_id integer not null,
651 group_id integer not null,
652 primary key (user_id, group_id)
653);
654
655drop table if exists admin_perms;
656create table admin_perms (
657 object_id integer not null,
658 admin_id integer not null,
659 perm_map varchar(255),
660 primary key (object_id, admin_id)
661);
0ec4ac8a
TC
662
663-- -- these are "product" subscriptions
af74f0b4
TC
664drop table if exists bse_subscriptions;
665create table bse_subscriptions (
666 subscription_id integer not null auto_increment primary key,
0ec4ac8a 667
af74f0b4 668 text_id varchar(20) not null,
0ec4ac8a 669
af74f0b4 670 title varchar(255) not null,
0ec4ac8a 671
af74f0b4 672 description text not null,
0ec4ac8a 673
af74f0b4 674 max_lapsed integer not null,
0ec4ac8a 675
af74f0b4
TC
676 unique (text_id)
677);
0ec4ac8a 678
af74f0b4
TC
679drop table if exists bse_user_subscribed;
680create table bse_user_subscribed (
681 subscription_id integer not null,
682 siteuser_id integer not null,
683 started_at date not null,
684 ends_at date not null,
685 max_lapsed integer not null,
686 primary key (subscription_id, siteuser_id)
687);
0ec4ac8a 688
dfdeb4fe
TC
689drop table if exists bse_siteuser_images;
690create table bse_siteuser_images (
691 siteuser_id integer not null,
692 image_id varchar(20) not null,
693 filename varchar(80) not null,
694 width integer not null,
695 height integer not null,
696 bytes integer not null,
697 content_type varchar(80) not null,
698 alt varchar(255) not null,
699
700 primary key(siteuser_id, image_id)
701);
702
37dd20ad
TC
703drop table if exists bse_locations;
704create table bse_locations (
705 id integer not null auto_increment,
706 description varchar(255) not null,
707 room varchar(40) not null,
708 street1 varchar(255) not null,
709 street2 varchar(255) not null,
710 suburb varchar(255) not null,
711 state varchar(80) not null,
712 country varchar(80) not null,
713 postcode varchar(40) not null,
714 public_notes text not null,
715
716 bookings_name varchar(80) not null,
717 bookings_phone varchar(80) not null,
718 bookings_fax varchar(80) not null,
719 bookings_url varchar(255) not null,
720 facilities_name varchar(255) not null,
721 facilities_phone varchar(80) not null,
722
723 admin_notes text not null,
724
725 disabled integer not null default 0,
726
727 primary key(id)
728);
729
730drop table if exists bse_seminars;
731create table bse_seminars (
732 seminar_id integer not null primary key,
733 duration integer not null
734);
735
736drop table if exists bse_seminar_sessions;
737create table bse_seminar_sessions (
738 id integer not null auto_increment,
739 seminar_id integer not null,
740 location_id integer not null,
741 when_at datetime not null,
16ac5598 742 roll_taken integer not null default 0,
37dd20ad
TC
743
744 primary key (id),
745 unique (seminar_id, location_id, when_at),
746 index (seminar_id),
747 index (location_id)
748);
749
16ac5598
TC
750drop table if exists bse_seminar_bookings;
751create table bse_seminar_bookings (
11c35ec9 752 id integer not null auto_increment primary key,
16ac5598
TC
753 session_id integer not null,
754 siteuser_id integer not null,
755 roll_present integer not null default 0,
756
2076966c
TC
757 options varchar(255) not null default '',
758 customer_instructions text not null default '',
759 support_notes text not null default '',
760
11c35ec9 761 unique(session_id, siteuser_id),
16ac5598
TC
762 index (siteuser_id)
763);
efcc5a30
TC
764
765drop table if exists bse_siteuser_groups;
766create table bse_siteuser_groups (
767 id integer not null auto_increment primary key,
768 name varchar(80) not null
769);
770
771drop table if exists bse_siteuser_membership;
772create table bse_siteuser_membership (
773 group_id integer not null,
774 siteuser_id integer not null,
775 primary key(group_id, siteuser_id),
776 index(siteuser_id)
777);
c2096d67
TC
778
779drop table if exists bse_article_groups;
780create table bse_article_groups (
781 article_id integer not null,
782 group_id integer not null,
783 primary key (article_id, group_id)
784);
785
786drop table if exists sql_statements;
787create table sql_statements (
788 name varchar(80) not null primary key,
789 sql_statement text not null
790);
791