I have several tables with columns referencing the standard
asp.net core AspNetUsers Column. That worked without problems, but now i added a new Table and all over sudden I get an error when trying to add my new table:
Column 'xyz.AspNetUsers.Id' is not of same collation as
referencing column 'Device.LastModifiedById' in foreign key
'FK_Device_AspNetUsers_LastModifiedById'.
Everything is created code-first with EntityFrameworkCore 1.1.1 (Tools 1.1.0), execept a different schema (modelBuilder.HasDefaultSchema("xyz") I use all standard-values, and did not change anything with Collations.
Has somebody had a similar issue? Thanks in advance!
Narf, turned out I had restored my DEV-Database earlier from Production-Database... and simply missed selecting the proper Collation as Database-Default.
Related
We've been using flyway for schema migrations, versions 4.x/5.x - the table is named schema_version. Now we are looking to move to latest version, 7.x. I've seen some information that states the new table name has changed to flyway_schema_history, but then I just saw this where the table name looks to be named flyway_history_schema (https://flywaydb.org/documentation/concepts/migrations#schema-history-table).
Can anyone who uses flyway confirm the schema history table name?
Thanks,
Scott
The default name for the table is indeed flyway_schema_history
The part of the documentation you linked to is referring to the situation when Flyway is not allowed to create new schemas by its configuration, and you need to manually create a schema for that table to live in. "flyway_history_schema" is a suggested name for the schema, not the table.
When I scaffold my database get the following error:
Referenced table `contentcategory` is not in dictionary.
Referenced table `contentcategory` is not in dictionary.
Referenced table `contenttype` is not in dictionary.
Referenced table `content` is not in dictionary.
I Use Mysql and Pomelo.EntityFrameworkCore.MySql
This is very likely to be a casing issue, where MySQL assumes the table name to be contentcategory for the reference, while it is actually something like ContentCategory.
We have a pull request for this open since April, that looks abandoned by the original contributor.
I will fix the PR and merge it, so that the workaround for this issue will be part of our nightly builds as of tomorrow.
The linked PR also contains the information of how this issue can arise:
Okay, that is in line with what I experienced as well. So manually (either by writing the name in the GUI or by using an ALTER TABLE statement directly) adding a reference with different casing (on a server with case insensitive file name handling) or disabling SQL Identifiers are Case Sensitive [in MySQL Workbench] can lead to this result.
Technically, this is a MySQL or Workbench bug, but we will implement a workaround for it anyway.
When using code first i have this scenario:
I have an existing database where tables are created with Code first.
Know suddenly there needs to be a change in the program and there is a new table that is related to the Primary table (with existing data in it).
Example there is a table "Package" and a the new table is "PackageState"
Steps
Create new domain Packagestate with some properties.
Add property packagestate (FK) in Package domain.(P) Note that the packagestate is required.
In the seeding class i add some data for the packagestate
From this point i have a problem, because the value is required, and the seeding method is only executed after update.
How do you solve this with code first?
Because it's possible that there is a new migration file as well.
I need some feedback on this thanks in advance!
You must make your foreign key nullable and update your database
after that you can run your seed.
and after all you should change your foreign key to not null.
I am reading through the book EF Code First by Julie Lerman. In the book, a database is created which contains tables generated from the domain model, as well a table named edmmetadatatable. Apparently, this table is needed for checking if there are any changes made to the other tables.
But, I don't have it. And I don't know how to get it.
One thing I did differently from the book was that I added my own connection string since code first defaults for SQLEXPRESS and I don't have SQLEXPRESS.
The book is covering Entity Framework 4.2 which uses the EdmMetadata table. When migrations were introduced in EF 4.3, a __MigrationHistory table was introduced instead.
See here for more information.
I read some similar questions, but I still can not figure out how to export data or schemas from an exiting database using liquibase. The database i am using is sqlite, and I always got problem.
java -jar liquibase-1.9.3.jar --driver=org.sqlite.JDBC --classpath=lib/sqlite-jdbc-3.7.2.jar --changeLogFile=test.data --url=jdbc:sqlite:test.db --diffTypes="data" generateChangeLog
the error is: Migration Failed: no such column: 'DECIMAL_POINTS'
I just have a testing table with 2 fields: ID (integer type), and name (VARCHAR type).
Can somebody help? Thanks.
I couldn't find more examples about using liquibase with sqlite database. So, I tested and figured out by myself, and commented below:
You need to pick up right jdbc engine for liquibase, when I changed sqlitejdbc engine from sqlite-jdbc-3.7.2.jar to sqlitejdbc-v056.jar (http://www.zentus.com/sqlitejdbc/), it works. So it is important to pick up right one.