49 |
rodolico |
1 |
/* this contains the license information itself */
|
42 |
rodolico |
2 |
drop table if exists license;
|
41 |
rodolico |
3 |
create table license (
|
|
|
4 |
license_id int unsigned not null auto_increment,
|
|
|
5 |
client_id int unsigned null comment 'link to client table',
|
|
|
6 |
device_id int unsigned null comment 'link to device table',
|
|
|
7 |
license text not null comment 'the actual license text',
|
|
|
8 |
license_product_id int unsigned not null references license_product(license_product_id),
|
|
|
9 |
added_date date default null comment 'date the license used on this machine',
|
|
|
10 |
removed_date date default null comment 'date license removed from this machine',
|
|
|
11 |
primary key (license_id)
|
|
|
12 |
) comment 'Holds the license and links to machine installed on' ;
|
49 |
rodolico |
13 |
|
|
|
14 |
/* child table that contains the "name" of the product, ie Microsoft - Office 2016, etc... */
|
42 |
rodolico |
15 |
drop table if exists license_product;
|
41 |
rodolico |
16 |
create table license_product (
|
|
|
17 |
license_product_id int unsigned not null auto_increment,
|
|
|
18 |
name text comment 'name of the license',
|
|
|
19 |
primary key ( license_product_id )
|
|
|
20 |
) comment 'a list of all products we track license for';
|
|
|
21 |
|
49 |
rodolico |
22 |
/* set up the _system table to plug in the module */
|
|
|
23 |
/* this is required, and officially installs the module */
|
50 |
rodolico |
24 |
insert into _system ( group_name,key_name,theValue,added_date) values ( 'Modules', 'License', 'modules/license/', now() );
|
49 |
rodolico |
25 |
/* we will provide data to the main screen via a callback routine. In this case, function view is located in callable.php */
|
50 |
rodolico |
26 |
insert into _system( group_name,key_name,theValue,added_date ) values ( 'device view', 'License', 'callable.php:licenseView', now() );
|
49 |
rodolico |
27 |
|
|
|
28 |
/* This has a menu entry, so add it */
|
|
|
29 |
/* first, make sure we don't have any danglies */
|
|
|
30 |
/* create three menu options. First one is the main menu option (ie, no parent_id) */
|
42 |
rodolico |
31 |
insert into menu( url, caption, parent_id) values ('/modules/license/', 'Licenses', null);
|
49 |
rodolico |
32 |
/* two additional menu options for bulk_load and editing the license_product table */
|
43 |
rodolico |
33 |
insert into menu( url,caption,parent_id) select '/modules/license/bulk_load.html','Bulk Load',menu_id from menu where caption = 'Licenses';
|
47 |
rodolico |
34 |
insert into menu( url,caption,parent_id) select '/modules/license/edit_license_product.html','Edit Products',menu_id from menu where caption = 'Licenses';
|
42 |
rodolico |
35 |
|