yapro/history-data

There is no license information available for the latest version (v1.0.1) of this package.

v1.0.1 2022-08-06 11:01 UTC

This package is not auto-updated.

Last update: 2024-05-01 19:30:18 UTC


README

Run tests:

vendor/bin/phpunit tests/Functional/

How to configure Symfony

Add to config/services.yaml

    YaPro\Helper\:
      resource: '../vendor/yapro/helpers/src/*'

    YaPro\HistoryData\:
        resource: '../vendor/yapro/history-data/src/*'

    yapro.pdo.sqlite:
      class: YaPro\HistoryData\HistoryDataManager
      factory: ['YaPro\HistoryData\HistoryDataManager', 'getPdo']
      arguments: ['%env(FILE_PATH_TO_SQLITE_DB)%',]

    YaPro\HistoryData\HistoryDataManager:
      arguments: ['@yapro.pdo.sqlite',]

File mydb.sq3 is ready for use.

But, if you want to have own sqlite db - make it:

sudo apt install sqlite3
sqlite3 mydb.sq3

Tip: https://www.sqlite.org/cli.html

And make the table in sqlite db:

create table history_data
(
    createdAt INTEGER default CURRENT_TIMESTAMP not null,
    ipAddress TEXT not null,
    userAgent TEXT not null,
    operationName TEXT not null,
    entityName TEXT not null,
    entityId TEXT not null,
    jsonData TEXT not null
);

And don`t forgеt, almost every sqlite table has a hidden AUTOINCREMENT column rowid:

SELECT rowid, * FROM history_data