added alter table command to fluent query builder (progress)
This commit is contained in:
@@ -18,6 +18,23 @@ using namespace matador::sql;
|
||||
using namespace matador::query;
|
||||
using namespace matador::utils;
|
||||
|
||||
TEST_CASE_METHOD(QueryFixture, "Test alter table sql statement", "[query][alter][table]") {
|
||||
auto result = query::alter()
|
||||
.table("employees")
|
||||
.add_constraint("FK_employees_dep_id")
|
||||
.foreign_key("dep_id"_col)
|
||||
.references("departments", {"id"_col})
|
||||
.str(*db);
|
||||
|
||||
REQUIRE(result == R"(ALTER TABLE "employees" ADD CONSTRAINT FK_employees_dep_id FOREIGN KEY ("dep_id") REFERENCES departments ("id"))");
|
||||
result = query::alter()
|
||||
.table("employees")
|
||||
.drop_constraint("FK_employees_dep_id")
|
||||
.str(*db);
|
||||
|
||||
REQUIRE(result == R"(ALTER TABLE "employees" DROP CONSTRAINT FK_employees_dep_id)");
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(QueryFixture, "Test create table sql statement string", "[query]") {
|
||||
auto result = query::create()
|
||||
.table({"person"}, {
|
||||
|
||||
Reference in New Issue
Block a user