mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-11-04 01:15:14 +00:00 
			
		
		
		
	Use null for optional foreign keys
This commit is contained in:
		@@ -104,7 +104,7 @@ CREATE TABLE IF NOT EXISTS `dns_provider`
 | 
				
			|||||||
	FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE
 | 
						FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CREATE TABLE IF NOT EXISTS certificate
 | 
					CREATE TABLE IF NOT EXISTS `certificate`
 | 
				
			||||||
(
 | 
					(
 | 
				
			||||||
	`id` INT AUTO_INCREMENT PRIMARY KEY,
 | 
						`id` INT AUTO_INCREMENT PRIMARY KEY,
 | 
				
			||||||
	`created_at` BIGINT NOT NULL DEFAULT 0,
 | 
						`created_at` BIGINT NOT NULL DEFAULT 0,
 | 
				
			||||||
@@ -112,7 +112,7 @@ CREATE TABLE IF NOT EXISTS certificate
 | 
				
			|||||||
	`is_deleted` INT NOT NULL DEFAULT 0, -- int on purpose, gormism
 | 
						`is_deleted` INT NOT NULL DEFAULT 0, -- int on purpose, gormism
 | 
				
			||||||
	`user_id` INT NOT NULL,
 | 
						`user_id` INT NOT NULL,
 | 
				
			||||||
	`type` VARCHAR(50) NOT NULL, -- custom,dns,http
 | 
						`type` VARCHAR(50) NOT NULL, -- custom,dns,http
 | 
				
			||||||
	`certificate_authority_id` INT, -- 0 for a custom cert
 | 
						`certificate_authority_id` INT, -- null for a custom cert
 | 
				
			||||||
	`dns_provider_id` INT, -- 0, for a http or custom cert
 | 
						`dns_provider_id` INT, -- 0, for a http or custom cert
 | 
				
			||||||
	`name` VARCHAR(50) NOT NULL,
 | 
						`name` VARCHAR(50) NOT NULL,
 | 
				
			||||||
	`domain_names` TEXT NOT NULL,
 | 
						`domain_names` TEXT NOT NULL,
 | 
				
			||||||
@@ -216,12 +216,12 @@ CREATE TABLE IF NOT EXISTS host
 | 
				
			|||||||
	`nginx_template_id` INT NOT NULL,
 | 
						`nginx_template_id` INT NOT NULL,
 | 
				
			||||||
	`listen_interface` VARCHAR(50) NOT NULL DEFAULT '',
 | 
						`listen_interface` VARCHAR(50) NOT NULL DEFAULT '',
 | 
				
			||||||
	`domain_names` TEXT NOT NULL,
 | 
						`domain_names` TEXT NOT NULL,
 | 
				
			||||||
	`upstream_id` INT NOT NULL DEFAULT 0,
 | 
						`upstream_id` INT,
 | 
				
			||||||
	`proxy_scheme` VARCHAR(50) NOT NULL DEFAULT '',
 | 
						`proxy_scheme` VARCHAR(50) NOT NULL DEFAULT '',
 | 
				
			||||||
	`proxy_host` VARCHAR(50) NOT NULL DEFAULT '',
 | 
						`proxy_host` VARCHAR(50) NOT NULL DEFAULT '',
 | 
				
			||||||
	`proxy_port` INT NOT NULL DEFAULT 0,
 | 
						`proxy_port` INT NOT NULL DEFAULT 0,
 | 
				
			||||||
	`certificate_id` INT NOT NULL DEFAULT 0,
 | 
						`certificate_id` INT,
 | 
				
			||||||
	`access_list_id` INT NOT NULL DEFAULT 0,
 | 
						`access_list_id` INT,
 | 
				
			||||||
	`ssl_forced` BOOLEAN NOT NULL DEFAULT FALSE,
 | 
						`ssl_forced` BOOLEAN NOT NULL DEFAULT FALSE,
 | 
				
			||||||
	`caching_enabled` BOOLEAN NOT NULL DEFAULT FALSE,
 | 
						`caching_enabled` BOOLEAN NOT NULL DEFAULT FALSE,
 | 
				
			||||||
	`block_exploits` BOOLEAN NOT NULL DEFAULT FALSE,
 | 
						`block_exploits` BOOLEAN NOT NULL DEFAULT FALSE,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -187,12 +187,12 @@ CREATE TABLE "host" (
 | 
				
			|||||||
	"nginx_template_id" INTEGER NOT NULL REFERENCES "nginx_template"("id") ON DELETE CASCADE,
 | 
						"nginx_template_id" INTEGER NOT NULL REFERENCES "nginx_template"("id") ON DELETE CASCADE,
 | 
				
			||||||
	"listen_interface" TEXT NOT NULL DEFAULT '',
 | 
						"listen_interface" TEXT NOT NULL DEFAULT '',
 | 
				
			||||||
	"domain_names" TEXT NOT NULL,
 | 
						"domain_names" TEXT NOT NULL,
 | 
				
			||||||
	"upstream_id" INTEGER NOT NULL DEFAULT 0 REFERENCES "upstream"("id") ON DELETE CASCADE,
 | 
						"upstream_id" INTEGER REFERENCES "upstream"("id") ON DELETE CASCADE,
 | 
				
			||||||
	"proxy_scheme" TEXT NOT NULL DEFAULT '',
 | 
						"proxy_scheme" TEXT NOT NULL DEFAULT '',
 | 
				
			||||||
	"proxy_host" TEXT NOT NULL DEFAULT '',
 | 
						"proxy_host" TEXT NOT NULL DEFAULT '',
 | 
				
			||||||
	"proxy_port" INTEGER NOT NULL DEFAULT 0,
 | 
						"proxy_port" INTEGER NOT NULL DEFAULT 0,
 | 
				
			||||||
	"certificate_id" INTEGER NOT NULL DEFAULT 0 REFERENCES "certificate"("id") ON DELETE CASCADE,
 | 
						"certificate_id" INTEGER REFERENCES "certificate"("id") ON DELETE CASCADE,
 | 
				
			||||||
	"access_list_id" INTEGER NOT NULL DEFAULT 0 REFERENCES "access_list"("id") ON DELETE CASCADE,
 | 
						"access_list_id" INTEGER REFERENCES "access_list"("id") ON DELETE CASCADE,
 | 
				
			||||||
	"ssl_forced" BOOLEAN NOT NULL DEFAULT FALSE,
 | 
						"ssl_forced" BOOLEAN NOT NULL DEFAULT FALSE,
 | 
				
			||||||
	"caching_enabled" BOOLEAN NOT NULL DEFAULT FALSE,
 | 
						"caching_enabled" BOOLEAN NOT NULL DEFAULT FALSE,
 | 
				
			||||||
	"block_exploits" BOOLEAN NOT NULL DEFAULT FALSE,
 | 
						"block_exploits" BOOLEAN NOT NULL DEFAULT FALSE,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -216,12 +216,12 @@ CREATE TABLE IF NOT EXISTS `host`
 | 
				
			|||||||
	nginx_template_id INTEGER NOT NULL,
 | 
						nginx_template_id INTEGER NOT NULL,
 | 
				
			||||||
	listen_interface TEXT NOT NULL DEFAULT "",
 | 
						listen_interface TEXT NOT NULL DEFAULT "",
 | 
				
			||||||
	domain_names TEXT NOT NULL,
 | 
						domain_names TEXT NOT NULL,
 | 
				
			||||||
	upstream_id INTEGER NOT NULL DEFAULT 0,
 | 
						upstream_id INTEGER,
 | 
				
			||||||
	proxy_scheme TEXT NOT NULL DEFAULT "",
 | 
						proxy_scheme TEXT NOT NULL DEFAULT "",
 | 
				
			||||||
	proxy_host TEXT NOT NULL DEFAULT "",
 | 
						proxy_host TEXT NOT NULL DEFAULT "",
 | 
				
			||||||
	proxy_port INTEGER NOT NULL DEFAULT 0,
 | 
						proxy_port INTEGER NOT NULL DEFAULT 0,
 | 
				
			||||||
	certificate_id INTEGER NOT NULL DEFAULT 0,
 | 
						certificate_id INTEGER,
 | 
				
			||||||
	access_list_id INTEGER NOT NULL DEFAULT 0,
 | 
						access_list_id INTEGER,
 | 
				
			||||||
	ssl_forced INTEGER NOT NULL DEFAULT 0,
 | 
						ssl_forced INTEGER NOT NULL DEFAULT 0,
 | 
				
			||||||
	caching_enabled INTEGER NOT NULL DEFAULT 0,
 | 
						caching_enabled INTEGER NOT NULL DEFAULT 0,
 | 
				
			||||||
	block_exploits INTEGER NOT NULL DEFAULT 0,
 | 
						block_exploits INTEGER NOT NULL DEFAULT 0,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user