add primary keys definition to migration rules

This commit is contained in:
2022-12-19 19:13:45 +01:00
parent 9c0cd6eb5e
commit 4583ab28ed
8 changed files with 56 additions and 12 deletions

View File

@@ -150,6 +150,7 @@ bool User::do_migration(int & current_table_version)
ok = ok && morm::Model::do_migration(current_table_version, 1, this, &User::do_migration_to_1);
ok = ok && morm::Model::do_migration(current_table_version, 2, this, &User::do_migration_to_2);
ok = ok && morm::Model::do_migration(current_table_version, 3, this, &User::do_migration_to_3);
return ok;
}
@@ -197,6 +198,17 @@ bool User::do_migration_to_2()
}
bool User::do_migration_to_3()
{
const char * str[] = {
"ALTER TABLE core.\"user\" ADD CONSTRAINT user_pkey PRIMARY KEY (id);",
};
size_t len = sizeof(str) / sizeof(const char*);
return db_query(str, len);
}
void User::display_name(EzcEnv & env)
{
std::wstring * dname = admin_env.get_wstr(L"display_name");