summaryrefslogtreecommitdiffstats
path: root/create
diff options
context:
space:
mode:
authoralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-04-16 08:20:52 +0000
committeralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-04-16 08:20:52 +0000
commitf84cd6ca7205bb7dbbd165b3d10403c8cc3cdd39 (patch)
treef69098ae96b1a5e7114d0a24b530a629009473f4 /create
parentb363df25c2acb49658d440db528774be75c85704 (diff)
downloadzabbix-f84cd6ca7205bb7dbbd165b3d10403c8cc3cdd39.tar.gz
zabbix-f84cd6ca7205bb7dbbd165b3d10403c8cc3cdd39.tar.xz
zabbix-f84cd6ca7205bb7dbbd165b3d10403c8cc3cdd39.zip
Better SQL schema
git-svn-id: svn://svn.zabbix.com/trunk@4017 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'create')
-rw-r--r--create/schema/Makefile.am2
-rwxr-xr-xcreate/schema/gen.pl15
2 files changed, 14 insertions, 3 deletions
diff --git a/create/schema/Makefile.am b/create/schema/Makefile.am
index f1413d07..58e99e09 100644
--- a/create/schema/Makefile.am
+++ b/create/schema/Makefile.am
@@ -4,7 +4,7 @@
dist-hook:
$(srcdir)/gen.pl mysql > $(distdir)/mysql.sql
$(srcdir)/gen.pl postgresql > $(distdir)/postgresql.sql
- $(srcdir)/gen.pl sqlite > $(distdir)/sqlite3.sql
+ $(srcdir)/gen.pl sqlite > $(distdir)/sqlite.sql
$(srcdir)/gen.pl oracle > $(distdir)/oracle.sql
$(srcdir)/gen.pl c > $(top_distdir)/include/dbsync.h
diff --git a/create/schema/gen.pl b/create/schema/gen.pl
index fa4cf9cb..42d86188 100755
--- a/create/schema/gen.pl
+++ b/create/schema/gen.pl
@@ -32,6 +32,7 @@ local $output;
"type" => "sql",
"before" => "",
"after" => "",
+ "table_options" => " type=InnoDB",
"t_bigint" => "bigint unsigned",
"t_id" => "bigint unsigned",
"t_integer" => "integer",
@@ -103,6 +104,7 @@ static ZBX_TABLE tables[]={
"before" => "",
"after" => "",
"type" => "sql",
+ "table_options" => " with OIDS",
"t_id" => "bigint",
"t_integer" => "integer",
"t_serial" => "serial",
@@ -158,6 +160,7 @@ sub newstate
sub process_table
{
local $line=$_[0];
+ local $tmp;
newstate("table");
($table_name,$pkey,$flags)=split(/\|/, $line,4);
@@ -173,8 +176,16 @@ sub process_table
}
else
{
- if($pkey ne "") { $pkey=",\n\tPRIMARY KEY ($pkey)\n);\n" }
- else { $pkey="\n);\n"; }
+ if($pkey ne "")
+ {
+ $pkey=",\n\tPRIMARY KEY ($pkey)\n)";
+ }
+ else
+ {
+ $pkey="\n)";
+ }
+ $tmp=$output{"table_options"};
+ $pkey="$pkey$tmp;\n";
print "CREATE TABLE $table_name (\n";
}
}