So I was trying to uninstall Date and Calendar so I could install their development versions that would work, and read that only way to do that would be to delete them from the data table, but I have now accidentally deletes something that the drupal core needs:

date_format_type table and now I get this error message when I try to empty cashes:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'my_table.date_format_type' doesn't exist: SELECT dft.type, dft.title, dft.locked FROM {date_format_type} dft ORDER BY dft.title; Array ( ) in _system_date_format_types_build() (line 3662 of /my/website/path/modules/system/system.module)

So my question is, can I get this table back anyway or if I have to make it there what are its contents?

Thank you in advance

Comments

Anonymous’s picture

Just recreate the table with these columns and values:

Columns:

type (varchar 64, primary key)
title (varchar 255)
locked (tinyint)

Rows:

long, Long, 1
medium, Medium, 1
short, Short, 1

There's also an index on the title column.

IinaK’s picture

Thank you millions, and I feel sosososososoo stupid now and should have taken a backup before doing anything, but I would need the colums for the other two tables too that I managed to delete at the same time -.-

These tables are: date_formats and date_format_locale

Thank you in advance again and would still apreciate the help (-___-)

Anonymous’s picture

No problem, copy these to separate .sql files and run them against the database (using phpmyadmin/navicat etc.):

date_formats:


SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `date_formats`
-- ----------------------------
DROP TABLE IF EXISTS `date_formats`;
CREATE TABLE `date_formats` (
  `dfid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'The date format identifier.',
  `format` varchar(100) NOT NULL COMMENT 'The date format string.',
  `type` varchar(64) NOT NULL COMMENT 'The date format type, e.g. medium.',
  `locked` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Whether or not this format can be modified.',
  PRIMARY KEY (`dfid`),
  UNIQUE KEY `formats` (`format`,`type`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Stores configured date formats.';

-- ----------------------------
--  Records of `date_formats`
-- ----------------------------
BEGIN;
INSERT INTO `date_formats` VALUES ('1', 'Y-m-d H:i', 'short', '1'), ('2', 'm/d/Y - H:i', 'short', '1'), ('3', 'd/m/Y - H:i', 'short', '1'), ('4', 'Y/m/d - H:i', 'short', '1'), ('5', 'd.m.Y - H:i', 'short', '1'), ('6', 'm/d/Y - g:ia', 'short', '1'), ('7', 'd/m/Y - g:ia', 'short', '1'), ('8', 'Y/m/d - g:ia', 'short', '1'), ('9', 'M j Y - H:i', 'short', '1'), ('10', 'j M Y - H:i', 'short', '1'), ('11', 'Y M j - H:i', 'short', '1'), ('12', 'M j Y - g:ia', 'short', '1'), ('13', 'j M Y - g:ia', 'short', '1'), ('14', 'Y M j - g:ia', 'short', '1'), ('15', 'D, Y-m-d H:i', 'medium', '1'), ('16', 'D, m/d/Y - H:i', 'medium', '1'), ('17', 'D, d/m/Y - H:i', 'medium', '1'), ('18', 'D, Y/m/d - H:i', 'medium', '1'), ('19', 'F j, Y - H:i', 'medium', '1'), ('20', 'j F, Y - H:i', 'medium', '1'), ('21', 'Y, F j - H:i', 'medium', '1'), ('22', 'D, m/d/Y - g:ia', 'medium', '1'), ('23', 'D, d/m/Y - g:ia', 'medium', '1'), ('24', 'D, Y/m/d - g:ia', 'medium', '1'), ('25', 'F j, Y - g:ia', 'medium', '1'), ('26', 'j F Y - g:ia', 'medium', '1'), ('27', 'Y, F j - g:ia', 'medium', '1'), ('28', 'j. F Y - G:i', 'medium', '1'), ('29', 'l, F j, Y - H:i', 'long', '1'), ('30', 'l, j F, Y - H:i', 'long', '1'), ('31', 'l, Y,  F j - H:i', 'long', '1'), ('32', 'l, F j, Y - g:ia', 'long', '1'), ('33', 'l, j F Y - g:ia', 'long', '1'), ('34', 'l, Y,  F j - g:ia', 'long', '1'), ('35', 'l, j. F Y - G:i', 'long', '1');
COMMIT;

date_format_locale:

SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `date_format_locale`
-- ----------------------------
DROP TABLE IF EXISTS `date_format_locale`;
CREATE TABLE `date_format_locale` (
  `format` varchar(100) NOT NULL COMMENT 'The date format string.',
  `type` varchar(64) NOT NULL COMMENT 'The date format type, e.g. medium.',
  `language` varchar(12) NOT NULL COMMENT 'A languages.language for this format to be used with.',
  PRIMARY KEY (`type`,`language`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Stores configured date formats for each locale.';
IinaK’s picture

Thank you thank you thank you... i just can't thank you all who helped me enough. Truly thankful ^^

bleckb’s picture

I'm hoping you could be so kind as to help me with a similar concern, as I'm a total databse noob. This is my error message:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'username_sitename.blocked_ips' doesn't exist: SELECT 1 FROM {blocked_ips} WHERE ip = :ip; Array ( [:ip] => 24.22.159.63 ) in drupal_is_denied() (line 1635 of /home/user/public_html/includes/bootstrap.inc).

I see that I need to create the table "blocked.ips," but in going into the database via phpmyadmin, I can only sorta make sense of things. I have no clue on how many rows or columns I need or how to configure them. I'm purely a copy and paste kinda person, able to plug in my user name and site, but little more.

Thanks in advance,