[Cpan-forum-commit] rev 138 - in trunk: . bin lib/CPAN/Forum schema
svn at pti.co.il
svn at pti.co.il
Thu Mar 24 08:22:53 IST 2005
Author: gabor
Date: 2005-03-24 08:22:53 +0200 (Thu, 24 Mar 2005)
New Revision: 138
Added:
trunk/schema/
trunk/schema/schema.sql
Modified:
trunk/TODO
trunk/bin/setup.pl
trunk/lib/CPAN/Forum/DBI.pm
Log:
more schema from DBI.pm to schema.sql
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2005-03-22 22:59:38 UTC (rev 137)
+++ trunk/TODO 2005-03-24 06:22:53 UTC (rev 138)
@@ -1,12 +1,15 @@
-- Record the date when a user joined
-- Record when a user last visited
+- Enable people to subscribe to all messages or all thread starters or all followups
+ A table called "subscription_all"
-- Enable people to subscribe to all messages or all thread starters or all followups
- (probably group = 0 will do it)
+
+
+- Script that populates databse should not lock the whole database for a long time
+ Maybe it should fetch all the data to memory and work there.
+
- Add announcement service (check for new versions of modules and send e-mail
to those whom are interested in announcements.
For example I just tried to install a module but it failed its test. Checking
@@ -17,24 +20,20 @@
it is hot. I can subscribe to the announcement service of this module and get
the message.
+- Announcment service for new modules (modules that appear on CPAN for the first time)
+ For this I n
+
+- Include the information received from cpanratings in our database:
+ For each "group" add two fields: "ratings" and "review_count"
+
+- Register the PAUSEID where the module was last seen:
+ Send out e-mail about PAUSEID changes
-- Put time ellapsed since post instead of date of post, (3 min. 6 hours 3 days ago)
- make this configurabel: User can say after N days passed the date should show,
- before that the ellapsed time
-
-- Admin: hide a posting
-- Admin: delete a user
-- Script that populates databse should not lock the whole database for a long time
- Maybe it should fetch all the data to memory and work there.
+ A table called "subscription_PAUSE"
-- replace the e-mail address checking by if ($q->param('email') !~ $Email::Address::addr_spec) {
-- Enable people to edit their posts
- - Shall we track changes ?
- - Shall we display the orinal date and the last update date ?
- - Shall we display the post on its new date (order the display result by date ?)
- Somehow let a module author (or anyone ?) subscribe/unsubscribe to all of her
current and future(!) modules.
@@ -46,9 +45,37 @@
So especially the module authors would like to have a button that sais
subscribe too all the modules of XYZ
+- A way to monitor all current and future modules associated with a certain PAUSE ID.
+ (both RSS and e-mail)
+
- Let people select a group of distros (e.g. all the distros by author SZABGAB)
and show them on the /mypan interface (or just subscribe to all of them)
+
+
+
+
+- Create larger discussion groups (e.g. Web development and All)
+
+
+
+- Record the date when a user joined
+- Record when a user last visited
+
+- Put time ellapsed since post instead of date of post, (3 min. 6 hours 3 days ago)
+ make this configurable: User can say after N days passed the date should show,
+ before that the ellapsed time
+
+- Admin: hide a posting
+
+- Admin: delete a user
+
+- replace the e-mail address checking by if ($q->param('email') !~ $Email::Address::addr_spec) {
+
+- Enable people to edit their posts
+ - Shall we track changes ?
+ - Shall we display the orinal date and the last update date ?
+ - Shall we display the post on its new date (order the display result by date ?)
- Improve the markup language
- Enable module authors (or some other volunteer) to configure some aspects of the
@@ -56,7 +83,6 @@
- Posting a message under more than one distribution
-- Create larger discussion groups (e.g. Web development and All)
- Get a nice logo and favicon.ico
@@ -75,7 +101,6 @@
- Enable sending direct mail to a poster (?) (without disclosing e-mail address)
- Better integration with search.cpan.org, cpanratings.perl.org
- Fetch data from cpanratings and display
Provide statistics on number of comments per distro to be displayed on search.cpan
- Admin: hide a message (or a whole thread) (database already has field)
@@ -117,9 +142,7 @@
4) Add a field to the session table where I indicate the last access time
-- A way to monitor all current and future modules associated with a certain PAUSE ID.
- (both RSS and e-mail)
-
+
- check out the remote authentication module of David Nicol: AIS::Client
and its server.
Modified: trunk/bin/setup.pl
===================================================================
--- trunk/bin/setup.pl 2005-03-22 22:59:38 UTC (rev 137)
+++ trunk/bin/setup.pl 2005-03-24 06:22:53 UTC (rev 138)
@@ -34,7 +34,7 @@
unlink $dbfile if -e $dbfile;
mkdir $dir if not -e $dir;
CPAN::Forum::DBI->myinit($dbfile);
-CPAN::Forum::DBI->init_db($dbfile);
+CPAN::Forum::DBI->init_db("$Bin/../schema/schema.sql", $dbfile);
chmod 0755, $dbfile;
Modified: trunk/lib/CPAN/Forum/DBI.pm
===================================================================
--- trunk/lib/CPAN/Forum/DBI.pm 2005-03-22 22:59:38 UTC (rev 137)
+++ trunk/lib/CPAN/Forum/DBI.pm 2005-03-24 06:22:53 UTC (rev 138)
@@ -23,13 +23,14 @@
# Initialize the database
sub init_db {
- my $class = shift;
- my $dbfile = shift;
+ my ($class, $schema_file, $dbfile) = @_;
+
die "No database file supplied" if not $dbfile;
my $sql;
my $dbh = $class->db_Main;
- $sql = join('', <DATA>);
+ open my $data, "<", $schema_file or die "Coult no open '$schema_file' $!\n";
+ $sql = join('', <$data>);
for my $statement (split /;/, $sql) {
if ($dbh->{Driver}{Name} =~ /SQLite/) {
@@ -47,117 +48,4 @@
}
1;
-__DATA__
-CREATE TABLE users (
- id INTEGER PRIMARY KEY auto_increment,
- username VARCHAR(255) UNIQUE,
- password VARCHAR(255),
- email VARCHAR(255) UNIQUE,
- fname VARCHAR(255),
- lname VARCHAR(255),
- update_on_new_user VARCHAR(1),
- status INTEGER
--- registration_date
--- last_seen
--- locaton
--- user_localtime
--- scratch_pad
-);
-
-CREATE TABLE usergroups (
- id INTEGER PRIMARY KEY auto_increment,
- name VARCHAR(255) UNIQUE
-);
-
-CREATE TABLE user_in_group (
- uid INTEGER,
- gid INTEGER
-);
-
-CREATE TABLE configure (
- field VARCHAR(255),
- value VARCHAR(255)
-);
-
-
---CREATE TABLE grouptypes (
--- id INTEGER PRIMARY KEY auto_increment,
--- name VARCHAR(255) NOT NULL
---);
--- grouptypes can be Global/Distribution/Field
-
-
-
-CREATE TABLE groups (
- id INTEGER PRIMARY KEY auto_increment,
- name VARCHAR(255) UNIQUE NOT NULL,
- status INTEGER,
- gtype INTEGER NOT NULL
-);
-
-CREATE TABLE metagroups (
- id INTEGER PRIMARY KEY auto_increment,
- name VARCHAR(255) UNIQUE NOT NULL,
- status INTEGER,
-);
-
-CREATE TABLE group_in_meta (
- meta INTEGER NOT NULL,
- group INTEGER NOT NULL
- ,FOREIGN KEY (meta) REFERENCES metagroups(id)
- ,FOREIGN KEY (group) REFERENCES groups(id)
-);
-
-
-
-CREATE TABLE grouprelations (
- parent INTEGER NOT NULL,
- child INTEGER NOT NULL
- ,FOREIGN KEY (parent) REFERENCES groups(id)
- ,FOREIGN KEY (child) REFERENCES groups(id)
-);
-
--- grouprelations defined which group belongs to which other group,
--- In the application level we'll have to implement the restriction so
--- Global group will have no parent
--- Fields will have Global as parent
--- Distributions will have Fields as parent one child can have several parents
--- Modules (if added) will have Distributions as parents
-
-
-CREATE TABLE posts (
- id INTEGER PRIMARY KEY auto_increment,
- gid INTEGER NOT NULL,
- uid INTEGER NOT NULL,
- parent INTEGER,
- thread INTEGER,
- hidden BOOLEAN,
- subject VARCHAR(255) NOT NULL,
- text VARCHAR(100000) NOT NULL,
- date TIMESTAMP
- ,FOREIGN KEY (gid) REFERENCES groups(id)
- ,FOREIGN KEY (uid) REFERENCES users(id)
- ,FOREIGN KEY (parent) REFERENCES posts(id)
-);
-
-CREATE TABLE subscriptions (
- id INTEGER PRIMARY KEY auto_increment,
- uid INTEGER NOT NULL,
- gid INTEGER NOT NULL,
- allposts BOOLEAN,
- starters BOOLEAN,
- followups BOOLEAN,
- announcements BOOLEAN
- ,FOREIGN KEY (gid) REFERENCES groups(id)
- ,FOREIGN KEY (uid) REFERENCES users(id)
-);
-
-CREATE TABLE sessions (
- id CHAR(32) NOT NULL UNIQUE,
- a_session TEXT NOT NULL,
- uid INTEGER
-);
-
-
-
Added: trunk/schema/schema.sql
===================================================================
--- trunk/schema/schema.sql 2005-03-22 22:59:38 UTC (rev 137)
+++ trunk/schema/schema.sql 2005-03-24 06:22:53 UTC (rev 138)
@@ -0,0 +1,143 @@
+CREATE TABLE users (
+ id INTEGER PRIMARY KEY auto_increment,
+ username VARCHAR(255) UNIQUE,
+ password VARCHAR(255),
+ email VARCHAR(255) UNIQUE,
+ fname VARCHAR(255),
+ lname VARCHAR(255),
+ update_on_new_user VARCHAR(1),
+ status INTEGER
+-- registration_date
+-- last_seen
+-- locaton
+-- user_localtime
+-- scratch_pad
+
+);
+
+CREATE TABLE usergroups (
+ id INTEGER PRIMARY KEY auto_increment,
+ name VARCHAR(255) UNIQUE
+);
+
+CREATE TABLE user_in_group (
+ uid INTEGER,
+ gid INTEGER
+);
+
+CREATE TABLE configure (
+ field VARCHAR(255),
+ value VARCHAR(255)
+);
+
+
+--CREATE TABLE grouptypes (
+-- id INTEGER PRIMARY KEY auto_increment,
+-- name VARCHAR(255) NOT NULL
+--);
+-- grouptypes can be Global/Distribution/Field
+
+
+
+CREATE TABLE groups (
+ id INTEGER PRIMARY KEY auto_increment,
+ name VARCHAR(255) UNIQUE NOT NULL,
+ status INTEGER,
+ gtype INTEGER NOT NULL
+);
+
+CREATE TABLE metagroups (
+ id INTEGER PRIMARY KEY auto_increment,
+ name VARCHAR(255) UNIQUE NOT NULL,
+ status INTEGER
+);
+
+CREATE TABLE group_in_meta (
+ mgid INTEGER NOT NULL,
+ gid INTEGER NOT NULL
+ ,FOREIGN KEY (mgid) REFERENCES metagroups(id)
+ ,FOREIGN KEY (gid) REFERENCES groups(id)
+);
+
+
+
+CREATE TABLE grouprelations (
+ parent INTEGER NOT NULL,
+ child INTEGER NOT NULL
+ ,FOREIGN KEY (parent) REFERENCES groups(id)
+ ,FOREIGN KEY (child) REFERENCES groups(id)
+);
+
+-- grouprelations defined which group belongs to which other group,
+-- In the application level we'll have to implement the restriction so
+-- Global group will have no parent
+-- Fields will have Global as parent
+-- Distributions will have Fields as parent one child can have several parents
+-- Modules (if added) will have Distributions as parents
+
+
+CREATE TABLE posts (
+ id INTEGER PRIMARY KEY auto_increment,
+ gid INTEGER NOT NULL,
+ uid INTEGER NOT NULL,
+ parent INTEGER,
+ thread INTEGER,
+ hidden BOOLEAN,
+ subject VARCHAR(255) NOT NULL,
+ text VARCHAR(100000) NOT NULL,
+ date TIMESTAMP
+ ,FOREIGN KEY (gid) REFERENCES groups(id)
+ ,FOREIGN KEY (uid) REFERENCES users(id)
+ ,FOREIGN KEY (parent) REFERENCES posts(id)
+);
+
+CREATE TABLE authors (
+ id INTEGER PRIMARY KEY auto_increment,
+ pauseid VARCHAR(100)
+);
+
+
+CREATE TABLE subscriptions (
+ id INTEGER PRIMARY KEY auto_increment,
+ uid INTEGER NOT NULL,
+ gid INTEGER NOT NULL,
+ allposts BOOLEAN,
+ starters BOOLEAN,
+ followups BOOLEAN,
+ announcements BOOLEAN
+ ,FOREIGN KEY (gid) REFERENCES groups(id)
+ ,FOREIGN KEY (uid) REFERENCES users(id)
+);
+
+CREATE TABLE subscriptions_all (
+ id INTEGER PRIMARY KEY auto_increment,
+ uid INTEGER NOT NULL,
+ allposts BOOLEAN,
+ starters BOOLEAN,
+ followups BOOLEAN,
+ announcements BOOLEAN
+ ,FOREIGN KEY (uid) REFERENCES users(id)
+);
+
+CREATE TABLE subscriptions_pauseid (
+ id INTEGER PRIMARY KEY auto_increment,
+ uid INTEGER NOT NULL,
+ pauseid INTEGER NOT NULL,
+ allposts BOOLEAN,
+ starters BOOLEAN,
+ followups BOOLEAN,
+ announcements BOOLEAN
+ ,FOREIGN KEY (gid) REFERENCES groups(id)
+ ,FOREIGN KEY (uid) REFERENCES users(id)
+);
+
+
+
+CREATE TABLE sessions (
+ id CHAR(32) NOT NULL UNIQUE,
+ a_session TEXT NOT NULL,
+ uid INTEGER
+);
+
+
+
More information about the Cpan-forum-commit
mailing list