trails database

5 replies [Last post]
code3
Offline
Last seen: 10 years 50 weeks ago
Joined: 2011-08-03

Hi,

under

Drupal 7 Core Concepts > How to Work With the Database
Setting up the install file and generating a schema with the schema module

My trails_history table is not being created. I followed the video three times and still no table after I install the module. Please help - thanks!

Chris Shattuck
Offline
Last seen: 15 weeks 6 days ago
Joined: 2009-08-16
Hi code3, One thing you can

Hi code3,

One thing you can try is completely uninstalling the module and re-installing it. Perhaps it did not upgrade properly at some point and that will fix it.

If that doesn't work, can you paste the content of your current trails.install file so I can take a look? Maybe there's something missing in there.

Cheers!
Chris

fauzidar
Offline
Last seen: 10 years 28 weeks ago
Joined: 2010-12-05
happen to me too..

i follow videos step (4:57). Copy from source code (03.trails.install.generate-schema) and no table is created.

anyway this is the content of current trails.install file. thanks

<?php
// $Id$

/**
* @file
* Install, update and uninstall functions for the trails module
*
* Download the schema module to auto-generate a schema array for a table:
* http://drupal.org/project/schema.
*
* In this file, we grab the output from the schema 'info' page, paste it
* in here and update the descriptions.
*/

/**
* Implements hook_install().
*/
function trails_install() {
}

/**
* Implements hook_uninstall().
*/
function trails_uninstall() {
}

/**
* Implements hook_schema().
*/
function trails_schema() {
$schema['trails_history'] = array(
'description' => 'Stores the history of each page loaded by a user.',
'fields' => array(
'thid' => array(
'description' => 'The unique ID for each history item.',
'type' => 'serial',
'not null' => FALSE,
),
'timestamp' => array(
'description' => 'The Unix timestamp when this page was visited.',
'type' => 'int',
'not null' => FALSE,
),
'path' => array(
'description' => 'The path of the visited page.',
'type' => 'text',
'not null' => FALSE,
),
'title' => array(
'description' => 'The title of the visited page.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'sid' => array(
'description' => "The {session}.sid of the user visiting the page.",
'type' => 'varchar',
'length' => '128',
'not null' => FALSE,
),
'uid' => array(
'description' => 'The {users}.uid that visited the page.',
'type' => 'int',
'not null' => FALSE,
),
),
'primary key' => array('thid'),
);

return $schema;
}

fauzidar
Offline
Last seen: 10 years 28 weeks ago
Joined: 2010-12-05
Solve by fresh install

Hi Chris..

This module is manage to create 'trails_history' table by reinstalled drupal. I'm mistakenly enable 'trails' module i/o 'Schema' module. after realizing my mistake I uninstalled the module and delete 'trails_history' table manually.
What exactly happen? is there any drupal configuration/register file that I should edit before reinstall a module?

After the module successfully create a table. I uninstalled the module and the table still existing. I manually delete the table. I run 'flush all caches', then reinstall the module but as I guess the table are not created for second time. when I examining using xdebug, drupal 'refuse' to read 'function trails_schema()' once again.
Please be patient with me Chris. I want to learn to do better troubleshooting (I don't think reinstalled drupal is a good idea)

sorry my bad English

Chris Shattuck
Offline
Last seen: 15 weeks 6 days ago
Joined: 2009-08-16
Hi there, Just to make sure,

Hi there,

Just to make sure, have you uninstalled the module, or just disabled it? There is an 'uninstall' tab on the modules page which you can click to select modules to remove. Once the module has genuinely been uninstalled, you should be able to re-install it and have the database table recreated.

Let me know if this works for you.

Cheers!
Chris

fauzidar
Offline
Last seen: 10 years 28 weeks ago
Joined: 2010-12-05
ok...

hi Chris..

yes, it works.

thank you.

Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:


Loading...
Contact us

Below are the supported keyboard shortcuts for our video player.

space
Start / stop video
shift
Go to next video
shift
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
1...9
Jump to a percentage (2 is 20%, for example)
f
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
$29
1 month
$156
6 months
10% off
$276
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
user
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.