Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement missing SQLite features #1578

Open
mattbrailsford opened this issue Apr 9, 2022 · 3 comments
Open

Implement missing SQLite features #1578

mattbrailsford opened this issue Apr 9, 2022 · 3 comments
Assignees

Comments

@mattbrailsford
Copy link
Contributor

mattbrailsford commented Apr 9, 2022

Whilst looking through the SQLlite generator it appears that many of the features are just throwing compatibility notifications and whilst many of these features aren't implemented directly, some of them at least can be achieved by creating a temporary table with the new changes, copying the data over and then removing the old table

SQLite-ALTER-TABLE-Steps

Given this is the suggested approach to work around these limitations, would it be possible to implement these missing features in this way?

@jzabroski
Copy link
Collaborator

Syntactic parsing and semantic binding of database dictionary items is tricky. Every engine handles it differently. I had brainstormed some ideas to make this work smoothly awhile ago, but never wrote about it publicly (I didn't want others stealing the ideas and using it in competing projects without credit, since that has happened in the past and been discouraging).

The general idea is to be able to implement "continuations" in FluentMigrator, or some kind of system where you reify a generic Processor and ProcessorContext. Right now, FluentMigrator doesnt have a concept of a processor context in the way some threading frameworks like scala zio do.

Unlocking such functionality would solve some seemingly orthogonal issues, like fully offline migration scripting. Some of those ideas are documented loosely in the ADR folder.

You can put together a proposal at a high level and I can review it.

@mattbrailsford
Copy link
Contributor Author

In working on the PR #1585 I did attempt to look at this briefly, but I think the trickiest thing here is that realistically it's just gonna be error prone having any generic solution as the whole duplicating a table is fine in simple examples but as soon as you bring views, triggers, constraints into the mix, it becomes a chain reaction of necessary changes.

The SQLite docs does suggest querying the sqlite_schema table to extract SQL statements for all the affected elements (https://www.sqlite.org/lang_altertable.html#otheralter) but this would require migrations to perform quite a bit of logic, querying the table, fetching the results, potentially parsing them and altering the statements (if you don't want to be passing a full schema constantly) and re-applying them but my gut feeling is it's just a big risk that should really be handled by SQLite.

@jzabroski
Copy link
Collaborator

This is great research. What should I prioritize giving feedback to you on first?

I'm thinking of releasing a 4.0.0-beta.1 release to let people bang on the changes, once we square away some of these open threads. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants