41 |
rodolico |
1 |
drop table license;
|
|
|
2 |
create table license (
|
|
|
3 |
license_id int unsigned not null auto_increment,
|
|
|
4 |
client_id int unsigned null comment 'link to client table',
|
|
|
5 |
device_id int unsigned null comment 'link to device table',
|
|
|
6 |
license text not null comment 'the actual license text',
|
|
|
7 |
license_product_id int unsigned not null references license_product(license_product_id),
|
|
|
8 |
added_date date default null comment 'date the license used on this machine',
|
|
|
9 |
removed_date date default null comment 'date license removed from this machine',
|
|
|
10 |
primary key (license_id)
|
|
|
11 |
) comment 'Holds the license and links to machine installed on' ;
|
|
|
12 |
|
|
|
13 |
drop table license_product;
|
|
|
14 |
create table license_product (
|
|
|
15 |
license_product_id int unsigned not null auto_increment,
|
|
|
16 |
name text comment 'name of the license',
|
|
|
17 |
primary key ( license_product_id )
|
|
|
18 |
) comment 'a list of all products we track license for';
|
|
|
19 |
|
|
|
20 |
select
|
|
|
21 |
license.license 'License',
|
|
|
22 |
license_product.name 'Product',
|
|
|
23 |
ifnull(device.name,'--- Available ---') 'Installed On'
|
|
|
24 |
from
|
|
|
25 |
license join license_product using (license_product_id)
|
|
|
26 |
left outer join device using (device_id)
|
|
|
27 |
order by license_product.name, device.name;
|
|
|
28 |
|