sqlite does not see new tables I added to the db - iphone

I have a database that has 7 tables and am calling them from my app simply using sqlite queries ...
am not new to this I made to apps work greatly even with encryption ..
am building now a new app and decide to add 2 new tables my db ,
but when I call them sqlites doesnot see them and return me with an error "No such table :history"
I have added these new tables simply using sqlitemanger add-on that comes with firefox as I always do.
In the terminal I can see them and I can get data from them , but that is not the case in my app..
do you have any idea?!!

Try to delete your app from simulator and run it again.I think your updated database is not copied.

Related

Flutter Sqlite Exception,No such table, SQL logic Error

I'm creating on my own a to-do app using Flutter. When I compile and try to insert a data in sqlite database, I got this error Flutter Sqlite Exception,No such table task, SQL logic Error.
Note: I use moor_ffi, moor
,and generate the database.g.dart file using command flutter packages pub run build_runner build.
From moor documentation:
Why am I getting no such table errors?
If you add another table after your app has already been installed,
you need to write a migration that covers creating that table. If
you’re in the process of developing your app and want to use un- and
reinstall your app instead of writing migrations, that’s fine too.
Please note that your apps data might be backed up on Android, so
manually deleting your app’s data instead of a reinstall is necessary
on some devices.
So everytime you have modified your database, you need to re-install your app or increase the schema version in your database.
#override
int get schemaVersion => 2;

Core Data - Changing attributes type

I have a project and I am using core data.
I have some entities, with attributes. When I started the project I choose some atributes and now I want to change their types (Int to String for example). ANd so I did it.
THe thing is, I am getting errors...
I checked the code, I think every thing is ok.
I even deleted the entire entity and made a new one with some name but it doesn't work.
How can I change it with success?
You can use code data migration for this by creating new version..
To change data types you need to create a new version of the database, you can not just simply modifie it because that way your users would have to delete and redownload your app every time you change something.
Here you can read how to do this.
The simulator or device you are running the app on still 'remembers' the old type and data. Simply hold down on the app and press the 'X' to delete it. When you press play in XCode it will reinstall the app with the new data types.

Heroku Dataclips don't see my database

I was trying to use dataclips but when I create a new one, no databases appear in the "Select database" dropdown... (I do have a Heroku/Postgres database for one of my apps)
I had the same error, created new dedicated database and the first one showed up (and after a while the new one too, which I deleted)
I've stopped using Dataclips for this. Instead, give QueryClips a shot. It lets you add your own (better-named) databases and saves your google sheet exports.

Create databasebase with entity framework code first approach

I do not want that my database is created when I insert a record. One reason is I do not want to create sample application, do an insert just to have a database...
I want that my database is created via the package manager console.
How can I do that?
It's a little unclear what you're asking, but I think you're trying to prevent the database from being created automatically from the application code.
The database is created on the first use of the DataContext. If you don't want the database to be created on the first use of the data context you can add Database.SetInitializer<YourContextClassHere>(null); to your Global.asax.cs file.
Then you could use the Update-Database cmdlet in Visual Studio to run the pending migrations including creating the database.

EF Code First not working on deploy hosting

I've an application using MVC and Code First for persistence.
Everything works fine in my development, but when I'm uploading to server, it doesnt work.
In any place i try to create a database, but it keeps me returning the following error: CREATE DATABASE permission denied in database 'master'.
The only thing that i do is override the OnModelCreating method just to map my app.
Anyone has this error?
Thanks
For a tutorial series that shows how to publish your Code First database and prevent Code First from trying to re-create the database in production, see
http://www.asp.net/mvc/tutorials/deployment-to-a-hosting-provider
The third tutorial in the series shows how to set up the Web.config file. The second shows how to deploy if you are using SQL Server Compact, the tenth shows how to deploy to full SQL Server.
You'll need to publish your database out to your hosting provider. Visual Studio has an easy way of doing this. In the server explorer tab, you can navigate to your database, right click and choose publish to provider. By doing this, you will not only export the scheme of your database, but you can also export out all data, stored procs, views etc.
You will need to adjust your code so that you are no longer trying to create a database on code run. Typically this approach is used for development, and you are no longer in development if you're moving to a hosting company. The changes may be in your global.asax, the dbcontext of your solution and any other place where you modified it to create the scheme for the database.
Hope this helps you some, and good luck on your project.