shihjay2 / nosh-in-a-box

NOSH in a Box is a self-contained virtual machine that deploys NOSH ChartingSystem, an EHR coded by a physician for physicians
26 stars 13 forks source link

Unable to access "Demographics" after nosh-in-a-box restore #11

Closed rumsant closed 6 years ago

rumsant commented 6 years ago

In an effort to clear up a previous issue I was having with vagrant ssh, I decided to start over and restore nosh-in-a-box in the manner you put forth here: https://github.com/shihjay2/nosh-in-a-box/issues/7#issuecomment-420501251

This method has worked flawlessly for me in the past, but this time, after restoring the .sql and /noshdocuments, I have run into an issue in which I am unable to get to the "Demographics" tab of a patient. Instead I get the following screen:

ss

I also get a similar screen if I try to go to certain "practice setup" links.

I'm out of my realm here, but I was just wondering if perhaps there has been a recent update that would be causing this "undefined property" error.

Thank you.

shihjay2 commented 6 years ago

Yes, there was a recent update. You can do https:///nosh/update_system/migrate to update the database tables.

On Sun, Oct 21, 2018 at 5:53 PM Anthony Rumsey notifications@github.com wrote:

In an effort to clear up a previous issue I was having with vagrant ssh, I decided to start over and restore nosh-in-a-box in the manner you put forth here:

7 (comment)

https://github.com/shihjay2/nosh-in-a-box/issues/7#issuecomment-420501251

This method has worked flawlessly for me in the past, but this time, after restoring the .sql and /noshdocuments, I have run into an issue in which I am unable to get to the "Demographics" tab of a patient. Instead I get the following screen:

[image: ss] https://user-images.githubusercontent.com/26801488/47274416-8974ca80-d551-11e8-98d9-eae70f0cab43.png

I also get a similar screen if I try to go to certain "practice setup" links.

I'm out of my realm here, but I was just wondering if perhaps there has been a recent update that would be causing this "undefined property" error.

Thank you.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/shihjay2/nosh-in-a-box/issues/11, or mute the thread https://github.com/notifications/unsubscribe-auth/ACQzVgGdbvQQm9Hc_9tS05faypBbVaAZks5unRcLgaJpZM4XyvW7 .

rumsant commented 6 years ago

I followed the direction above and that resulted in the following response:

"Illuminate\Database\QueryException : SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'data_sync' already exists (SQL: create table data_sync (id int unsigned not null auto_increment primary key, pid bigint null, action longtext null, from varchar(255) null, source_id bigint null, source_index varchar(255) null, created_at timestamp null, updated_at timestamp null) default character set utf8 collate 'utf8_general_ci')

at /noshdocuments/nosh2/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make this exception a 662| // lot more helpful to the developer instead of just the database's errors. 663| catch (Exception $e) {

664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), $e 666| ); 667| } 668|

Exception trace:

1 Doctrine\DBAL\Driver\PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'data_sync' already exists") /noshdocuments/nosh2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:144

2 PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'data_sync' already exists") /noshdocuments/nosh2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:142

Please use the argument -v to see more details."

It still appears that I get the same error when trying to access Demographics.

Thank you.

etoi2pi commented 6 years ago

It sounds like you just need to add a column 'country' to the demographics table by updating, and update, don't recreate.

If you want, I can take a look in a couple of hours.

On Mon, Oct 22, 2018, 20:01 Anthony Rumsey notifications@github.com wrote:

I followed the direction above and that resulted in the following response:

"Illuminate\Database\QueryException : SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'data_sync' already exists (SQL: create table data_sync (id int unsigned not null auto_increment primary key, pid bigint null, action longtext null, from varchar(255) null, source_id bigint null, source_index varchar(255) null, created_at timestamp null, updated_at timestamp null) default character set utf8 collate 'utf8_general_ci')

at /noshdocuments/nosh2/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make this exception a 662| // lot more helpful to the developer instead of just the database's errors. 663| catch (Exception $e) {

664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), $e 666| ); 667| } 668|

Exception trace:

1 Doctrine\DBAL\Driver\PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'data_sync' already exists")

/noshdocuments/nosh2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:144

2 PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'data_sync' already exists")

/noshdocuments/nosh2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:142

Please use the argument -v to see more details."

It still appears that I get the same error when trying to access Demographics.

Thank you.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/shihjay2/nosh-in-a-box/issues/11#issuecomment-431897010, or mute the thread https://github.com/notifications/unsubscribe-auth/AYTmipNHCqOGsOECzRbYDnNUZIgyjtMtks5unfn-gaJpZM4XyvW7 .

rumsant commented 6 years ago

It sounds like you just need to add a column 'country' to the demographics table by updating, and update, don't recreate. If you want, I can take a look in a couple of hours.

I don't know much about this sort of thing, but I assume that adding that column involves something along the lines of manually manipulating the database (MySQL or MariaDB, or something like that), correct?

etoi2pi commented 6 years ago

