pixeline/bugs

SQLSTATE[42S02]: Base table or view not found: 1146

Closed this issue · 7 comments

Hi, I'm getting this error:

Unhandled Exception

Message:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'databasenamedb.tags' doesn't exist

SQL: SELECT * FROM `tags` WHERE `id` = ? LIMIT 1

Bindings: array (
  0 => 1,
)
Location:

/home/public/bugsapp/app/laravel/database/connection.php on line 263


Google: SQLSTATE[42S02]: Base table or view not found: 1146
throws lots of results,
seems it's related to Laravel:
https://www.drupal.org/node/1882292

Can you check via phpmyadmin or any other mysql manager that you have a table called "Tags"?

Hi Alexandre, there's no table called tags

On Tue, Sep 30, 2014 at 7:40 AM, Alexandre Plennevaux <
notifications@github.com> wrote:

Can you check via phpmyadmin or any other mysql manager that you have a
table called "Tags"?


Reply to this email directly or view it on GitHub
#1 (comment).

Please Make a backup first of your database, then run these SQL queries and you should be good to go.

CREATE TABLE `tags` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `tag` varchar(255) NOT NULL,
  `bgcolor` varchar(50) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `tag` (`tag`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE 'utf8_general_ci';

-- create default tags
TRUNCATE `tags`;
INSERT INTO `tags` (`id`, `tag`, `bgcolor`, `created_at`, `updated_at`) VALUES
(1, 'status:open',  '#c43c35',  '2013-11-30 11:23:01',  '2013-11-30 11:23:01'),
(2, 'status:closed',    '#46a546',  '2013-11-30 11:23:01',  '2013-11-30 11:23:01'),
(3, 'type:feature', '#62cffc',  '2013-11-30 11:23:01',  '2013-11-30 11:23:01'),
(4, 'type:bug', '#f89406',  '2013-11-30 11:23:01',  '2013-11-30 11:23:01'),
(6, 'resolution:won''t fix',    '#812323',  '2013-11-30 11:23:01',  '2013-11-30 11:23:01'),
(7, 'resolution:fixed', '#048383',  '2013-11-30 11:23:01',  '2013-11-30 11:23:01'),
(8, 'status:testing',   '#6c8307',  '2013-11-30 11:23:01',  '2013-11-30 11:23:01');

-- create issue-tag relationship table
CREATE TABLE `projects_issues_tags` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `issue_id` bigint(20) unsigned NOT NULL,
  `tag_id` bigint(20) unsigned NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `issue_tag` (`issue_id`,`tag_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- import open/closed states
INSERT INTO projects_issues_tags (issue_id, tag_id, created_at, updated_at)
(
    SELECT id as issue_id, IF(status = 1, 1, 2) as tag_id, NOW(), NOW()
    FROM projects_issues
);

-- create activity type for tag update
INSERT INTO `activity` (`id`, `description`, `activity`)
VALUES ('6', 'Updated issue tags', 'update-issue-tags');

Great, that seems to have fixed the install.
Awesome!

Hello, I also had this issue and fixed it with the above SQL. Almost didn't see this though because it's closed, maybe it would be a good idea to reopen this issue until a fix is implemented? Thank you!

I've created a pull request with a fix for this