+--
+-- Erzeugung der Datenbank-Struktur.
+--
+-- Voraussetzung: SqLite >=3.3
+--
+
+-- $Id$
+-- $URL$
+
+-- Tabelle newsletters
+
+DROP TABLE IF EXISTS "newsletters";
+CREATE TABLE "newsletters" (
+ "nid" INTEGER PRIMARY KEY AUTOINCREMENT,
+ "title" TEXT COLLATE NOCASE NOT NULL,
+ "desc" TEXT,
+ "creation" TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+CREATE INDEX IF NOT EXISTS "ix_newsletters_title" ON "newsletters" ( "title" );
+
+INSERT INTO "newsletters" ( "nid", "title", "desc" ) VALUES ( 1, 'Default newsletter', 'Nicht zuzuordnende locations' );
+
+-- Tabelle locations
+
+DROP TABLE IF EXISTS "locations";
+CREATE TABLE "locations" (
+ "lid" INTEGER PRIMARY KEY AUTOINCREMENT,
+ "nid" INTEGER,
+ "url" TEXT COLLATE NOCASE NOT NULL,
+ "desc" TEXT,
+ "creation" TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+CREATE INDEX IF NOT EXISTS "ix_locations_nid" ON "locations" ( "nid" );
+
+INSERT INTO locations ( "nid", "url", "desc" ) VALUES ( 1, 'http://www.strato.de', 'Standard-Eintrag' );
+INSERT INTO locations ( "nid", "url", "desc" ) VALUES ( 1, 'http://www.strato.com', 'Standard-Eintrag' );
+
+
+-- Tabelle iplist
+
+DROP TABLE IF EXISTS "iplist";
+CREATE TABLE "iplist" (
+ "id" INTEGER PRIMARY KEY AUTOINCREMENT,
+ "lid" INTEGER NOT NULL,
+ "ip" NOT NULL,
+ "type" TEXT NOT NULL DEFAULT 'r',
+ "tstamp" TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+CREATE UNIQUE INDEX IF NOT EXISTS "ix_iplist_ident" ON "iplist" ( "lid", "ip", "type" );
+CREATE INDEX IF NOT EXISTS "ix_iplist_tstamp" ON "iplist" ( "tstamp" );
+
+-- Tabelle count
+
+DROP TABLE IF EXISTS "count";
+CREATE TABLE "count" (
+ "id" INTEGER PRIMARY KEY AUTOINCREMENT,
+ "lid" INTEGER NOT NULL,
+ "ip" NOT NULL,
+ "type" TEXT NOT NULL DEFAULT 'r',
+ "tstamp" TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+CREATE INDEX IF NOT EXISTS "ix_count_lid" ON "count" ( "lid" );
+CREATE INDEX IF NOT EXISTS "ix_count_tstamp" ON "count" ( "tstamp" );
+
+-- Bereinigen der gesamten Datenbank
+VACUUM;
+