query builder progress
This commit is contained in:
@@ -52,7 +52,7 @@ TEST_CASE_METHOD(QueryFixture, "Test create table sql statement string", "[query
|
||||
.table("person")
|
||||
.columns({
|
||||
attribute("id", basic_type::type_uint32),
|
||||
attribute("name", basic_type::type_varchar, 255),
|
||||
attribute("name", basic_type::type_varchar, {255, constraints::Unique}),
|
||||
attribute("age", basic_type::type_uint16),
|
||||
attribute("address", basic_type::type_uint32)
|
||||
})
|
||||
@@ -62,9 +62,7 @@ TEST_CASE_METHOD(QueryFixture, "Test create table sql statement string", "[query
|
||||
})
|
||||
.compile(*db);
|
||||
|
||||
REQUIRE(ctx.sql == R"##(CREATE TABLE "person" ("id" BIGINT NOT NULL, "name" VARCHAR(255) NOT NULL UNIQUE, "age" INTEGER NOT NULL, "address" BIGINT NOT NULL, CONSTRAINT PK_person PRIMARY KEY (id)))##");
|
||||
REQUIRE(ctx.additional_commands.size() == 1);
|
||||
REQUIRE(ctx.additional_commands[0].sql == R"##(ALTER TABLE "person" ADD CONSTRAINT FK_person_address FOREIGN KEY ("address") REFERENCES address(id))##");
|
||||
REQUIRE(ctx.sql == R"##(CREATE TABLE "person" ("id" BIGINT NOT NULL, "name" VARCHAR(255) NOT NULL UNIQUE, "age" INTEGER NOT NULL, "address" BIGINT NOT NULL, CONSTRAINT PK_person PRIMARY KEY (id), CONSTRAINT FK_person_address FOREIGN KEY (address)))##");
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(QueryFixture, "Test drop table sql statement string", "[query]") {
|
||||
|
||||
Reference in New Issue
Block a user