mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 784623 - GNUCash does not work with sql backend.
Wherin the problem is that MySQL's TIMESTAMP has a date range of 1970-01-01 00:00:01 to 2038-01-19 03:14:07 and is unable to handle time_t of 0. MySQL's TIMESTAMP also assumes that input is in the server's timezone and adjusts it to UTC. GnuCash has already done that conversion.
This commit is contained in:
parent
937f8c5083
commit
9c4635e393
@ -130,7 +130,7 @@ GncDbiProviderImpl<DbType::DBI_MYSQL>::append_col_def (std::string& ddl,
|
||||
}
|
||||
else if (info.m_type == BCT_DATETIME)
|
||||
{
|
||||
type_name = "TIMESTAMP NULL DEFAULT 0";
|
||||
type_name = "DATETIME NULL DEFAULT '1970-01-01 00:00:00'";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ extern "C"
|
||||
static QofLogModule log_module = G_LOG_DOMAIN;
|
||||
|
||||
#define TABLE_NAME "entries"
|
||||
#define TABLE_VERSION 3
|
||||
#define TABLE_VERSION 4
|
||||
#define MAX_DESCRIPTION_LEN 2048
|
||||
#define MAX_ACTION_LEN 2048
|
||||
#define MAX_NOTES_LEN 2048
|
||||
@ -226,6 +226,7 @@ GncSqlEntryBackend::create_tables (GncSqlBackend* sql_be)
|
||||
/* Upgrade:
|
||||
1->2: 64 bit int handling
|
||||
2->3: "entered" -> "date_entered", and it can be NULL
|
||||
3->4: Use DATETIME instead of TIMESTAMP in MySQL
|
||||
*/
|
||||
sql_be->upgrade_table(TABLE_NAME, col_table);
|
||||
sql_be->set_table_version (TABLE_NAME, TABLE_VERSION);
|
||||
|
@ -56,7 +56,7 @@ extern "C"
|
||||
static QofLogModule log_module = G_LOG_DOMAIN;
|
||||
|
||||
#define TABLE_NAME "invoices"
|
||||
#define TABLE_VERSION 3
|
||||
#define TABLE_VERSION 4
|
||||
|
||||
#define MAX_ID_LEN 2048
|
||||
#define MAX_NOTES_LEN 2048
|
||||
@ -164,6 +164,7 @@ GncSqlInvoiceBackend::create_tables (GncSqlBackend* sql_be)
|
||||
/* Upgrade:
|
||||
1->2: 64 bit int handling
|
||||
2->3: invoice open date can be NULL
|
||||
3->4: Use DATETIME instead of TIMESTAMP in MySQL
|
||||
*/
|
||||
sql_be->upgrade_table(TABLE_NAME, col_table);
|
||||
sql_be->set_table_version (TABLE_NAME, TABLE_VERSION);
|
||||
|
@ -51,7 +51,7 @@ extern "C"
|
||||
static QofLogModule log_module = G_LOG_DOMAIN;
|
||||
|
||||
#define TABLE_NAME "prices"
|
||||
#define TABLE_VERSION 2
|
||||
#define TABLE_VERSION 3
|
||||
|
||||
#define PRICE_MAX_SOURCE_LEN 2048
|
||||
#define PRICE_MAX_TYPE_LEN 2048
|
||||
@ -148,7 +148,10 @@ GncSqlPriceBackend::create_tables (GncSqlBackend* sql_be)
|
||||
}
|
||||
else if (version < m_version)
|
||||
{
|
||||
/* Upgrade 64 bit int handling */
|
||||
/*
|
||||
1->2: Upgrade 64 bit int handling
|
||||
2->3: Use DATETIME instead of TIMESTAMP in MySQL
|
||||
*/
|
||||
sql_be->upgrade_table(TABLE_NAME, col_table);
|
||||
sql_be->set_table_version (TABLE_NAME, TABLE_VERSION);
|
||||
|
||||
|
@ -54,7 +54,7 @@ extern "C"
|
||||
static QofLogModule log_module = G_LOG_DOMAIN;
|
||||
|
||||
#define TABLE_NAME "slots"
|
||||
#define TABLE_VERSION 3
|
||||
#define TABLE_VERSION 4
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@ -958,11 +958,12 @@ GncSqlSlotsBackend::create_tables (GncSqlBackend* sql_be)
|
||||
PERR ("Unable to create index\n");
|
||||
}
|
||||
}
|
||||
else if (version < TABLE_VERSION)
|
||||
else if (version < m_version)
|
||||
{
|
||||
/* Upgrade:
|
||||
1->2: 64-bit int values to proper definition, add index
|
||||
2->3: Add gdate field
|
||||
3->4: Use DATETIME instead of TIMESTAMP in MySQL
|
||||
*/
|
||||
if (version == 1)
|
||||
{
|
||||
@ -982,7 +983,7 @@ GncSqlSlotsBackend::create_tables (GncSqlBackend* sql_be)
|
||||
PERR ("Unable to add gdate column\n");
|
||||
}
|
||||
}
|
||||
else if (version < m_version)
|
||||
else
|
||||
{
|
||||
sql_be->upgrade_table(TABLE_NAME, col_table);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ extern "C"
|
||||
static QofLogModule log_module = G_LOG_DOMAIN;
|
||||
|
||||
#define TRANSACTION_TABLE "transactions"
|
||||
#define TX_TABLE_VERSION 3
|
||||
#define TX_TABLE_VERSION 4
|
||||
#define SPLIT_TABLE "splits"
|
||||
#define SPLIT_TABLE_VERSION 4
|
||||
|
||||
@ -481,6 +481,7 @@ GncSqlTransBackend::create_tables (GncSqlBackend* sql_be)
|
||||
/* Upgrade:
|
||||
1->2: 64 bit int handling
|
||||
2->3: allow dates to be NULL
|
||||
3->4: Use DATETIME instead of TIMESTAMP in MySQL
|
||||
*/
|
||||
sql_be->upgrade_table(m_table_name.c_str(), tx_col_table);
|
||||
sql_be->set_table_version (m_table_name.c_str(), m_version);
|
||||
|
Loading…
Reference in New Issue
Block a user