Yes. I will look at the DB in source control to see the difference.

I have a question for the good doctor. How does the reinstall/upgrade script take into account database changes? Can you tell me the name of the script?

I'll take a look my self over the next hour.

On Mon, Oct 22, 2018, 21:01 Anthony Rumsey notifications@github.com wrote:

It sounds like you just need to add a column 'country' to the demographics table by updating, and update, don't recreate. If you want, I can take a look in a couple of hours.

I don't know much about this sort of thing, but I assume that adding that column involves something along the lines of manually manipulating the database (MySQL or MariaDB, or something like that), correct?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/shihjay2/nosh-in-a-box/issues/11#issuecomment-431917108, or mute the thread https://github.com/notifications/unsubscribe-auth/AYTmigBFBkp6wZOsxBi2_5vcHJinNUQpks5unggGgaJpZM4XyvW7 .

shihjay2 commented 6 years ago

The database schemas are handled by Laravel migrations. The schemas are in the ../database/migrations directory. Laravel compares each entry in that directory to what is in the migrations table in MySQL and syncs it accordingly I think when you uploaded the backup database, there was a skipped migration routine and when it got called again, the error keeps propagating.

You could do a php artsian migrate:rollback command in the noshdocuments/nosh2 directory up to the /2018_10_16_170728_create_data_sync_table.php level and then php artisan migrate again until you sync up; or if it is giving you errors, the best thing to do then would be do a fresh VM install of nosh2; upload the back up and then do a php artisan migrate command to sync everything up.

Based on this experience I'll update the restore from backup database routine to include a migrations check and function so that it doesn't get stuck like in this example.

rumsant commented 6 years ago

I can do a fresh install and restore pretty quickly, so that sounds like it might be easiest. Not sure what a php artisan migrate command is though. If it's anything like artisan bread, I'm afraid I might burn the database. (pardon the dad-joke, I can't help myself)

etoi2pi commented 6 years ago

Dr. Thank you for answering. It helps me learn the system

And Anthony, Dad jokes are clearly the highest form of humour, and demonstrate a keen intellect and wit. No bias here at all bc I have 5 daughters. :)

On Mon, Oct 22, 2018, 22:50 Anthony Rumsey notifications@github.com wrote:

I can do a fresh install and restore pretty quickly, so that sounds like it might be easiest. Not sure what a php artisan migrate command is though. If it's anything like artisan bread, I'm afraid I might burn the database. (pardon the dad-joke, I can't help myself)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/shihjay2/nosh-in-a-box/issues/11#issuecomment-431957256, or mute the thread https://github.com/notifications/unsubscribe-auth/AYTmis65nZTh6f6GRKuRBzVSVPgS7KFAks5uniGBgaJpZM4XyvW7 .

shihjay2 commented 6 years ago

Totally get your joke, being a dad myself :)

I don't know where the PHP developers got that name from but what php artisan commands are commands you can type into the command line directly (php is a web scripting languague that in the past was only able to be driven through the web browser).

So you just type in "php artisan migrate" at the root of the app (/noshdocuments/nosh2).

https://laravel.com/docs/5.7/migrations talks about how database migrations work as I explained in my last post in more detail as NOSH is a Laravel based app. You'll notice that the Laravel developers also talk about their work as "The PHP Framework For Web Artisans"; perhaps I should consider NOSH as the EMR for Clinician Artisans too :)

On Mon, Oct 22, 2018 at 12:50 PM Anthony Rumsey notifications@github.com wrote:

I can do a fresh install and restore pretty quickly, so that sounds like it might be easiest. Not sure what a php artisan migrate command is though. If it's anything like artisan bread, I'm afraid I might burn the database. (pardon the dad-joke, I can't help myself)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/shihjay2/nosh-in-a-box/issues/11#issuecomment-431957256, or mute the thread https://github.com/notifications/unsubscribe-auth/ACQzVlgPVPYsQQoOJdXnVImViLF7cvGHks5uniGBgaJpZM4XyvW7 .

rumsant commented 6 years ago

I've tried a fresh install. I uploaded the database backup file and copied the /noshdocuments contents (except for /nosh2), and then ran php artisan migrate at the root of the app. I ended up with the same error I initially posted above.

I also attempted to roll back to the level that you mentioned earlier, but even though it lists several migrations with an October date, it only reports that it rolls back migrations prior to the 2018_10_16_170728_create_data_sync_table.php level, so I'm not sure what is going on.

I tried several other migration methods mentioned in the link you suppplied, like "refresh" and "fresh", but I just can't seem to get things to work, which is a problem because even though I have all my data, I am unable to do essential things like add a new patient.

If you have any ideas, it would be greatly appreciated.

Thank you.

shihjay2 commented 6 years ago

I updated the migration file to do a check of the database first and if it already exists (like in your situation), it will skip the table creation which generates the error. Update the system and then do the php artisan migrate again.

rumsant commented 6 years ago

Great. Saved my bacon again. Thank you!