Config server - refresh loads removed properties from database - spring-jdbc

I am using a composite config server profile to load properties from native and jdbc. My service starts up loading the properties from both native and database table without any issue.
At runtime, I am trying to update the properties in table and using actuator/refresh API to refresh the changes and I am facing issue as below.
The table has something similar to the below records.
key-1 xx service-1 dev latest
key-2 yy service-1 dev latest
Its updated as below, only the key column is changed.
service-1-key-1 yy service-1 dev latest
service-1-key-2 yy service-1 dev latest
When we refresh, I am getting all the 4 rows loaded into the Properties object, rather I am expecting only the 2 updated records.
Could anyone pls let me know if changing the key is doable and how to do this ?

Related

Delphi TFDTable SqLite problems

I deployed a sample.s3db SqLite to my Delphi android project.
set folder to:
fdconnection1.params.Database := system.ioutils.TPath.Combine( system.ioutils.TPath.GetDocumentsPath, 'sample.s3db');
in FDConnection1BeforeConnect event.
in Project-Deployment, set folder to assets\internal\ for Android
However, when I run the app, apparently it can find the physical file, but it says my tablename "Customers" is not found.
so in the BeforeConnect code, if I add a CREATE TABLE SQL create code if not exists, then everything works well but of course the table is empty (whereas my deployed sample.s3db is not empty) ... which proves the FILE sample.s3db was found and not corrupted, but somehow the Table was not found.
Even tried to change in BeforeConnect
FDConnection1.Params.Values['OpenMode'] := 'ReadWrite';
but it still doesn't work.
Any ideas the table name does not work?
I tried to change table name to all caps, in case Android is case-sensitive but it also does not work.
I recommend deleting your app from the android. This will clear out your data. Otherwise your new sqlite file is not deployed if the file already exists. This could happen for instance if you made an error in the path at one point in time so sqlite just created an empty database.
Your connection string looks correct and so does your destination path. Just to be safe, you may also want to clear out your other values for your connection.
fdConnection1.ConnectionDefName:= '';

Windows Universal existing app add new columns to SQLite table

We have a Windows 8.1 universal app published on the Windows store. Due to a requirement change now we need to add some fields to an existing table. We have used SQLite for Windows Runtime (Windows 8.1) and SQLite for Windows Phone 8.1. Now if we add some new fields to an existing table (by updating the model classes) will that cause any issues when the existing users update the app?
Instead of adding new columns if we create a new table, then can that cause any issue or will that be safer than adding new fields?
Adding a new column to an existing table is perfectly safe even with an existing SQLite database. Same goes for creating a new table. The concrete process depends on which SQLite library you are using.
If you are querying the database directly using SQL queries, then you will use ALTER TABLE ... ADD COLUMN query. If you are using library like sqlite-net-pcl, you get automatic migrations out of the box when you run the CreateTable method. As documentation says:
The automatic migration, currently, only supports adding new columns. If your classes have new properties that are not associated with columns in the table, then alter table ... add column commands will be executed to bring the database up to date. These new columns will not have default values and will therefore be null.
Tip
When you change the model, always test out the changes against the previous version of the database. This can be done in two ways:
Install the existing version from Store, launch the app and use it so that it contains some data, then close it and go to C:\Users\[UserName]\AppData\Local\Packages. Here navigate to Packages and there find your app's package folder. Inside go to LocalState where you should find your sqlite database. Copy it somewhere, uninstall the Store version and launch the new version for debugging and place a breakpoint in the App.xaml.cs constructor. When the debugger stops there, copy the original database back to the same location in app package LocalState folder and continue debugging. Observe if the database is migrated properly.
Using Git source control, go in history to the previous release commit, install the app for debugging, fill the DB with some data, close the app. Now go to the latest commit and launch app for debugging again. Verify the migration works.

WSO2 API Manager Sequences are getting overidded with initial version

I had created Message Mediation policy on an API published in WSO2 API Manager 1.10.0. Due to new requirements, I modified the policy in the /synapse/default/sequences/API-Name.xml .It works as expected but it gets reverted to the initial version when wso2am is restarted.
I am facing issue using the WSO2 Plugin with eclipse and hence updating the sequence in this manner. Is this the right way to update or Is there any other change i am missing?
It seems like the file is getting replaced with the value in the registry. This looks like a bug.
As a workaround, you can edit sequence saved in the registry.
Navigate to carbon console.
Home->Resources->Browse.
Go to path /_system/governance/apimgt/customsequences/in/
Edit as xml.
Save and restart.

Cannot fill azure db with data. WebPage is connected to database but don't want to create tables

I created website using asp.net MVC with Entity Framework Code First. It worked before on Windows Azure, the site was available publicly.
For some reason, I deleted database that was used to store data of my webpage. I created new one, similar to previous one.
I properly connected my site to database (in solution I clicked "Publish", in "Settings" there is place to type data about database, in "Destination Connection String" window I typed all needed data and clicked "Test Connection" - everything seems to be fine)
I published my site, the site works correctly, but when I go to page that gets data from database is see this error:
Invalid object name 'dbo.AspNetUsers'.
In Visual Studio in "SQL Server Explorer" I can see what is in my database. In fact, there is nothing inside (there is one table: "__MigrationHistory" and as I suspect this is created by default).
How can I generate all those tables again? It should generate database structure automatically.
PS: Accidentally I deleted "migations" from my project, do you think this is the cause?
This is not my projects blame, it works OK on localhost on my computer, when I delete localDB, it generates new one without any problem.
Yes, you need migrations. But you can always re-create them (well, if you removed them all it will be initial migration containing all of your previous migrations).
To quick fix you can backup and restore you database on the server. And if you need to re-create migrations do the following:
Backup all your data
Delete the entire database (local and remote), delete all migrations from code.
Create databases (local and remote one).
Run "add-migration Initial" command from PM console
Run "update-database" from PM console.
Upload your code to the server again. If database is empty, new initial migration should be automatically applied.

Correct location to create SQLite database tables in a Firefox addon

Very simply: What is the "correct" location to create SQLite database tables in a Firefox addon.
(If possible, I would like to create tables on installation of the addon).
It is best to create tables right before you start using the database. You cannot assume that doing it once (when the extension is installed) is sufficient - the user might remove your database later for one reason or another. So you would do something like this:
var dbConn = Services.storage.openDatabase(file);
if (!dbConn.tableExists("foo"))
{
// Database isn't initialized, do it now
dbConn.createTable("foo", "...");
}
This is also how I would update the database structure on extension updates - if after opening the database you see that the database structure is outdated then you update it. This way you will correctly handle the scenario that your extension was updated but the database was downgraded later at some point because of a backup being restored.

Resources