|
|
@@ -0,0 +1,85 @@
|
|
|
+#!/bin/sh
|
|
|
+##
|
|
|
+## ripedb-setup
|
|
|
+##
|
|
|
+
|
|
|
+# determine MySQL root password
|
|
|
+password=`grep "^password" @l_prefix@/etc/mysql/my.pwd |\
|
|
|
+ sed -e 's;^password[^=]*= *;;' -e 's; *$;;'`
|
|
|
+
|
|
|
+@l_prefix@/bin/mysql --user=root --password=$password RIPEDB <<EOF
|
|
|
+CREATE TABLE reg_id (
|
|
|
+ thread_id int(11) DEFAULT '0' NOT NULL,
|
|
|
+ object_id int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ reg_id varchar(30) NOT NULL,
|
|
|
+ reg_window varchar(3) NOT NULL,
|
|
|
+ PRIMARY KEY (object_id)
|
|
|
+);
|
|
|
+CREATE TABLE reg_ref (
|
|
|
+ thread_id int(11) DEFAULT '0' NOT NULL,
|
|
|
+ object_id int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ reg_id int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ object_type tinyint(3) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ PRIMARY KEY (object_id,reg_id)
|
|
|
+);
|
|
|
+CREATE TABLE as_ref (
|
|
|
+ thread_id int(11) DEFAULT '0' NOT NULL,
|
|
|
+ object_id int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ as_id int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ object_type tinyint(3) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ PRIMARY KEY (object_id,as_id)
|
|
|
+);
|
|
|
+CREATE TABLE pop (
|
|
|
+ thread_id int(11) DEFAULT '0' NOT NULL,
|
|
|
+ object_id int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ pop varchar(80) NOT NULL,
|
|
|
+ remedyref varchar(80) NOT NULL,
|
|
|
+ PRIMARY KEY (object_id)
|
|
|
+);
|
|
|
+CREATE TABLE pop_ref (
|
|
|
+ thread_id int(11) DEFAULT '0' NOT NULL,
|
|
|
+ object_id int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ pop_id int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ object_type tinyint(3) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ PRIMARY KEY (object_id,pop_id)
|
|
|
+);
|
|
|
+CREATE TABLE ticket (
|
|
|
+ thread_id int(11) DEFAULT '0' NOT NULL,
|
|
|
+ object_id int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ ticket varchar(80) NOT NULL,
|
|
|
+ netname varchar(80) NOT NULL,
|
|
|
+ PRIMARY KEY (object_id)
|
|
|
+);
|
|
|
+CREATE TABLE purpose (
|
|
|
+ thread_id int(11) DEFAULT '0' NOT NULL,
|
|
|
+ object_id int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ purpose varchar(80) NOT NULL,
|
|
|
+ remedyref varchar(80) NOT NULL,
|
|
|
+ PRIMARY KEY (object_id)
|
|
|
+);
|
|
|
+CREATE TABLE purp_ref (
|
|
|
+ thread_id int(11) DEFAULT '0' NOT NULL,
|
|
|
+ object_id int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ purp_id int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ object_type tinyint(3) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ PRIMARY KEY (object_id,purp_id)
|
|
|
+);
|
|
|
+CREATE TABLE range (
|
|
|
+ thread_id int(11) DEFAULT '0' NOT NULL,
|
|
|
+ object_id int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ begin_in int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ end_in int(10) unsigned DEFAULT '0' NOT NULL,
|
|
|
+ netname varchar(80) NOT NULL default '',
|
|
|
+ PRIMARY KEY (object_id)
|
|
|
+);
|
|
|
+alter table range add index (netname(8));
|
|
|
+alter table range add index begin_in (begin_in);
|
|
|
+alter table range add index end_in (end_in);
|
|
|
+alter table range add index (thread_id);
|
|
|
+INSERT INTO object_order VALUES (18,24);
|
|
|
+INSERT INTO object_order VALUES (19,25);
|
|
|
+INSERT INTO object_order VALUES (20,26);
|
|
|
+INSERT INTO object_order VALUES (21,27);
|
|
|
+INSERT INTO object_order VALUES (22,28);
|
|
|
+EOF
|
|
|
+
|