From f7198e7e8c648546d2d335dd9dc80333905028eb Mon Sep 17 00:00:00 2001
From: Martin Willi <martin@strongswan.org>
Date: Tue, 22 Jul 2008 14:56:15 +0000
Subject: experimental and untested reimplementation of sql based IP pool uses
 address preallocation and separate address/lease tables for linear lookup
 time

---
 src/charon/plugins/sql/mysql.sql | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

(limited to 'src/charon/plugins/sql/mysql.sql')

diff --git a/src/charon/plugins/sql/mysql.sql b/src/charon/plugins/sql/mysql.sql
index f98fe71e2..412abc715 100644
--- a/src/charon/plugins/sql/mysql.sql
+++ b/src/charon/plugins/sql/mysql.sql
@@ -157,15 +157,14 @@ CREATE TABLE pools (
   `name` varchar(32) NOT NULL,
   `start` varbinary(16) NOT NULL,
   `end` varbinary(16) NOT NULL,
-  `next` varbinary(16) NOT NULL,
   `timeout` int(10) unsigned NOT NULL,
   PRIMARY KEY (`id`),
   UNIQUE (`name`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
 
 
-DROP TABLE IF EXISTS leases;
-CREATE TABLE leases (
+DROP TABLE IF EXISTS addresses;
+CREATE TABLE addresses (
   `id` int(10) unsigned NOT NULL auto_increment,
   `pool` int(10) unsigned NOT NULL,
   `address` varbinary(16) NOT NULL,
@@ -175,7 +174,17 @@ CREATE TABLE leases (
   PRIMARY KEY (`id`),
   INDEX (`pool`),
   INDEX (`identity`),
-  INDEX (`released`)
+  INDEX (`address`)
+);
+
+DROP TABLE IF EXISTS leases;
+CREATE TABLE leases (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `address` int(10) unsigned NOT NULL,
+  `identity` int(10) unsigned NOT NULL,
+  `acquired` int(10) unsigned NOT NULL,
+  `released` int(10) unsigned DEFAULT NULL,
+  PRIMARY KEY (`id`)
 );
 
 
-- 
cgit v1.2.3

