refs #5056 models and tables added
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alexandre Riera 2023-03-13 07:34:49 +01:00
parent 24f0ca5168
commit 0248c3c9e0
10 changed files with 303 additions and 0 deletions

View File

@ -0,0 +1,67 @@
CREATE TABLE `vn`.`wagonType` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL UNIQUE,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3;
CREATE TABLE `vn`.`wagonTypeColor` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL UNIQUE,
`rgb` varchar(30) NOT NULL UNIQUE,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3;
CREATE TABLE `vn`.`wagonTypeTray` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`typeFk` int(11) unsigned,
`height` int(11) unsigned,
`colorFk` int(11) unsigned,
PRIMARY KEY (`id`),
UNIQUE KEY (`typeFk`,`height`),
CONSTRAINT `wagonTypeTray_type` FOREIGN KEY (`typeFk`) REFERENCES `wagonType` (`id`) ON UPDATE CASCADE,
CONSTRAINT `wagonTypeTray_color` FOREIGN KEY (`colorFk`) REFERENCES `wagonTypeColor` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3;
CREATE TABLE `vn`.`wagonConfig` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`width` int(11) unsigned DEFAULT 1350,
`height` int(11) unsigned DEFAULT 1900,
`trayStep` int(11) unsigned DEFAULT 50,
`minTrayHeight` int(11) unsigned DEFAULT 200,
`maxTrays` int(11) unsigned DEFAULT 6,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3;
CREATE TABLE `vn`.`collectionWagon` (
`collectionFk` int(11) NOT NULL,
`wagonFk` int(11) NOT NULL,
`position` int(11) unsigned,
PRIMARY KEY (`collectionFk`,`position`),
UNIQUE KEY `collectionWagon_unique` (`collectionFk`,`wagonFk`),
CONSTRAINT `collectionWagon_collection` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON UPDATE CASCADE,
CONSTRAINT `collectionWagon_wagon` FOREIGN KEY (`wagonFk`) REFERENCES `wagon` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
CREATE TABLE `vn`.`collectionWagonTicket` (
`ticketFk` int(11) NOT NULL,
`wagonFk` int(11) NOT NULL,
`trayFk` int(11) unsigned NOT NULL,
`side` SET('L', 'R') NULL,
PRIMARY KEY (`ticketFk`),
CONSTRAINT `collectionWagonTicket_ticket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE,
CONSTRAINT `collectionWagonTicket_wagon` FOREIGN KEY (`wagonFk`) REFERENCES `wagon` (`id`) ON UPDATE CASCADE,
CONSTRAINT `collectionWagonTicket_tray` FOREIGN KEY (`trayFk`) REFERENCES `wagonTypeTray` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
ALTER TABLE `vn`.`wagon` ADD `typeFk` int(11) unsigned DEFAULT NULL;
ALTER TABLE `vn`.`wagon` ADD CONSTRAINT `wagon_type` FOREIGN KEY (`typeFk`) REFERENCES `wagonType` (`id`) ON UPDATE CASCADE;
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
('WagonType', '*', '*', 'ALLOW', 'ROLE', 'employee'),
('WagonTypeColor', '*', '*', 'ALLOW', 'ROLE', 'employee'),
('WagonTypeTray', '*', '*', 'ALLOW', 'ROLE', 'employee'),
('WagonConfig', '*', '*', 'ALLOW', 'ROLE', 'employee'),
('CollectionWagon', '*', '*', 'ALLOW', 'ROLE', 'employee'),
('CollectionWagonTicket', '*', '*', 'ALLOW', 'ROLE', 'employee'),
('Wagon', '*', '*', 'ALLOW', 'ROLE', 'employee');

View File

@ -0,0 +1,23 @@
{
"Wagon": {
"dataSource": "vn"
},
"WagonType": {
"dataSource": "vn"
},
"WagonTypeColor": {
"dataSource": "vn"
},
"WagonTypeTray": {
"dataSource": "vn"
},
"WagonConfig": {
"dataSource": "vn"
},
"CollectionWagon": {
"dataSource": "vn"
},
"CollectionWagonTicket": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,34 @@
{
"name": "CollectionWagon",
"base": "VnModel",
"options": {
"mysql": {
"table": "collectionWagon"
}
},
"properties": {
"collectionFk": {
"id": true,
"type": "number"
},
"wagonFk": {
"type": "number",
"required": true
},
"position": {
"type": "number"
}
},
"relations": {
"collection": {
"type": "belongsTo",
"model": "Collection",
"foreignKey": "collectionFk"
},
"wagon": {
"type": "belongsTo",
"model": "Wagon",
"foreignKey": "wagonFk"
}
}
}

View File

@ -0,0 +1,43 @@
{
"name": "CollectionWagonTicket",
"base": "VnModel",
"options": {
"mysql": {
"table": "collectionWagonTicket"
}
},
"properties": {
"ticketFk": {
"id": true,
"type": "number"
},
"wagonFk": {
"type": "number",
"required": true
},
"trayFk": {
"type": "number",
"required": true
},
"side": {
"type": "string"
}
},
"relations": {
"ticket": {
"type": "belongsTo",
"model": "Ticket",
"foreignKey": "ticketFk"
},
"wagon": {
"type": "belongsTo",
"model": "Wagon",
"foreignKey": "wagonFk"
},
"tray": {
"type": "belongsTo",
"model": "WagonTypeTray",
"foreignKey": "trayFk"
}
}
}

View File

@ -0,0 +1,31 @@
{
"name": "Wagon",
"base": "VnModel",
"options": {
"mysql": {
"table": "wagon"
}
},
"properties": {
"id": {
"id": true,
"type": "number"
},
"volume": {
"type": "number"
},
"plate": {
"type": "string"
},
"typeFk": {
"type": "number"
}
},
"relations": {
"type": {
"type": "belongsTo",
"model": "WagonType",
"foreignKey": "typeFk"
}
}
}

View File

@ -0,0 +1,30 @@
{
"name": "WagonConfig",
"base": "VnModel",
"options": {
"mysql": {
"table": "wagonConfig"
}
},
"properties": {
"id": {
"id": true,
"type": "number"
},
"width": {
"type": "number"
},
"height": {
"type": "string"
},
"trayStep": {
"type": "number"
},
"minTrayHeight": {
"type": "number"
},
"maxTrays": {
"type": "number"
}
}
}

View File

@ -0,0 +1,18 @@
{
"name": "WagonType",
"base": "VnModel",
"options": {
"mysql": {
"table": "wagonType"
}
},
"properties": {
"id": {
"id": true,
"type": "number"
},
"name": {
"type": "string"
}
}
}

View File

@ -0,0 +1,21 @@
{
"name": "WagonTypeColor",
"base": "VnModel",
"options": {
"mysql": {
"table": "wagonTypeColor"
}
},
"properties": {
"id": {
"id": true,
"type": "number"
},
"name": {
"type": "string"
},
"rgb": {
"type": "string"
}
}
}

View File

@ -0,0 +1,36 @@
{
"name": "WagonTypeTray",
"base": "VnModel",
"options": {
"mysql": {
"table": "wagonTypeTray"
}
},
"properties": {
"id": {
"id": true,
"type": "number"
},
"typeFk": {
"type": "number"
},
"height": {
"type": "number"
},
"colorFk": {
"type": "number"
}
},
"relations": {
"type": {
"type": "belongsTo",
"model": "WagonType",
"foreignKey": "typeFk"
},
"color": {
"type": "belongsTo",
"model": "WagonTypeColor",
"foreignKey": "colorFk"
}
}
}