Skip to content

Recording Statistics with MySQL

Peter Chapman edited this page Jan 20, 2023 · 6 revisions

The GoTo.Bible application supports recording of statistics using Microsoft SQL Server, MariaDB, or MySQL. This is often required for reporting back to copyright providers.

Table Structure

CREATE TABLE IF NOT EXISTS `Statistics` (
	`Id` BIGINT NOT NULL AUTO_INCREMENT,
	`IpAddress` VARCHAR(39) NULL,
	`ForwardedFor` LONGTEXT NULL,
	`PrimaryTranslation` VARCHAR(50) NOT NULL,
	`PrimaryProvider` VARCHAR(50) NOT NULL,
	`SecondaryTranslation` VARCHAR(50) NULL,
	`SecondaryProvider` VARCHAR(50) NULL,
	`Passage` LONGTEXT NOT NULL,
	`AccessedAt` DATETIME NOT NULL,
	PRIMARY KEY (`Id`)
);

User Secret Configuration

The following configuration can be using with MySQL, assuming you have already created a database called GoToBible:

dotnet user-secrets set "Providers:Statistics:DatabaseProvider" "mysql"
dotnet user-secrets set "Providers:Statistics:ConnectionString" "Server=localhost;Database=GoToBible;User=root;Password="

The following configuration can be using with MariaDB, assuming you have already created a database called GoToBible:

dotnet user-secrets set "Providers:Statistics:DatabaseProvider" "mariadb"
dotnet user-secrets set "Providers:Statistics:ConnectionString" "Server=localhost;Database=GoToBible;User=root;Password="

The following configuration can be using with MySQL if you are running a specific version of MySQL:

dotnet user-secrets set "Providers:Statistics:DatabaseProvider" "mysql"
dotnet user-secrets set "Providers:Statistics:DatabaseVersion" "8.0.31"
dotnet user-secrets set "Providers:Statistics:ConnectionString" "Server=localhost;Database=GoToBible;User=root;Password="