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

sync_schema_simulate when used with triggers #1280

Closed
trevornagy opened this issue May 5, 2024 · 11 comments · Fixed by #1281 or #1283
Closed

sync_schema_simulate when used with triggers #1280

trevornagy opened this issue May 5, 2024 · 11 comments · Fixed by #1281 or #1283
Labels

Comments

@trevornagy
Copy link

trevornagy commented May 5, 2024

Hi all,

I'm seeing weird behaviour with sync_schema_simulate, it does compile when this trigger is added to a make_storage:

sqlite_orm::make_trigger(
                "table_insert_InsertTest",
                sqlite_orm::after()
                    .insert()
                    .on<X>()
                    .begin(sqlite_orm::update_all(
                        sqlite_orm::set(
                            sqlite_orm::c(&X::Test) = 5)))
                .end()
            );

This is not high priority as when I comment out that trigger it builds fine & I can see the simulation results, and when I run sync_schema the trigger is created successfully & correctly.

The error message is (truncated to what I think are the important bits):
Error C2672 'sqlite_orm::internal::storage_t<sqlite_orm::internal::trigger_t<sqlite_orm::internal::trigger_base_t<X,void,sqlite_orm::internal::trigger_type_base_t>,sqlite_orm::internal::update_all_t<sqlite_orm::internal::set_t< ... ::schema_status': no matching overloaded function found

@fnc12
Copy link
Owner

fnc12 commented May 5, 2024

@trevornagy what kind of error you get?

@fnc12 fnc12 added bug and removed investigation labels May 5, 2024
@trevornagy
Copy link
Author

Updated the original bug with the error, sorry meant to include that to begin with.

@fnc12
Copy link
Owner

fnc12 commented May 5, 2024

oh kurwa, it is a bug! Looks like we never using triggers with sync_schema_simulate. It turned out that schema_status override for trigger_t doesn't exist. Let me fix it fast

@fnc12
Copy link
Owner

fnc12 commented May 5, 2024

PR is here #1281

@trueqbit trueqbit linked a pull request May 5, 2024 that will close this issue
@fnc12
Copy link
Owner

fnc12 commented May 6, 2024

merged. Please check

@fnc12 fnc12 closed this as completed May 6, 2024
@trevornagy
Copy link
Author

trevornagy commented May 6, 2024

@fnc12 Works for triggers, but just noticed this same issue happens with virtual tables (created with FTS5)

Should I create a new issue or should we reuse this?

@fnc12 fnc12 reopened this May 7, 2024
@fnc12
Copy link
Owner

fnc12 commented May 7, 2024

@trevornagy this issue is enough. I reopened it. feel free to reopen issues by yourself if you are sure something more has to be committed to the code base to fix the issue. Could you share repro code please?

@trevornagy
Copy link
Author

trevornagy commented May 7, 2024

Sure:

            auto storage = sqlite_orm::make_storage(
                path,
                sqlite_orm::make_virtual_table(
                "test", 
                sqlite_orm::using_fts5(
                    sqlite_orm::make_column("X", &Test::X))
            )
            );

            auto simulation = storage.sync_schema_simulate(false);

@fnc12
Copy link
Owner

fnc12 commented May 7, 2024

PR is here #1283

@trueqbit trueqbit linked a pull request May 7, 2024 that will close this issue
@fnc12
Copy link
Owner

fnc12 commented May 8, 2024

@trevornagy please check dev branch

@trevornagy
Copy link
Author

That fixes it, will close this issue now. Thanks!

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