-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sql
71 lines (60 loc) · 2.99 KB
/
init.sql
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
-- mysql
USE pluginDatabase;
CREATE TABLE IF NOT EXISTS plugins (
`id` VARCHAR(64) NOT NULL,
`name` VARCHAR(64) NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE plugins ADD `enabled` BOOLEAN DEFAULT FALSE NOT NULL;
ALTER TABLE plugins ADD `version` VARCHAR(32) NOT NULL;
ALTER TABLE plugins ADD `authors` VARCHAR(64) NOT NULL;
ALTER TABLE plugins ADD `desc` VARCHAR(256) DEFAULT '' NOT NULL;
ALTER TABLE plugins ADD `desc_zhCN` VARCHAR(256) DEFAULT '' NOT NULL;
ALTER TABLE plugins ADD `repo` VARCHAR(256) DEFAULT '' NOT NULL;
ALTER TABLE plugins ADD `repo_branch` VARCHAR(32) DEFAULT '' NOT NULL;
ALTER TABLE plugins ADD `repo_subdir` VARCHAR(64) DEFAULT '' NOT NULL;
ALTER TABLE plugins ADD `link` VARCHAR(256) DEFAULT '' NOT NULL;
ALTER TABLE plugins ADD `createAt` DATETIME NOT NULL;
ALTER TABLE plugins ADD `lastRelease` DATETIME DEFAULT NULL;
ALTER TABLE plugins ADD `lastUpdate` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
-- labels
ALTER TABLE plugins ADD `label_information` BOOLEAN DEFAULT FALSE NOT NULL;
ALTER TABLE plugins ADD `label_tool` BOOLEAN DEFAULT FALSE NOT NULL;
ALTER TABLE plugins ADD `label_management` BOOLEAN DEFAULT FALSE NOT NULL;
ALTER TABLE plugins ADD `label_api` BOOLEAN DEFAULT FALSE NOT NULL;
ALTER TABLE plugins ADD `github_sync` BOOLEAN DEFAULT FALSE NOT NULL;
ALTER TABLE plugins ADD `last_sync` DATETIME DEFAULT NULL;
ALTER TABLE plugins ADD `ghRepoOwner` VARCHAR(32) DEFAULT '' NOT NULL;
ALTER TABLE plugins ADD `ghRepoName` VARCHAR(32) DEFAULT '' NOT NULL;
CREATE TABLE IF NOT EXISTS plugin_dependencies (
`id` VARCHAR(64) NOT NULL,
`target` VARCHAR(64) NOT NULL,
`tag` VARCHAR(34) NOT NULL,
PRIMARY KEY (`id`, `target`),
CONSTRAINT denpendency_plugin FOREIGN KEY (`id`)
REFERENCES plugins(`id`) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS plugin_requirements (
`id` VARCHAR(64) NOT NULL,
`target` VARCHAR(64) NOT NULL,
`tag` VARCHAR(34) NOT NULL,
PRIMARY KEY (`id`, `target`),
CONSTRAINT requirement_plugin FOREIGN KEY (`id`)
REFERENCES plugins(`id`) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS plugin_releases (
`id` VARCHAR(64) NOT NULL,
`tag` VARCHAR(32) NOT NULL,
PRIMARY KEY (`id`, `tag`),
CONSTRAINT release_plugin_id FOREIGN KEY (`id`)
REFERENCES plugins(`id`)
ON DELETE CASCADE
ON UPDATE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE plugin_releases ADD `enabled` BOOLEAN DEFAULT FALSE NOT NULL;
ALTER TABLE plugin_releases ADD `stable` BOOLEAN DEFAULT FALSE NOT NULL;
ALTER TABLE plugin_releases ADD `size` BIGINT UNSIGNED NOT NULL;
ALTER TABLE plugin_releases ADD `uploaded` DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL;
ALTER TABLE plugin_releases ADD `filename` VARCHAR(64) NOT NULL;
ALTER TABLE plugin_releases ADD `downloads` INTEGER UNSIGNED DEFAULT 0 NOT NULL;
ALTER TABLE plugin_releases ADD `github_url` VARCHAR(256) DEFAULT NULL;