|
|
@ -60,6 +60,16 @@ namespace db { |
|
|
|
return *this; |
|
|
|
} |
|
|
|
|
|
|
|
CreateTableBuilder &fk(const std::string &key, const std::string &reference_table, const std::string &foreign_key, const std::string &opts = "") { |
|
|
|
m_table.body += "\tFOREIGN KEY (" + key + ") REFERENCES " + reference_table + "(" + foreign_key + ")" + opts + ",\n"; |
|
|
|
return *this; |
|
|
|
} |
|
|
|
|
|
|
|
CreateTableBuilder &constraint(const std::string &name, const std::string &opts) { |
|
|
|
m_table.body += "\tCONSTRAINT " + name + " UNIQUE (" + opts + "),\n"; |
|
|
|
return *this; |
|
|
|
} |
|
|
|
|
|
|
|
CreateTableBuilder &close() { |
|
|
|
m_table.body.pop_back(); |
|
|
|
m_table.body.pop_back(); |
|
|
|