summaryrefslogtreecommitdiffstats
path: root/raddb/mods-config/sql/ippool-dhcp/mssql/schema.sql
blob: dae4eff16fbc42068bd5eba983c2e59fffc49ff8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--
-- Table structure for table 'dhcpippool'
--
-- See also "procedure.sql" in this directory for
-- a stored procedure that gives much faster response.
--

CREATE TABLE dhcpstatus (
	status_id	int NOT NULL,
	status		varchar(10) NOT NULL,
	PRIMARY KEY (status_id)
)
GO

INSERT INTO dhcpstatus (status_id, status) VALUES (1, 'dynamic'), (2, 'static'), (3, 'declined'), (4, 'disabled')
GO

CREATE TABLE dhcpippool (
	id			int IDENTITY (1,1) NOT NULL,
	pool_name		varchar(30) NOT NULL,
	FramedIPAddress		varchar(15) NOT NULL default '',
	pool_key		varchar(30) NOT NULL default '',
	gateway			varchar(15) NOT NULL default '',
	expiry_time		DATETIME NOT NULL default CURRENT_TIMESTAMP,
	status_id		int NOT NULL default 1,
	counter			int NOT NULL default 0,
	CONSTRAINT fk_status_id FOREIGN KEY (status_id) REFERENCES dhcpstatus (status_id),
	PRIMARY KEY (id)
)
GO

CREATE INDEX dhcp_poolname_expire ON dhcpippool(pool_name, expiry_time)
GO

CREATE INDEX dhcp_FramedIPAddress ON dhcpippool(FramedIPAddress)
GO

CREATE INDEX dhcp_poolname_poolkey_FramedIPAddress ON dhcpippool(pool_name, pool_key, FramedIPAddress)
GO