Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors while importing jorani.sql in Jorani 1.0.2 #391

Open
prbt2016 opened this issue May 9, 2023 · 13 comments
Open

Errors while importing jorani.sql in Jorani 1.0.2 #391

prbt2016 opened this issue May 9, 2023 · 13 comments
Assignees
Labels

Comments

@prbt2016
Copy link

prbt2016 commented May 9, 2023

Hello @bbalet ,

I was in the process of manual installation of Jorani 1.0.2 downloaded from
https://github.com/bbalet/jorani/releases/download/v1.0.2/jorani-1.0.2.zip on Centos 7 with PHP 8.1, Apache 2.2, MYSQL 5.5.

However, while importing jorani.sql into database throws the following error i.e :

Error

SQL query:

CREATE TABLE oauth_users(
username VARCHAR( 255 ) NOT NULL ,
PASSWORD VARCHAR( 2000 ) ,
first_name VARCHAR( 255 ) ,
last_name VARCHAR( 255 ) ,
CONSTRAINT username_pk PRIMARY KEY ( username )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

MySQL said: Documentation
#1071 - Specified key was too long; max key length is 767 bytes 

Following is screenshot of the same :

jorani_mysql55

I also checked with MYSQL 5.6. There also same issue .

On MYSQL 5.7 I get another issue while importing the SQL i.e :

Error

SQL query:

-- -- Content of table `actions` -- INSERT INTO `actions` (`name`, `mask`, `Description`) VALUES ('accept_requests', b'0011000100110010', 'Accept the request of my team members'), ('admin_menu', b'0011000100110010', 'View admin menu'), ('change_password', b'0011000100110010', 'Change password'), ('create_leaves', b'0011000100110010', 'Create a new user leave request'), ('create_user', b'0011000100110010', 'Create a new user'), ('delete_user', b'0011000100110010', 'Delete an existing user'), ('edit_leaves', b'0011000100110010', 'Edit a leave request'), ('edit_settings', b'0011000100110010', 'Edit application settings'), ('edit_user', b'0011000100110010', 'Edit a user'), ('export_leaves', b'0011000100110010', 'Export the list of leave requests into an Excel file'), ('export_user', b'0011000100110010', 'Export the list of users into an Excel file'), ('hr_menu', b'0011000100110010', 'View HR menu'), ('individual_calendar', b'0011000100110010', 'View my leaves in a calendar'), ('list_leav[...]

MySQL said: Documentation
#1062 - Duplicate entry 'accept_requests' for key 'PRIMARY' 

Screenshot for the same :

image

What is the version of Jorani?

1.0.2

Expected behavior

SQL import should work fine without errors.

Actual behavior

SQL import throws error.

Steps to reproduce the behavior

  • Create new database.
  • Import jorani.sql via Phpmyadmin
  • Above errors occur.

How do I resolve the issue ?. Could you please replicate at your end and fix this?. What is the minimum MYSQL version required for installing Jorani?.

@bbalet
Copy link
Owner

bbalet commented May 9, 2023

Jorani doesn't support MySQL 5.5 as it uses utf8mb4 charset. This is the first error you get. Please use 5.7 (I might drop support for 5.7 in favor of 8 that was release 5 years ago and supports CTE requests in few versions).

For the other error it looks like you're trying to import twice the same table I see no other explanation.

@bbalet bbalet self-assigned this May 9, 2023
@bbalet bbalet added the question label May 9, 2023
@prbt2016
Copy link
Author

prbt2016 commented May 9, 2023

Hello @bbalet ,

Please use 5.7 (I might drop support for 5.7 in favor of 8 that was release 5 years ago and supports CTE requests in few versions).

Yeah that's fine. Could you please update in the official website docs as well as other users wont face the issue.

For the other error it looks like you're trying to import twice the same table I see no other explanation.

To recheck. I checked by creating a new database and importing there . Then too the same issue on MYSQL 5.7.

@bbalet
Copy link
Owner

bbalet commented May 9, 2023

What you are describing is not possible. On an empty database, you are injecting the following values:

INSERT INTO `actions` (`name`, `mask`, `Description`) VALUES
('accept_requests', b'0011000100110010', 'Accept the request of my team members'),
('admin_menu', b'0011000100110010', 'View admin menu'),
('change_password', b'0011000100110010', 'Change password'),
('create_leaves', b'0011000100110010', 'Create a new user leave request'),
('create_user', b'0011000100110010', 'Create a new user'),
('delete_user', b'0011000100110010', 'Delete an existing user'),
('edit_leaves', b'0011000100110010', 'Edit a leave request'),
('edit_settings', b'0011000100110010', 'Edit application settings'),
('edit_user', b'0011000100110010', 'Edit a user'),
('export_leaves', b'0011000100110010', 'Export the list of leave requests into an Excel file'),
('export_user', b'0011000100110010', 'Export the list of users into an Excel file'),
('hr_menu', b'0011000100110010', 'View HR menu'),
('individual_calendar', b'0011000100110010', 'View my leaves in a calendar'),
('list_leaves', b'0011000100110010', 'List my leave requests'),
('list_requests', b'0011000100110010', 'List the request of my team members'),
('list_users', b'0011000100110010', 'List users'),
('reject_requests', b'0011000100110010', 'Reject the request of my team members'),
('reset_password', b'0011000100110010', 'Modifiy the password of another user'),
('team_calendar', b'0011000100110010', 'View the leaves of my team in a calendar'),
('update_user', b'0011000100110010', 'Update a user'),
('view_leaves', b'0011000100110010', 'View the details of a leave request'),
('view_user', b'0011000100110010', 'View user''s details');

How can you get a primary key violation for the column name and the value accept_requests if the database is empty ? Look by yourself accept_requests is inserted only one time.

@prbt2016
Copy link
Author

prbt2016 commented May 9, 2023

Hello @bbalet ,

Thanks for the instructions.

I checked on fresh setup of MYSQL 5.7 .

I now get a different issue there . jorani.sql is imported successfully.

However cannot see any tables there . I configured config.php and database.php with correct details .

On visiting http://domain.com/jorani102/index.php/ following is thrown :

Error Number: 42S02/1146

Table 'jorani102.ci_sessions' doesn't exist

SELECT 1 FROM `ci_sessions` WHERE `id` = '74abddaa7736ba3917bc24d54b9ab4b56ad3fa19'

Filename: libraries/Session/drivers/Session_database_driver.php

Line Number: 388

image

However, there is no Session_database_driver.php inside /libraries/Session/drivers

What could be the issue?. Using this zip for install .

https://github.com/bbalet/jorani/releases/download/v1.0.2/jorani-1.0.2.zip

@bbalet
Copy link
Owner

bbalet commented May 9, 2023

At the root of your installation, there's a requirements.php script (example: https://demo.jorani.org/requirements.php) what is the result when you open it in a browser ?

@prbt2016
Copy link
Author

prbt2016 commented May 9, 2023

Hello @bbalet ,

Following is the output :
image

@bbalet
Copy link
Owner

bbalet commented May 9, 2023

This diagnostic page says that the database was partially created, some tables are missing.

@prbt2016
Copy link
Author

prbt2016 commented May 9, 2023

Hello @bbalet ,

This diagnostic page says that the database was partially created, some tables are missing.

Okay .

Any idea to resolve this?.

@bbalet
Copy link
Owner

bbalet commented May 9, 2023

How did you import the database ?
Did you notice errors while importing the database ?
It looks like you have almost no tables at all into the DB.

@prbt2016
Copy link
Author

prbt2016 commented May 9, 2023

How did you import the database ?

Created a new database and then through phpmyadmin I imported the sql/jorani.sql into the database.

It looks like you have almost no tables at all into the DB.

There was no error while doing so .

It looks like you have almost no tables at all into the DB.

Yes i noticed that there are no tables in the db .

@bbalet
Copy link
Owner

bbalet commented May 9, 2023

I don't know how to help you as it is not related to Jorani in itself.
Try to check the MySQL log file. They should be located in /var/log/mysql/mysql.log

@prbt2016
Copy link
Author

prbt2016 commented Jun 8, 2023

Hello @bbalet ,

Got it solved . By commenting /* CREATE DATABASE IF NOT EXISTS jorani CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
USE jorani; */ in jorani.sql, as this was importing jorani to default jorani database and not the named one I was importing to .

However, I get an error while Jorani login i.e after entering the default credentials as mentioned in docs I am unable to login and following is thrown under browser console :

test

Uncaught (in promise) TypeError: r.subtle is undefined
    jorani http://{{URL}}/{{TO}}/assets/dist/legacy.js:2
    importPublicKey http://{{URL}}/{{TO}}/assets/dist/legacy.js:2
    jorani http://{{URL}}/{{TO}}/assets/dist/legacy.js:2
    encrypt http://{{URL}}/{{TO}}/assets/dist/legacy.js:2
    submit_form http://{{URL}}/{{TO}}/session/login:150
    <anonymous> http://{{URL}}/{{TO}}/session/login:216
    dispatch http://{{URL}}/{{TO}}/assets/dist/legacy.js:2
    handle http://{{URL}}/{{TO}}/assets/dist/legacy.js:2
legacy.js:2:603240

This is similar to 392.

Any workaround for this ?.

@prbt2016
Copy link
Author

prbt2016 commented Jun 9, 2023

Hello @bbalet ,

Also have one more request . Could you please update version number to 1.0.2 in index.php file .

https://github.com/bbalet/jorani/blob/v1.0.2/index.php#L325

Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants