Skip to content

Commit

Permalink
Merge pull request #1281 from fnc12/bugfix/1280
Browse files Browse the repository at this point in the history
Added schema_status for trigger_t
  • Loading branch information
fnc12 authored May 6, 2024
2 parents b8b5bfb + 31aca35 commit a5701d7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
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();
}

0 comments on commit a5701d7

Please sign in to comment.