Code Monkey home page Code Monkey logo

Comments (6)

jzabroski avatar jzabroski commented on June 2, 2024

SQLite does not directly support schemas. You have to attach a database to the connection. This is definitely working correctly. What steps did you do to debug this?

If a schema-name is specified, it must be either "main", "temp", or the name of an attached database. In this case the new table is created in the named database. If the "TEMP" or "TEMPORARY" keyword occurs between the "CREATE" and "TABLE" then the new table is created in the temp database. It is an error to specify both a schema-name and the TEMP or TEMPORARY keyword, unless the schema-name is "temp". If no schema name is specified and the TEMP keyword is not present then the table is created in the main database.

https://www.sqlite.org/lang_createtable.html#the_create_table_command:~:text=If%20a%20schema,the%20main%20database.

from fluentmigrator.

msfreed avatar msfreed commented on June 2, 2024

Thanks for the response and documentation. You're right that the schema-name ("public") is not "main", "temp", or the name of the database. Any idea why this works in v3.3.2? If this was a breaking change, is there any FluentMigrator documentation that explains an upgrade path -- which maybe is follow the SQLite documentation for schema-name?

Here is how the service collection is being setup.

new ServiceCollection()
            .AddFluentMigratorCore()
            .ConfigureRunner(rb => rb.AddSQLite().WithGlobalConnectionString("Data Source=test;Mode=Memory;Cache=Shared").ScanIn(assemblies).For.Migrations())
            .BuildServiceProvider();

from fluentmigrator.

jzabroski avatar jzabroski commented on June 2, 2024

I don't know. We don't have regression tests for incorrect usage "working". What did you do to debug this so far?

My guess is the underlying library is doing magic for you.

from fluentmigrator.

msfreed avatar msfreed commented on June 2, 2024

I haven't debugged past updating to the latest versions of Microsoft.EntityFrameworkCore.Sqlite and FluentMigrator. Using v5.2.0 of FluentMigrator for SQLite does not work with the latest stable version (v8.0.3) of Microsoft.EntityFrameworkCore.Sqlite. Using v3.3.2 of FluentMigrator does work with the latest stable version of Microsoft.EntityFrameworkCore.Sqlite. So it seemed to me that it was a change in FluentMigrator, not the underlying library.

Based on the SQLite documentation you referenced, it sounds like there was probably a breaking change (intentional or not) to the SQLite runner to not support an incompatible SQLite schema-name -- that's fine. I was just trying to understand what the upgrade path from a FluentMigrator perspective was. Sounds like the answer is to use a valid SQLite schema-name.

from fluentmigrator.

jzabroski avatar jzabroski commented on June 2, 2024

I had a reply written but it got lost somehow.

Put simply, in 3.3, Sqlite Generator ignored the schema. In 5.0, it assumes you have attached a second database corresponding to the schema argument in the migration.

To revert to 3.3 behavior, remove the InSchema and With Schema from your code. If you deploy to multiple DB providers, use IfDatabase to handle SQLite and (processorId ) => processorId! = ProcessorId.SQLite

If you query your sqlite_schema table after running the migration against 3.3, the issue will be clear.

from fluentmigrator.

msfreed avatar msfreed commented on June 2, 2024

That makes sense. Thanks for the explanation and help.

from fluentmigrator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.