added models Thread and ThreadFiles in thread plugin
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009-2014, Tomasz Sowa
|
||||
* Copyright (c) 2009-2021, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -37,47 +37,67 @@
|
||||
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include "model.h"
|
||||
#include "date/date.h"
|
||||
#include "models/item.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
{
|
||||
|
||||
|
||||
namespace Thread
|
||||
{
|
||||
|
||||
|
||||
class Thread
|
||||
class Thread : public morm::Model
|
||||
{
|
||||
public:
|
||||
|
||||
long file_id;
|
||||
long replies;
|
||||
bool closed;
|
||||
|
||||
// the last file in a thread
|
||||
long last_item_id;
|
||||
pt::Date last_item_date_modification;
|
||||
long last_item_user_id;
|
||||
std::wstring last_item_guest_name;
|
||||
short int closed;
|
||||
Winix::Item last_item;
|
||||
|
||||
|
||||
|
||||
void Clear()
|
||||
{
|
||||
file_id = -1;
|
||||
closed = false;
|
||||
replies = 0;
|
||||
last_item_id = -1;
|
||||
last_item_user_id = -1;
|
||||
last_item_date_modification.Clear();
|
||||
last_item_guest_name.clear();
|
||||
}
|
||||
|
||||
Thread()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
|
||||
void fields()
|
||||
{
|
||||
field(L"file_id", file_id, morm::FT::primary_key);
|
||||
field(L"replies", replies);
|
||||
field(L"closed", closed);
|
||||
field(L"last_item", last_item, morm::FT::no_insertable | morm::FT::no_updatable | morm::FT::no_removable | morm::FT::foreign_key);
|
||||
}
|
||||
|
||||
|
||||
void table()
|
||||
{
|
||||
table_name(L"plugins", L"thread");
|
||||
}
|
||||
|
||||
|
||||
void after_insert()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool do_migration(int & current_table_version);
|
||||
|
||||
static Thread get_thread(morm::ModelConnector * model_connector, long file_id);
|
||||
static std::vector<Thread> get_threads(morm::ModelConnector * model_connector, const std::vector<long> & file_id_tab);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
bool do_migration_to_1();
|
||||
//bool do_migration_to_2();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user