From 117f31125d4d1e39f6bf639360ff37a44664dbb2 Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Tue, 28 Mar 2017 16:31:37 +0300 Subject: Add SQL as router RAM backend --- sql/lite.sql | 11 +++++++++++ sql/mssql.sql | 14 ++++++++++++++ sql/mysql.sql | 11 +++++++++++ sql/pg.sql | 11 +++++++++++ 4 files changed, 47 insertions(+) (limited to 'sql') diff --git a/sql/lite.sql b/sql/lite.sql index 3e9231768..bc6a6e706 100644 --- a/sql/lite.sql +++ b/sql/lite.sql @@ -319,3 +319,14 @@ CREATE TABLE oauth_token ( scope text NOT NULL, expire bigint NOT NULL ); + +CREATE TABLE route ( + domain text NOT NULL, + server_host text NOT NULL, + node text NOT NULL, + pid text NOT NULL, + local_hint text NOT NULL +); + +CREATE UNIQUE INDEX i_route ON route(domain, server_host, node, pid); +CREATE INDEX i_route_domain ON route(domain); diff --git a/sql/mssql.sql b/sql/mssql.sql index a3b814e02..06f73aea9 100644 --- a/sql/mssql.sql +++ b/sql/mssql.sql @@ -490,3 +490,17 @@ CREATE TABLE [dbo].[oauth_token] ( [token] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ) TEXTIMAGE_ON [PRIMARY]; + +CREATE TABLE [dbo].[route] ( + [domain] [varchar] (255) NOT NULL, + [server_host] [varchar] (255) NOT NULL, + [node] [varchar] (255) NOT NULL, + [pid] [varchar](100) NOT NULL, + [local_hint] text NOT NULL +); + +CREATE UNIQUE CLUSTERED INDEX [route_i] ON [route] (domain, server_host, node, pid) +WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON); + +CREATE INDEX [route_domain] ON [route] (domain) +WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON); diff --git a/sql/mysql.sql b/sql/mysql.sql index 9b2114ae5..c4f3d1f02 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -335,3 +335,14 @@ CREATE TABLE oauth_token ( scope text NOT NULL, expire bigint NOT NULL ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +CREATE TABLE route ( + domain text NOT NULL, + server_host text NOT NULL, + node text NOT NULL, + pid text NOT NULL, + local_hint text NOT NULL +) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +CREATE UNIQUE INDEX i_route ON route(domain(75), server_host(75), node(75), pid(75)); +CREATE INDEX i_route_domain ON route(domain(75)); diff --git a/sql/pg.sql b/sql/pg.sql index 2ce9d1379..fac806e8a 100644 --- a/sql/pg.sql +++ b/sql/pg.sql @@ -339,3 +339,14 @@ CREATE TABLE oauth_token ( ); CREATE UNIQUE INDEX i_oauth_token_token ON oauth_token USING btree (token); + +CREATE TABLE route ( + domain text NOT NULL, + server_host text NOT NULL, + node text NOT NULL, + pid text NOT NULL, + local_hint text NOT NULL +); + +CREATE UNIQUE INDEX i_route ON route USING btree (domain, server_host, node, pid); +CREATE INDEX i_route_domain ON route USING btree (domain); -- cgit v1.2.3