I'm creating two database tables for my ownCloud app in the "database.xml" file. This means it will automatically generate these two tables when you add/install the app, but they are obviously empty.
I'm wanting to put some default entries in one table on installing/adding the app. Is this at all possible?
Thanks!
After searching for a while, as well as trying and failing, I think I have solved my question and thought I'd share it with everyone.
It simply does not work as it's most likely not supported!
Using this documentation for MDB2 XML notation, I found you can use the "initialization" tag to make this happen, but the MDB2 version used in ownCloud most likely does not support this. Looking in the log after putting this tag in, I got this error message:
"app":"core","message":"Failed to update database structure (exception 'DomainException' with message 'Unknown element: initialization'
I also tried with a "unique" tag from the same documentation, but with a similar error. And previously I've asked a question on the ownCloud forum regarding foreign keys, but again with the same result. The answer then was that it was not supported, which is most likely the case regarding this as well.
Hope this helps another developer with similar issues, but be aware that this might change in the future and that they might support this then. If so, please let me know and I will delete/update this Q&A.
Related
I have connected to my work database via DBeaver. Recently colleague told me about a procedure that lets me check newly added entities through our front-end.
And I can't find it in the list of procedures, nor using this query:
SHOW PROCEDURE STATUS WHERE Name LIKE '%name%'
I have the same connection settings as my colleague's, same user, etc, but he uses DbForge and I use DBeaver, cause at some point of time DbForge began having too much restrictions for free version (I wasn't simply able to execute queries), and the older version my colleague gave me didn't install in Windows 11.
So, I'm thinking may be there's some settings in the DBeaver that hide certain stored procedures, or I need to adjust connection settings.
Does anyone has clue on this?
Or may be someone could suggest some alternative to DbForge, which allows to execute queries in the free version and to set colors to connections (I find that thing convenient), and possibly doesn't have this problem, may be because of being more MySQl-oriented.
Thanks in advance!
I've tried to open connection settings and check out the additional parameters there, but can't seem to notice anything relevant.
Ok, seems like there was misunderstanding between me and my colleague, and he actually meant some another DB Server, but with same User/Password combination. Thanks for the comments, that also helped in finding the cause. I really did install MySQL Workbench, saw the same picture in there, and started wondering what else it could be and reading our communication again.
My mistake) The question is no longer actual.
I want to know, is there a log that saves all the changes made by users to a database just like in git where all the commits can be viewed by each user so that if any error occur we know who did it.If there is one how to get it? or how to create one that will do it?
Problem I'm facing is that a table's data has been altered by one of the developers but there is no way to find when and who did it and also I am struggling to find all the changes that has been done to the table.
Databases typically do not provide auditing as standard. I typically implement it within my application. However, for a faster result, there are some plugins for mySQL which you could try.
I am using PhpStorm 2016.1.2 and have been comfortably using PhpStorm for a couple of years. I have my Storm set up with the Database connection and displaying the MySQL database that my PHP pages connect to. The SQL is usually written within the PHP page in custom functions via a database connection class.
An example code chunk:
$checkData = $dataBaseSecure->getSelect(
"SELECT check_login.fail_id, UNIX_TIMESTAMP(check_login.last_action) AS timer
FROM check_login WHERE check_login.ip_addr = ? AND check_login.check_drop = ? ",
$data, TRUE);
Don't worry about the database PHP wrapper, this style and layout of SQL in PHP has been around on my work for a couple of years, in PhpStorm and works completely and accurately on the server and on all testings.
As Of Yesterday (17th June 2016)
I don't know what's changed but suddenly PhpStorm is now telling me, on all my SQL strings, across all my Projects:
Unable to resolve symbol '<table name>'
or
Unable to resolve column '<column name>'
And also (due to this) PhpStorm no longer carries out any auto-complete or organisation functions as I work on my SQL code.
Solutions I've tried
I have already tried to invalidate and revalidate my caches based on this answer to a similar question. But that hasn't helped.
I have very carefully explored my settings but the PhpStorm Database tab successfully connects to the database, and as far as I'm aware I made no changes to cause this change in behaviour.
I have looked over the various (and many) settings in PhpStorm preferences but seen nothing that has shone any light on this issue, or the changes I have tweaked have not resolved it.
I have found this answer but this does not seem to apply as my table names are not variables. I have also found this post, which while dated 2014 shows a similar issue but not a suitable solution.
I only have one database connection in most projects, but the number of databases doesn't seem to effect if this issue occurs.
Fully escaping SQL queries with appropriate backticks around named entities does not resolve the issue.
I have correctly configured my SQL dialect to the correct MySQL.
Reading related posts I'm found on Stack Overflow has provided no useful information.
I have no plugins in PhpStorm that relate to this issue or PHP/MySQL interaction.
If you have any ideas how to resolve this please tell me. If you have specific preferences you'd like me to check please let me know and I can add them into the question, (there are so many preferences in PhpStorm I won't post them all here right now, as I'm sure most are not related to this issue).
The Key is that this system was working perfectly two days ago!!!
Please try re-synchronizing your DB schemas -- just in case if it somehow got corrupted or invalid.
If it did not give any visual results -- try more radical version of it:
close IDE
open .idea subfolder for this project (the place where this project settings are stored)
delete dataSources.ids file
re-open project in IDE
re-sync DB structure / re-create DB connection from scratch.
None of the above worked for me - what eventually did was...
Selecting a portion of the SQL string that would run and then right clicking and selecting "Execute" and selecting the schema.
For some reason that allowed PHPStorm (more like light
drizzle) to figure out what it should be looking at.
Some background:
We provide a complex system consisting of a large database and several programs - most written in C#, however some legacy applications are still running on MFC.
Most of the stuff we provide runs on a single server (runs SQL server and SQL Management studio 2005), however several applications can run on a number of client's computers. Updating this is a real pain, since after we update the database the outdated software is likely to break due to database changes. Updating the server software manually is one thing, however making sure all the client software works too is practically impossible, and will only get worse with time.
I am to write an updating service, which will be able to update the whole product - update the database, reinstall services and applications. (However only the programs / files /tables / etc that are actually modified should be updated. Downloading the whole product each time there is a update available is not an option. Also, some computers may only have a subset of avaliable programs installed)
First of all is there a already a good way of doing this? If there is something similar to ClickOnce that would also be able to update databases already out there I'd much rather use that.
If not, what are the best practices when it comes to updating? All and any material will be greatly appreciated.
I will need some updates to be installed on the server ASAP after the updates have been submitted, without any user input. That includes a windows service (that is running at all times) and any database changes. After these changes have been made, I will have to prevent any software that is not up to date from either accessing the parts that have been changed, or from running at all.
Any advice will be greatly appreciated - If I do have to write a system like that, I'd like to do it right.
Best practice would be to package the app up in an MSI and use Group Policy to push the updates out to each client.
If that's not possible then you need some way of informing the client app that it is out-of-date (simple check against a server holding the current version number would probably suffice) and refuse to work until an update patch is downloaded and installed - you could even launch this process from inside the app itself.
This answer may help you, I haven't personally used Wix but this seems to be along the lines of what you're looking for. Make sure to check out Lesson 4 in the linked tutorial, as this provides the details you would require.
I'm not sure where you would find best practices when it comes to updating, but in my personal opinion you shouldn't ever force a user to update unless it breaks the underlying application (like yours does). I would be very interested to hear if someone has a link to a list of best practices on this topic.
Edit
I was interested in possible best practices for updating so I started another question thread here. The general consensus in the answers is "Ask the user/client", but there may be some other details in the answers which may help you, I'm afraid I can't find any actual hard rules on the subject anywhere (which I was expecting).
Unfortunately, the problem is not more specific than that. I've found a few examples of people reporting similar problems by doing a Google search, but I can't find the part of the restore that is actually causing the problem, which might help me track it down on my own.
Suggestions for either resolving this problem or being able to track down the root cause would be appreciated.
There's one bug logged at bugs.mysql.com that references the error you describe:
"Bug #37253 Unable to restore backup file containing BLOBs"
The solution described in that bug is to increase the max_allowed_packet in the MySQL server configuration. The user confirmed that raising the value to 100M allowed him to restore his database.
ANOTHER FIX
I also had this problem! The answers online didn't seem to help (max_allowed_packet and others)
Here's what fixed mine:
Instead of running the Restore function, I imported through MySQL Migration Toolkit (installed with GUI Tools on Windows).
The Migration Toolkit also failed, but had descriptive errors in the Log on the final page. In my case, it was a few incorrect Date fields in my data (usually "0000-00-00") that wouldn't migrate correctly.
Fixing these dates in my tables solved the Restore problem.
Hope this helps somebody else out there.
I have had something similar in the past- it has something to do with how it was backed up. I think some applications put invalid comments in the backup files which cause errors.
My suggestion- if you are stuck trying to restore those files- is to incrementally start backing up from sections of the backup file and find what is causing the problems- which from what I recall the case for me was that they were some text in the file that was inconsequential to remove.