mirror of
https://bitbucket.org/anguist/ntpa
synced 2025-10-05 10:30:56 +00:00
Fix database issues
This commit is contained in:
7
CHANGES
7
CHANGES
@ -1,3 +1,8 @@
|
||||
v0.7.6
|
||||
- Corrected faulty version numbers in v0.7.5
|
||||
- Improved logging of database errors
|
||||
- Sanitized default configuration
|
||||
|
||||
v0.7.5
|
||||
- Change build script to autotools
|
||||
- Updated PostgreSQL data provider to v3.1.9
|
||||
@ -41,4 +46,4 @@ v0.7.0
|
||||
- Updated jQuery to v2.2.4
|
||||
|
||||
|
||||
Changes prior to 0.7.0 is not recorded.
|
||||
Changes prior to 0.7.0 are not recorded.
|
||||
|
25
DATABASE
Normal file
25
DATABASE
Normal file
@ -0,0 +1,25 @@
|
||||
Manually setup a MySQL user on localhost
|
||||
----------------------------------------
|
||||
|
||||
Log in as root:
|
||||
# mysql -uroot -p
|
||||
|
||||
Create database and grant privileges:
|
||||
# CREATE DATABASE ntpa;
|
||||
# CREATE USER 'ntpau'@'localhost' IDENTIFIED BY 'password';
|
||||
# GRANT ALL PRIVILEGES ON ntpa . * TO 'ntpau'@'localhost';
|
||||
# FLUSH PRIVILEGES;
|
||||
|
||||
|
||||
Manually setup a MySQL user on a foreign host
|
||||
---------------------------------------------
|
||||
|
||||
Log in as root:
|
||||
# mysql -uroot -p
|
||||
|
||||
Create database and grant privileges:
|
||||
# CREATE DATABASE ntpa;
|
||||
# CREATE USER 'ntpau'@'192.168.1.1' IDENTIFIED BY 'password';
|
||||
# GRANT ALL PRIVILEGES ON ntpa . * TO 'ntpau'@'192.168.1.1';
|
||||
# FLUSH PRIVILEGES;
|
||||
|
@ -53,20 +53,23 @@ namespace Ntp.Analyzer.Data.Log
|
||||
|
||||
internal static void DeleteError(this LogBase log, string table, Exception e)
|
||||
{
|
||||
log.WriteLine($"Error while deleting from table {table}: {e.Message}", Severity.Error);
|
||||
log.WriteLine($"Error while deleting from table {table}: {e.Message}", Severity.Warn);
|
||||
log.WriteLine(e);
|
||||
Advice(log);
|
||||
}
|
||||
|
||||
internal static void InsertError(this LogBase log, string table, Exception e)
|
||||
{
|
||||
log.WriteLine($"Error while inserting into table {table}: {e.Message}", Severity.Error);
|
||||
log.WriteLine($"Error while inserting into table {table}: {e.Message}", Severity.Warn);
|
||||
log.WriteLine(e);
|
||||
Advice(log);
|
||||
}
|
||||
|
||||
internal static void ReadError(this LogBase log, string table, Exception e)
|
||||
{
|
||||
log.WriteLine($"Error while reading from table {table}: {e.Message}", Severity.Error);
|
||||
log.WriteLine($"Error while reading from table {table}: {e.Message}", Severity.Warn);
|
||||
log.WriteLine(e);
|
||||
Advice(log);
|
||||
}
|
||||
|
||||
internal static void TableExists(this LogBase log, string table)
|
||||
@ -78,8 +81,14 @@ namespace Ntp.Analyzer.Data.Log
|
||||
|
||||
internal static void UpdateError(this LogBase log, string table, Exception e)
|
||||
{
|
||||
log.WriteLine($"Error while updating table {table}: {e.Message}", Severity.Error);
|
||||
log.WriteLine($"Error while updating table {table}: {e.Message}", Severity.Warn);
|
||||
log.WriteLine(e);
|
||||
Advice(log);
|
||||
}
|
||||
|
||||
private static void Advice(LogBase log)
|
||||
{
|
||||
log.WriteLine($"Try setting 'Create Yes' in configuration.", Severity.Notice);
|
||||
}
|
||||
}
|
||||
}
|
@ -109,6 +109,11 @@ namespace Ntp.Data.Log
|
||||
|
||||
internal static void SchemaVersionError(this LogBase log, int database, int application)
|
||||
{
|
||||
if (database == -1)
|
||||
{
|
||||
log.WriteLine("Database version is -1. Did you set 'Create Yes' in configuration ?", Severity.Notice);
|
||||
}
|
||||
|
||||
log.WriteLine(
|
||||
$"Application version is {application} but database version is {database}.",
|
||||
Severity.Error);
|
||||
|
Reference in New Issue
Block a user