Hi I want to add some data during extension installation ...
I've added an SQL statement after table creation but that will be ignored during installation.
#
# Insert für start einstellungen
#
INSERT INTO tx_rere_domain_model_intervall (type,aktuell) VALUES ('studienhalbjahr','WS14/15');
This code is directly after the Create Statement of tx_rere_domain_model_intervall
UPDATE:
# TYPO3 Extension Manager dump 1.1
#
#--------------------------------------------------------
#
# Table structure for table 'tx_rere_domain_model_interval'
#
DROP TABLE IF EXISTS tx_rere_domain_model_intervall;
CREATE TABLE tx_rere_domain_model_intervall (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
type varchar(255) DEFAULT '' NOT NULL,
aktuell varchar(255) DEFAULT '' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
starttime int(11) unsigned DEFAULT '0' NOT NULL,
endtime int(11) unsigned DEFAULT '0' NOT NULL,
t3ver_oid int(11) DEFAULT '0' NOT NULL,
t3ver_id int(11) DEFAULT '0' NOT NULL,
t3ver_wsid int(11) DEFAULT '0' NOT NULL,
t3ver_label varchar(255) DEFAULT '' NOT NULL,
t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
t3ver_stage int(11) DEFAULT '0' NOT NULL,
t3ver_count int(11) DEFAULT '0' NOT NULL,
t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
t3ver_move_id int(11) DEFAULT '0' NOT NULL,
sys_language_uid int(11) DEFAULT '0' NOT NULL,
l10n_parent int(11) DEFAULT '0' NOT NULL,
l10n_diffsource mediumblob,
PRIMARY KEY (uid),
KEY parent (pid),
KEY t3ver_oid (t3ver_oid,t3ver_wsid),
KEY language (l10n_parent,sys_language_uid)
);
INSERT INTO tx_rere_domain_model_intervall (type,aktuell) VALUES ('studienhalbjahr','WS14/15');
To include static data with your extension, you must place the SQL INSERT statements in a file named ext_tables_static+adt.sql, which should be located in the root directory of your extension.
The content of this file will be imported to the TYPO3 Database when importing the extension with the extension manager.
For a working example please refer to the static_info_tables extension.
For me the ext_tables_static+adt.sql dosn't work ... I've done a workarround with prefilling the table if the table is empty!
When working with ext_tables_static+adt.sql, remember to delete the row for your plugin in the table sys_registry if the import doesn't work.
Typo3 sets a flag after the import has been done once and future imports will be ignored.
Related
I am installing revive ad server on Ubuntu 20.4 which is having MySQL Version 8.0.23. The Log I got from file /var/debug.log is
[Last executed query: CREATE TABLE `bv_banners` (`bannerid` MEDIUMINT(9) AUTO_INCREMENT NOT NULL, `campaignid` MEDIUMINT(9) DEFAULT 0 NOT NULL, `contenttype` ENUM('gif','jpeg','png','html','swf','dcr','rpm','mov','txt') DEFAULT 'gif' NOT NULL, `pluginversion` MEDIUMINT(9) DEFAULT 0 NOT NULL, `storagetype` ENUM('sql','web','url','html','network','txt') DEFAULT 'sql' NOT NULL, `filename` VARCHAR(255) DEFAULT '' NOT NULL, `imageurl` VARCHAR(255) DEFAULT '' NOT NULL, `htmltemplate` MEDIUMTEXT NOT NULL, `htmlcache` MEDIUMTEXT NOT NULL, `width` SMALLINT(6) DEFAULT 0 NOT NULL, `height` SMALLINT(6) DEFAULT 0 NOT NULL, `weight` TINYINT(4) DEFAULT 1 NOT NULL, `seq` TINYINT(4) DEFAULT 0 NOT NULL, `target` VARCHAR(16) DEFAULT '' NOT NULL, `url` TEXT NOT NULL, `alt` VARCHAR(255) DEFAULT '' NOT NULL, `statustext` VARCHAR(255) DEFAULT '' NOT NULL, `bannertext` TEXT NOT NULL, `description` VARCHAR(255) DEFAULT '' NOT NULL, `adserver` VARCHAR(255) DEFAULT '' NOT NULL, `block` INT(11) DEFAULT 0 NOT NULL, `capping` INT(11) DEFAULT 0 NOT NULL, `session_capping` INT(11) DEFAULT 0 NOT NULL, `compiledlimitation` TEXT NOT NULL, `acl_plugins` TEXT DEFAULT NULL, `append` TEXT NOT NULL, `bannertype` TINYINT(4) DEFAULT 0 NOT NULL, `alt_filename` VARCHAR(255) DEFAULT '' NOT NULL, `alt_imageurl` VARCHAR(255) DEFAULT '' NOT NULL, `alt_contenttype` ENUM('gif','jpeg','png') DEFAULT 'gif' NOT NULL, `comments` TEXT DEFAULT NULL, `updated` DATETIME NOT NULL, `acls_updated` DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL, `keyword` VARCHAR(255) DEFAULT '' NOT NULL, `transparent` TINYINT(1) DEFAULT 0 NOT NULL, `parameters` TEXT DEFAULT NULL, `status` INT(11) DEFAULT 0 NOT NULL, `ext_bannertype` VARCHAR(255) DEFAULT NULL, `prepend` TEXT NOT NULL, `iframe_friendly` TINYINT(1) DEFAULT 1 NOT NULL, PRIMARY KEY (bannerid)) ENGINE = INNODB]
[Native message: Invalid default value for 'acls_updated']
I got to know adserver is not officially supporting mysql version 8. But some people are able to run fine. I want to know how.
Here is the refrence I got
https://github.com/revive-adserver/revive-adserver/issues/1048
I want to run this.
Thanks in advance.
set sql_mode='40'' to sql_mode=''
in 5 files;
lib/OA/DB.php
lib/OA/DaL/Delivery/mysql.php
lib/OA/Dal/Delivery/mysqli.php
lib/OA/Upgrade/DB_Upgrade.php
lib/OA/Upgrade/Upgrade.php
and use table type INNODB
This trick works for me. I am calling this as a trick because it is not officially supported.
I got solution from github.
Here is the refrence
https://github.com/revive-adserver/revive-adserver/issues/1048
I have a main table called "callshopusers"
CREATE TABLE IF NOT EXISTS `callshopusers` (
`id_callshopuser` int(11) NOT NULL AUTO_INCREMENT,
`id_callshop` int(11) NOT NULL,
`id_client` int(11) NOT NULL,
`client_type` int(11) NOT NULL,
PRIMARY KEY (`id_callshopuser`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=14 ;
But when I try to delete data from this table, it doesn't work. Here id_client column is used in another table as a Primary key.
My query for delete is:
$sql="DELETE FROM callshopusers WHERE id_callshopusers=$id";
But it doesn't work.
You have a typo in id_callshopusers, should be id_callshopuser without 's'
$sql="DELETE FROM callshopusers WHERE id_callshopusers=$id";
When I try to create an admin_user table on the server I get this error:
Base table or view not found: 1146 Table
The DDL:
CREATE TABLE IF NOT EXISTS `admin_user` (
`user_id` mediumint(9) unsigned NOT NULL AUTO_INCREMENT,
`firstname` varchar(32) NOT NULL DEFAULT '',
`lastname` varchar(32) NOT NULL DEFAULT '',
`email` varchar(128) NOT NULL DEFAULT '',
`username` varchar(40) NOT NULL DEFAULT '',
`password` varchar(40) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified` datetime DEFAULT NULL,
`logdate` datetime DEFAULT NULL,
`lognum` smallint(5) unsigned NOT NULL DEFAULT '0',
`reload_acl_flag` tinyint(1) NOT NULL DEFAULT '0',
`is_active` tinyint(1) NOT NULL DEFAULT '1',
`extra` text,
PRIMARY KEY (`user_id`),
UNIQUE KEY `UNQ_ADMIN_USER_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
What is wrong?
Hello I want to create class that is bassed on mm table with some special fields. I`m writing plugin that is some kind of message plugin and now I want to mark in mm table (message_frontenduser_mm) is message is read by user and the creation date for each user.
So I've created Model in my ext and mapping for this table
config.tx_extbase.persistence.classes {
Tx_Messages_Domain_Model_UserMessage {
mapping {
table = tx_messages_message_frontenduser_mm
recordType = Tx_Messages_Domain_Model_UserMessage
columns {
uid_local.mapOnProperty = message
uid_foreign.mapOnPropery = user
is_read.mapOnProperty = isRead
creation_date.mapOnProperty = creationDate
}
}
}
}
But in every query T3 is tring to look in tx_messages_domain_model_usermessage table not in tx_messages_message_frontenduser_mm
What am I doing wrong ? How can I map class on this table ?
Below sql of my mm table
CREATE TABLE tx_messages_message_frontenduser_mm (
uid int(11) unsigned DEFAULT '0' NOT NULL,
uid_local int(11) unsigned DEFAULT '0' NOT NULL,
uid_foreign int(11) unsigned DEFAULT '0' NOT NULL,
is_read tinyint(1) unsigned DEFAULT '0' NOT NULL,
creation_date int(11) unsigned DEFAULT '0' NOT NULL,
record_type varchar(255) DEFAULT '' NOT NULL,
sorting int(11) unsigned DEFAULT '0' NOT NULL,
sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL,
KEY uid_local (uid_local),
KEY uid_foreign (uid_foreign)
);
I Found the problem
it is
tableName = my_table
not
table = my_table
lol :D
SELECT M.msg_id, M.uid_fk, M.message, M.created,
U.fname, U.lname, M.uploads
FROM messages M, users_friends F, users U
WHERE M.uid_fk=F.friendID
and F.userID = '5'
and status='2'
Building a facebook-like wall and want to grab messages(updates) from friends.
The query above returns an empty set, even though I've made sure there are messages from user 5 in the table.
Schema:
CREATE TABLE IF NOT EXISTS `messages` (
`msg_id` int(11) NOT NULL AUTO_INCREMENT,
`message` varchar(200) CHARACTER SET utf8 DEFAULT NULL,
`uid_fk` int(11) DEFAULT NULL,
`ip` varchar(30) DEFAULT NULL,
`created` int(11) DEFAULT '1269249260',
`uploads` varchar(30) DEFAULT NULL,
PRIMARY KEY (`msg_id`),
KEY `uid_fk` (`uid_fk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=263 ;
CREATE TABLE IF NOT EXISTS `users` (
`fname` varchar(15) NOT NULL,
`lname` varchar(15) NOT NULL,
`userID` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(23) NOT NULL,
`email` varchar(50) NOT NULL,
`password` varchar(32) NOT NULL,
`DOB` date DEFAULT NULL,
`sex` varchar(1) DEFAULT NULL,
`about` text NOT NULL,
`location` varchar(20) DEFAULT NULL,
`last_login` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_level` int(11) NOT NULL DEFAULT '0',
`profile_image` varchar(200) NOT NULL,
`profile_image_small` varchar(200) NOT NULL,
PRIMARY KEY (`userID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=19 ;
CREATE TABLE IF NOT EXISTS `users_friends` (
`userID` int(11) NOT NULL,
`friendID` int(11) NOT NULL,
`status` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`userID`,`friendID`),
KEY `fk_users_has_friends_users1` (`userID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
You are single quoting your INT values in the WHERE clause → '5' & '2'.
Also, try JOINs.
SELECT M.msg_id,
M.uid_fk,
M.message,
M.created,
U.fname,
U.lname,
M.uploads
FROM messages M
INNER JOIN users_friends F ON F.friendID = M.uid_fk
AND F.userID = 5
AND F.status = 2
INNER JOIN users U ON U.userID = F.friendID;