Electron - How to setup db with sqlite in Windows - database

I have created an electron app, and built it with electron-builder. It creates a package in the dist folder, which I am able to install and then run the resulting application.
I have a sqlite database in the root folder of my project, with some data in it. But when I package and then run the exe file, it seems not to connect to the database or it appears empty. If I simply run the project with electron without packing, it is able to connect to the database and make use of the data.
Also, if visit the installation folder, there I find a copy of the database I had in my application but without any rows in it. Inside an .asar folder, there is a database populated as I would want but this one I supposedly cannot edit.
Would you have any pointers on what could be causing this? How can I properly connect to the database I have in the root folder of my project using sqlite, sequelize, windows and electron?
Thanks in advance

Ensure that electron-builder doesn't pack the database file into the app ASAR (use the asarUnpack option).
If your packaged app needs to modify the database then have it copy the file to the location returned by app.getPath('userData') and work with that copy. Your app generally does not have permission to write to the directory in which it is installed.

Related

SQL Server Database Project

I want to use database project for script deployment in Azure SQL Server, I don't want to import full database. I just want to use database project for delta script. I added a project and included one script file with none as build action that contains create table statement , I am publishing the project, It's completing successfully but create statement is not executing. What is wrong here? Is there any other way to do this?
TLDR: Set your build action to "Post Deployment Script".
Longer:
What happens in SSDT is that all the files that have a build action of "Build" are built into a model of what the database should look like. When the deploy happens that model is compared to the target database and if there are any changes, a change script it generated and then optionally deployed.
If you have any file marked pre or post deployment script then they are either prepended or appended to the change script and will be run as part of the deployment.
If you have any files with a build action of "None" then SSDT ignores them, you could put anything in there, even an ascii picture of a donkey and the project will still build and deploy (obviously your ascii donkey won't get deployed anywhere).
If you just want to use SSDT to do your deployments you can just set the build action to pre or post deploy and it will be included. This is pretty odd though, either don't use SSDT or use SSDT and put the model of your entire database in there.
Personally, I would use SSDT properly and live the dream.
Ed

Recover database with laravel migrations

I lost my database since i moved servers.
I still have the migrations in my laravel folder. And i also have this rater.sql file in the root of my project. Is there a way i could get my database back with the migrations?
If you are using shared hosting you cant run command, so you can open your files in an FTP file manager (I prefer PHPStorm), then you can run below command as Hedam said:
php artisan migrate
now you can export the database to your localhost and import that on your hosting.
If you dumped your database, your data is lost.
You can though restore the data structure with
php artisan migrate
Obviously, we do not know what rater.sql contains, so I suggest you look if any data can be recovered from this file.

WIX Deployment: Which files to deploy?

This might be a very trivial question but deployment is new to me and little confused about which file to deploy.
I have a WPF test project uses Entity framework in visual studio and trying to use WIX to deploy it. Target machine is running windows 7. Given that .Net Framework and sql server localdb is installed on the target machine what files I need to deploy (make component in the WIX xml file)? I have tried copying the whole bin/Release folder to the target machine and it works. However I don’t know if that is necessary. The following screenshot shows the bin\Release directory of my application.
The problem is I don’t know the job of some files particularly the files with the following extensions:
.exe.config
.pdb
.vshost.exe
.vshost.exe.config
The database file is located in the Users\[username] directory and gets created if it doesn’t exist so I suppose it’s not part of the deployment.
Additionally I would like to understand two xml files-
EntityFramework.SqlServer.xml
EntityFramework.xml
Do I need to deploy these two files as well?
exe.config
Several settings you can change here - if defined in the Project building the EXE. You probably want to deploy this.
.pdb
Debugfiles. Deploy if you are investigating errors - else don't, these contain source information.
.vshost.exe
.vshost.exe.config
Do not deploy. These are used/generate by Visual Studio. If you start a Project out of Visual Studio it is ran in a hosted process environment so it cannot crash Visual Studio when then application runs into an error. Not for production.
EntityFramework.SqlServer.xml
EntityFramework.xml
This is documentation for the corresponding dlls. Useful for development, I do not think you want to deploy them thou.

Key steps to uploading a Drupal website from Local to live using a hosting firm

I'm a newbie to pushing Drupal websites from local to live via a CP panel with a hosting company and wondered if there are any key steps I need to follow? I usually end up with Internal Server 500 errors or no themes showing so not a good start!
The steps I follow are:
Export the database from my local PHPMyAdmin
Log into my hosting CP Panel and create the database on there
Create a user for the database (with password)
Change the settings.php to match the database settings
Load all Drupal files via FTP
Create a 'tmp' folder in the 'sites > default> files' directory
What am I doing wrong?! Is it something to do with the .htaccess file as to why I either get the error or my theme never shows?
Any help would be much appreciated! So stressful and frsutrating as a newbie! Once I've done 1 I'm hoping it'll be plain sailing!!
Thanks!
C
You have the basic steps right. Check the php error logs on the server (probably accessible via the control panel if you dont have ssh access), they should give you more information as to what actually caused the 500 errors.
Doubt it is an htaccess issue unless you are doing something crazy in there.
Can you see he drupal admin at all? If so, clear cache, check watchdog for clues also.
It's easier to download and install Drupal again on the live server rather than to copy everything via FTP. The settings.php file is where your MySQL information is stored so this file should not be copied. Follow Drupal's documentation on how to install Drupal at https://drupal.org/documentation/install/download
To transfer your database, install and enable the Backup and Migrate module on your local server from https://drupal.org/project/backup_migrate and back up your database locally.
After Drupal is installed on the live server, go ahead and copy your modules, themes, and files from /sites/all and /sites/default/files (or any non-Drupal core files that you may have created). Enable and use the Backup and Migrate module to restore your database to your live server. You may need to configure the php.ini file if the database is over 8MB.

add data to a *.sdf file

I have create an application for windows, where i am using phone's sqlite as DB to store data. While testing the app in Emulator after the first time(i.e reinstallion of the app), the data of the DB gets erased every time.
So can any one please tell me How to:
Save the existing data of the DB before reinstalling the app.
Modify the .sdf file Manually (with out using the app)
To save the data in some other way, which will not be affected by the reinstallation of the app.
More Information regarding ways to add data to .sdf file are appreciated ...
Edit: Is it possible to browse and edit the .sdf file in phone when application gets installed
If you run the app via the Emulator, every time you close the emulator the app along with its components gets uninstalled. To prevent this , don't close the emulator everytime you run the app. Keep the emulator open, and run the program.
In the phone once the app is installed, the data is not deleted from the database and it is persisted.
The SDF can be modified using the Server Explorer in Visual Studio, add a database connection to SQL CE 3.5 and point to your sdf. You can modify the data from there.
You can also use the Isolated Storage explorer to open the SDF. http://wp7explorer.codeplex.com/

Resources