|
|
@ -96,25 +96,55 @@ class Af_Sort_Bayes extends Plugin {
|
|
|
|
|
|
|
|
|
|
|
|
// PG only for the time being
|
|
|
|
// PG only for the time being
|
|
|
|
|
|
|
|
|
|
|
|
$this->dbh->query("CREATE TABLE IF NOT EXISTS ${prefix}_categories (
|
|
|
|
if (DB_TYPE == "mysql") {
|
|
|
|
id SERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
|
|
|
category varchar(100) NOT NULL DEFAULT '',
|
|
|
|
$this->dbh->query("CREATE TABLE IF NOT EXISTS ${prefix}_categories (
|
|
|
|
probability DOUBLE PRECISION NOT NULL DEFAULT '0',
|
|
|
|
id INTEGER NOT NULL PRIMARY KEY auto_increment,
|
|
|
|
owner_uid INTEGER NOT NULL REFERENCES ttrss_users(id) ON DELETE CASCADE,
|
|
|
|
category varchar(100) NOT NULL DEFAULT '',
|
|
|
|
word_count BIGINT NOT NULL DEFAULT '0')");
|
|
|
|
probability DOUBLE NOT NULL DEFAULT '0',
|
|
|
|
|
|
|
|
owner_uid INTEGER NOT NULL,
|
|
|
|
$this->dbh->query("CREATE TABLE IF NOT EXISTS ${prefix}_references (
|
|
|
|
FOREIGN KEY (owner_uid) REFERENCES ttrss_users(id) ON DELETE CASCADE,
|
|
|
|
id SERIAL NOT NULL PRIMARY KEY,
|
|
|
|
word_count BIGINT NOT NULL DEFAULT '0') ENGINE=InnoDB");
|
|
|
|
document_id VARCHAR(255) NOT NULL,
|
|
|
|
|
|
|
|
category_id INTEGER NOT NULL REFERENCES ${prefix}_categories(id) ON DELETE CASCADE,
|
|
|
|
$this->dbh->query("CREATE TABLE IF NOT EXISTS ${prefix}_references (
|
|
|
|
owner_uid INTEGER NOT NULL REFERENCES ttrss_users(id) ON DELETE CASCADE,
|
|
|
|
id INTEGER NOT NULL PRIMARY KEY auto_increment,
|
|
|
|
content text NOT NULL)");
|
|
|
|
document_id VARCHAR(255) NOT NULL,
|
|
|
|
|
|
|
|
category_id INTEGER NOT NULL,
|
|
|
|
$this->dbh->query("CREATE TABLE IF NOT EXISTS ${prefix}_wordfreqs (
|
|
|
|
FOREIGN KEY (category_id) REFERENCES ${prefix}_categories(id) ON DELETE CASCADE,
|
|
|
|
word varchar(100) NOT NULL DEFAULT '',
|
|
|
|
owner_uid INTEGER NOT NULL,
|
|
|
|
category_id INTEGER NOT NULL REFERENCES ${prefix}_categories(id) ON DELETE CASCADE,
|
|
|
|
FOREIGN KEY (owner_uid) REFERENCES ttrss_users(id) ON DELETE CASCADE,
|
|
|
|
owner_uid INTEGER NOT NULL REFERENCES ttrss_users(id) ON DELETE CASCADE,
|
|
|
|
content text NOT NULL) ENGINE=InnoDB");
|
|
|
|
count BIGINT NOT NULL DEFAULT '0')");
|
|
|
|
|
|
|
|
|
|
|
|
$this->dbh->query("CREATE TABLE IF NOT EXISTS ${prefix}_wordfreqs (
|
|
|
|
|
|
|
|
word varchar(100) NOT NULL DEFAULT '',
|
|
|
|
|
|
|
|
category_id INTEGER NOT NULL,
|
|
|
|
|
|
|
|
FOREIGN KEY (category_id) REFERENCES ${prefix}_categories(id) ON DELETE CASCADE,
|
|
|
|
|
|
|
|
owner_uid INTEGER NOT NULL,
|
|
|
|
|
|
|
|
FOREIGN KEY (owner_uid) REFERENCES ttrss_users(id) ON DELETE CASCADE,
|
|
|
|
|
|
|
|
count BIGINT NOT NULL DEFAULT '0') ENGINE=InnoDB");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$this->dbh->query("CREATE TABLE IF NOT EXISTS ${prefix}_categories (
|
|
|
|
|
|
|
|
id SERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
|
|
|
category varchar(100) NOT NULL DEFAULT '',
|
|
|
|
|
|
|
|
probability DOUBLE NOT NULL DEFAULT '0',
|
|
|
|
|
|
|
|
owner_uid INTEGER NOT NULL REFERENCES ttrss_users(id) ON DELETE CASCADE,
|
|
|
|
|
|
|
|
word_count BIGINT NOT NULL DEFAULT '0')");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->dbh->query("CREATE TABLE IF NOT EXISTS ${prefix}_references (
|
|
|
|
|
|
|
|
id SERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
|
|
|
document_id VARCHAR(255) NOT NULL,
|
|
|
|
|
|
|
|
category_id INTEGER NOT NULL REFERENCES ${prefix}_categories(id) ON DELETE CASCADE,
|
|
|
|
|
|
|
|
owner_uid INTEGER NOT NULL REFERENCES ttrss_users(id) ON DELETE CASCADE,
|
|
|
|
|
|
|
|
content text NOT NULL)");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->dbh->query("CREATE TABLE IF NOT EXISTS ${prefix}_wordfreqs (
|
|
|
|
|
|
|
|
word varchar(100) NOT NULL DEFAULT '',
|
|
|
|
|
|
|
|
category_id INTEGER NOT NULL REFERENCES ${prefix}_categories(id) ON DELETE CASCADE,
|
|
|
|
|
|
|
|
owner_uid INTEGER NOT NULL REFERENCES ttrss_users(id) ON DELETE CASCADE,
|
|
|
|
|
|
|
|
count BIGINT NOT NULL DEFAULT '0')");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$owner_uid = @$_SESSION["uid"];
|
|
|
|
$owner_uid = @$_SESSION["uid"];
|
|
|
|
|
|
|
|
|
|
|
|