add primary keys definition to migration rules
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2021, Tomasz Sowa
|
||||
* Copyright (c) 2021-2022, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -81,6 +81,7 @@ bool Group::do_migration(int & current_table_version)
|
||||
|
||||
ok = ok && morm::Model::do_migration(current_table_version, 1, this, &Group::do_migration_to_1);
|
||||
ok = ok && morm::Model::do_migration(current_table_version, 2, this, &Group::do_migration_to_2);
|
||||
ok = ok && morm::Model::do_migration(current_table_version, 3, this, &Group::do_migration_to_3);
|
||||
|
||||
return ok;
|
||||
}
|
||||
@@ -110,6 +111,15 @@ bool Group::do_migration_to_2()
|
||||
}
|
||||
|
||||
|
||||
bool Group::do_migration_to_3()
|
||||
{
|
||||
const char * str[] = {
|
||||
"ALTER TABLE core.\"group\" ADD CONSTRAINT group_pkey PRIMARY KEY (id);",
|
||||
};
|
||||
|
||||
size_t len = sizeof(str) / sizeof(const char*);
|
||||
return db_query(str, len);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user