Menu

[f1bb48]: / examples / pme_changelog.sql  Maximize  Restore  History

Download this file

93 lines (75 with data), 3.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
* phpMyEdit - instant MySQL table editor and code generator
*
* examples/pme_changelog.sql - create audit log table for action audit
* ____________________________________________________________________
*
* Copyright (c) 1999-2002 John McCreesh <jpmcc@users.sourceforge.net>
* Copyright (c) 2001-2002 Jim Kraai <jkraai@users.sourceforge.net>
* Versions 5.0 and higher developed by Ondrej Jombik <nepto@php.net>
* Versions 5.7.2 and higher developed by Yves De Billoëz
* Copyright (c) 2002-2006 Platon Group, http://platon.sk/
* All rights reserved.
*
* See README.md file for more information about this software.
* See COPYING file for license information.
*
* Download the latest version from
* https://sourceforge.net/projects/phpmariaedit/
*/
/* $Platon: phpMyEdit/examples/pme_changelog.sql,v 5.7.6 2024-03-01 12:57:07 Yves $ */
/* table definition for pme_changelog table from documentation, please note
that the `updated` field has been changed from NULL to CURRENT_TIMESTAMP
for its default value, changed its size as well,
please also note backticks have been used on all fields
*/
CREATE TABLE `pme_changelog` (
`updated` timestamp default CURRENT_TIMESTAMP,
`user` varchar(255) default NULL,
`host` varchar(255) default NULL,
`operation` varchar(255) default NULL,
`tab` varchar(255) default NULL,
`rowkey` varchar(255) default NULL,
`col` varchar(255) default NULL,
`oldval` blob default NULL,
`newval` blob default NULL
);
/* following statements are updates to the table structure that are different
from the documentation
*/
ALTER TABLE `pme_changelog`
COMMENT = 'all changes done by user using phpMyEdit are logged in this table';
/* follopwing statement creates a unique ID on the table,
this would not be required when using a database other than
mysql
*/
ALTER TABLE `pme_changelog`
ADD `rowid` INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY FIRST;
/* mysql uses longblob instead of blob for unlimited storage,
it could be required depending on your database model.
It is more safe to use longblob instead of blob.
*/
ALTER TABLE `pme_changelog` MODIFY COLUMN `oldval` LONGBLOB;
ALTER TABLE `pme_changelog` MODIFY COLUMN `newval` LONGBLOB;
/* change length from 14 to default, and also update value if record
is modified
*/
ALTER TABLE `pme_changelog`
MODIFY `updated` timestamp NOT NULL DEFAULT current_timestamp()
ON UPDATE current_timestamp();
INSERT INTO `pme_changelog`
(`user`, `operation`)
VALUES
('table creation script', 'table creation');
/*
-- trigger in compatible format for other databases (not MySQL)
-- please refer to examples for more advanced implementations
DROP TRIGGER IF EXISTS `pme_changelog_before_insert`;
CREATE TRIGGER `pme_changelog_before_insert` BEFORE INSERT ON `pme_changelog`
FOR EACH ROW
SET NEW.updated := current_timestamp();
*/
/* after creating the table, add following statement to the configuration
$opts['logtable'] = 'pme_changelog';
*/
/* eof */
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.