mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-07 00:46:59 +01:00
* [DEV] Fixed DB structure
* [DEV] Language tweak for logging * [DEV] Updated version
This commit is contained in:
@@ -115,6 +115,7 @@ CREATE TABLE `accounts` (
|
||||
`account_isPrivate` bit(1) DEFAULT b'0',
|
||||
`account_passDate` int(11) unsigned DEFAULT NULL,
|
||||
`account_passDateChange` int(11) unsigned DEFAULT NULL,
|
||||
`account_parentId` SMALLINT (5) UNSIGNED NULL,
|
||||
PRIMARY KEY (`account_id`),
|
||||
KEY `IDX_categoryId` (`account_categoryId`),
|
||||
KEY `IDX_userId` (`account_userGroupId`,`account_userId`),
|
||||
@@ -196,6 +197,7 @@ CREATE TABLE `accHistory` (
|
||||
`accHistory_otherGroupEdit` bit(1) DEFAULT b'0',
|
||||
`accHistory_passDate` int(10) unsigned DEFAULT NULL,
|
||||
`accHistory_passDateChange` int(10) unsigned DEFAULT NULL,
|
||||
`accHistory_parentId` SMALLINT(5) UNSIGNED NULL,
|
||||
PRIMARY KEY (`acchistory_id`),
|
||||
KEY `IDX_accountId` (`acchistory_accountId`),
|
||||
KEY `fk_accHistory_users_edit_id_idx` (`acchistory_userEditId`),
|
||||
@@ -366,10 +368,81 @@ CREATE TABLE `usrToGroups` (
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
DROP TABLE IF EXISTS `account_data_v`;
|
||||
CREATE ALGORITHM=UNDEFINED DEFINER=CURRENT_USER SQL SECURITY DEFINER VIEW `account_data_v` AS select `accounts`.`account_id` AS `account_id`,`accounts`.`account_name` AS `account_name`,`accounts`.`account_categoryId` AS `account_categoryId`,`accounts`.`account_userId` AS `account_userId`,`accounts`.`account_customerId` AS `account_customerId`,`accounts`.`account_userGroupId` AS `account_userGroupId`,`accounts`.`account_userEditId` AS `account_userEditId`,`accounts`.`account_login` AS `account_login`,`accounts`.`account_url` AS `account_url`,`accounts`.`account_notes` AS `account_notes`,`accounts`.`account_countView` AS `account_countView`,`accounts`.`account_countDecrypt` AS `account_countDecrypt`,`accounts`.`account_dateAdd` AS `account_dateAdd`,`accounts`.`account_dateEdit` AS `account_dateEdit`,conv(`accounts`.`account_otherUserEdit`,10,2) AS `account_otherUserEdit`,conv(`accounts`.`account_otherGroupEdit`,10,2) AS `account_otherGroupEdit`,conv(`accounts`.`account_isPrivate`,10,2) AS `account_isPrivate`,`accounts`.`account_passDate` AS `account_passDate`,`accounts`.`account_passDateChange` AS `account_passDateChange`,`categories`.`category_name` AS `category_name`,`customers`.`customer_name` AS `customer_name`,`ug`.`usergroup_name` AS `usergroup_name`,`u1`.`user_name` AS `user_name`,`u1`.`user_login` AS `user_login`,`u2`.`user_name` AS `user_editName`,`u2`.`user_login` AS `user_editLogin`,`publicLinks`.`publicLink_hash` AS `publicLink_hash` from ((((((`accounts` left join `categories` on((`accounts`.`account_categoryId` = `categories`.`category_id`))) left join `usrGroups` `ug` on((`accounts`.`account_userGroupId` = `ug`.`usergroup_id`))) left join `usrData` `u1` on((`accounts`.`account_userId` = `u1`.`user_id`))) left join `usrData` `u2` on((`accounts`.`account_userEditId` = `u2`.`user_id`))) left join `customers` on((`accounts`.`account_customerId` = `customers`.`customer_id`))) left join `publicLinks` on((`accounts`.`account_id` = `publicLinks`.`publicLink_itemId`)));
|
||||
CREATE OR REPLACE ALGORITHM = UNDEFINED
|
||||
DEFINER = CURRENT_USER
|
||||
SQL SECURITY DEFINER VIEW `account_data_v` AS
|
||||
SELECT
|
||||
`accounts`.`account_id` AS `account_id`,
|
||||
`accounts`.`account_name` AS `account_name`,
|
||||
`accounts`.`account_categoryId` AS `account_categoryId`,
|
||||
`accounts`.`account_userId` AS `account_userId`,
|
||||
`accounts`.`account_customerId` AS `account_customerId`,
|
||||
`accounts`.`account_userGroupId` AS `account_userGroupId`,
|
||||
`accounts`.`account_userEditId` AS `account_userEditId`,
|
||||
`accounts`.`account_login` AS `account_login`,
|
||||
`accounts`.`account_url` AS `account_url`,
|
||||
`accounts`.`account_notes` AS `account_notes`,
|
||||
`accounts`.`account_countView` AS `account_countView`,
|
||||
`accounts`.`account_countDecrypt` AS `account_countDecrypt`,
|
||||
`accounts`.`account_dateAdd` AS `account_dateAdd`,
|
||||
`accounts`.`account_dateEdit` AS `account_dateEdit`,
|
||||
conv(`accounts`.`account_otherUserEdit`, 10, 2) AS `account_otherUserEdit`,
|
||||
conv(`accounts`.`account_otherGroupEdit`, 10, 2) AS `account_otherGroupEdit`,
|
||||
conv(`accounts`.`account_isPrivate`, 10, 2) AS `account_isPrivate`,
|
||||
`accounts`.`account_passDate` AS `account_passDate`,
|
||||
`accounts`.`account_passDateChange` AS `account_passDateChange`,
|
||||
`accounts`.`account_parentId` AS `account_parentId`,
|
||||
`categories`.`category_name` AS `category_name`,
|
||||
`customers`.`customer_name` AS `customer_name`,
|
||||
`ug`.`usergroup_name` AS `usergroup_name`,
|
||||
`u1`.`user_name` AS `user_name`,
|
||||
`u1`.`user_login` AS `user_login`,
|
||||
`u2`.`user_name` AS `user_editName`,
|
||||
`u2`.`user_login` AS `user_editLogin`,
|
||||
`publicLinks`.`publicLink_hash` AS `publicLink_hash`
|
||||
FROM ((((((`accounts`
|
||||
LEFT JOIN `categories` ON ((`accounts`.`account_categoryId` = `categories`.`category_id`))) LEFT JOIN
|
||||
`usrGroups` `ug` ON ((`accounts`.`account_userGroupId` = `ug`.`usergroup_id`))) LEFT JOIN `usrData` `u1`
|
||||
ON ((`accounts`.`account_userId` = `u1`.`user_id`))) LEFT JOIN `usrData` `u2`
|
||||
ON ((`accounts`.`account_userEditId` = `u2`.`user_id`))) LEFT JOIN `customers`
|
||||
ON ((`accounts`.`account_customerId` = `customers`.`customer_id`))) LEFT JOIN `publicLinks`
|
||||
ON ((`accounts`.`account_id` = `publicLinks`.`publicLink_itemId`)));
|
||||
|
||||
DROP TABLE IF EXISTS `account_search_v`;
|
||||
CREATE ALGORITHM=UNDEFINED DEFINER=CURRENT_USER SQL SECURITY DEFINER VIEW `account_search_v` AS select distinct `accounts`.`account_id` AS `account_id`,`accounts`.`account_customerId` AS `account_customerId`,`accounts`.`account_categoryId` AS `account_categoryId`,`accounts`.`account_name` AS `account_name`,`accounts`.`account_login` AS `account_login`,`accounts`.`account_url` AS `account_url`,`accounts`.`account_notes` AS `account_notes`,`accounts`.`account_userId` AS `account_userId`,`accounts`.`account_userGroupId` AS `account_userGroupId`,conv(`accounts`.`account_otherUserEdit`,10,2) AS `account_otherUserEdit`,conv(`accounts`.`account_otherGroupEdit`,10,2) AS `account_otherGroupEdit`,conv(`accounts`.`account_isPrivate`,10,2) AS `account_isPrivate`,`accounts`.`account_passDate` AS `account_passDate`,`accounts`.`account_passDateChange` AS `account_passDateChange`,`ug`.`usergroup_name` AS `usergroup_name`,`categories`.`category_name` AS `category_name`,`customers`.`customer_name` AS `customer_name`,(select count(0) from `accFiles` where (`accFiles`.`accfile_accountId` = `accounts`.`account_id`)) AS `num_files` from (((`accounts` left join `categories` on((`accounts`.`account_categoryId` = `categories`.`category_id`))) left join `usrGroups` `ug` on((`accounts`.`account_userGroupId` = `ug`.`usergroup_id`))) left join `customers` on((`customers`.`customer_id` = `accounts`.`account_customerId`)));
|
||||
CREATE
|
||||
OR REPLACE ALGORITHM = UNDEFINED
|
||||
DEFINER = CURRENT_USER
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `account_search_v` AS
|
||||
SELECT DISTINCT
|
||||
`accounts`.`account_id` AS `account_id`,
|
||||
`accounts`.`account_customerId` AS `account_customerId`,
|
||||
`accounts`.`account_categoryId` AS `account_categoryId`,
|
||||
`accounts`.`account_name` AS `account_name`,
|
||||
`accounts`.`account_login` AS `account_login`,
|
||||
`accounts`.`account_url` AS `account_url`,
|
||||
`accounts`.`account_notes` AS `account_notes`,
|
||||
`accounts`.`account_userId` AS `account_userId`,
|
||||
`accounts`.`account_userGroupId` AS `account_userGroupId`,
|
||||
`accounts`.`account_otherUserEdit` AS `account_otherUserEdit`,
|
||||
`accounts`.`account_otherGroupEdit` AS `account_otherGroupEdit`,
|
||||
`accounts`.`account_isPrivate` AS `account_isPrivate`,
|
||||
`accounts`.`account_passDate` AS `account_passDate`,
|
||||
`accounts`.`account_passDateChange` AS `account_passDateChange`,
|
||||
`accounts`.`account_parentId` AS `account_parentId`,
|
||||
`ug`.`usergroup_name` AS `usergroup_name`,
|
||||
`categories`.`category_name` AS `category_name`,
|
||||
`customers`.`customer_name` AS `customer_name`,
|
||||
(SELECT COUNT(0)
|
||||
FROM
|
||||
`accFiles`
|
||||
WHERE
|
||||
(`accFiles`.`accfile_accountId` = `accounts`.`account_id`)) AS `num_files`
|
||||
FROM
|
||||
(((`accounts`
|
||||
LEFT JOIN `categories` ON ((`accounts`.`account_categoryId` = `categories`.`category_id`)))
|
||||
LEFT JOIN `usrGroups` `ug` ON ((`accounts`.`account_userGroupId` = `ug`.`usergroup_id`)))
|
||||
LEFT JOIN `customers` ON ((`customers`.`customer_id` = `accounts`.`account_customerId`)));
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
|
||||
Reference in New Issue
Block a user