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

@@ -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
@@ -196,6 +196,7 @@ bool ItemContent::do_migration(int & current_table_version)
ok = ok && morm::Model::do_migration(current_table_version, 3, this, &ItemContent::do_migration_to_3);
ok = ok && morm::Model::do_migration(current_table_version, 4, this, &ItemContent::do_migration_to_4);
ok = ok && morm::Model::do_migration(current_table_version, 5, this, &ItemContent::do_migration_to_5);
ok = ok && morm::Model::do_migration(current_table_version, 6, this, &ItemContent::do_migration_to_6);
return ok;
}
@@ -289,6 +290,13 @@ bool ItemContent::do_migration_to_5()
}
bool ItemContent::do_migration_to_6()
{
const char * str = "ALTER TABLE core.content ADD CONSTRAINT content_pkey PRIMARY KEY (id);";
return db_query(str);
}
bool ItemContent::has_access(const User * current_user, int mask) const
{
if( current_user )