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

Added schema_status for trigger_t #1281

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions dev/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,11 @@ namespace sqlite_orm {
}

protected:
template<class T, class... S>
sync_schema_result schema_status(const trigger_t<T, S...>&, sqlite3*, bool, bool*) {
return sync_schema_result::already_in_sync;
}

template<class... Cols>
sync_schema_result schema_status(const index_t<Cols...>&, sqlite3*, bool, bool*) {
return sync_schema_result::already_in_sync;
Expand Down
7 changes: 6 additions & 1 deletion include/sqlite_orm/sqlite_orm.h
Original file line number Diff line number Diff line change
Expand Up @@ -19396,7 +19396,7 @@ namespace sqlite_orm {
using statement_type = unindexed_t;

template<class Ctx>
std::string operator()(const statement_type& c, const Ctx& context) const {
serialize_result_type operator()(const statement_type& c, const Ctx& context) const {
return "UNINDEXED";
}
};
Expand Down Expand Up @@ -21948,6 +21948,11 @@ namespace sqlite_orm {
}

protected:
template<class T, class... S>
sync_schema_result schema_status(const trigger_t<T, S...>&, sqlite3*, bool, bool*) {
return sync_schema_result::already_in_sync;
}

template<class... Cols>
sync_schema_result schema_status(const index_t<Cols...>&, sqlite3*, bool, bool*) {
return sync_schema_result::already_in_sync;
Expand Down
12 changes: 12 additions & 0 deletions tests/trigger_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,15 @@ TEST_CASE("triggers_basics") {
REQUIRE(storage.count<TestDelete>() == 2);
}
}

TEST_CASE("issue1280") {
struct X {
int test = 0;
};
auto storage = make_storage(
"",
make_trigger("table_insert_InsertTest", after().insert().on<X>().begin(update_all(set(c(&X::test) = 5))).end()),
make_table("x", make_column("test", &X::test)));
storage.sync_schema();
storage.sync_schema_simulate();
}