Skip to content

Commit

Permalink
fix sql [#16]
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Rockett committed Jan 17, 2017
1 parent eac11da commit 3ad4f0b
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
20 changes: 10 additions & 10 deletions Blueprints/schema-create-main.sql
@@ -1,13 +1,13 @@
CREATE TABLE IF NOT EXISTS <table-name> (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
source VARCHAR(512) NOT NULL,
destination VARCHAR(512) NOT NULL,
hits INT UNSIGNED DEFAULT 0,
user_created INT UNSIGNED DEFAULT 0,
user_updated INT UNSIGNED DEFAULT 0,
date_start TIMESTAMP NULL,
date_end TIMESTAMP NULL,
created_at TIMESTAMP,
updated_at TIMESTAMP,
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`source` VARCHAR(512) NOT NULL,
`destination` VARCHAR(512) NOT NULL,
`hits` INT UNSIGNED DEFAULT 0,
`user_created` INT UNSIGNED DEFAULT 0,
`user_updated` INT UNSIGNED DEFAULT 0,
`date_start` TIMESTAMP NULL,
`date_end` TIMESTAMP NULL,
`created_at` TIMESTAMP,
`updated_at` TIMESTAMP,
PRIMARY KEY(id)
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
14 changes: 7 additions & 7 deletions Blueprints/schema-create-mc.sql
@@ -1,11 +1,11 @@
CREATE TABLE IF NOT EXISTS <table-name>_mc (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
collection_name VARCHAR(255) NOT NULL,
collection_mappings LONGTEXT NOT NULL,
user_created INT UNSIGNED DEFAULT 0,
user_updated INT UNSIGNED DEFAULT 0,
updated_at TIMESTAMP,
created_at TIMESTAMP,
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`collection_name` VARCHAR(255) NOT NULL,
`collection_mappings` LONGTEXT NOT NULL,
`user_created` INT UNSIGNED DEFAULT 0,
`user_updated` INT UNSIGNED DEFAULT 0,
`updated_at` TIMESTAMP,
`created_at` TIMESTAMP,
PRIMARY KEY (id),
UNIQUE KEY(collection_name)
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
4 changes: 2 additions & 2 deletions Blueprints/schema-update-v2.sql
@@ -1,2 +1,2 @@
ALTER TABLE <table-name> MODIFY date_start TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00';
ALTER TABLE <table-name> MODIFY date_end TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00';
ALTER TABLE <table-name> MODIFY `date_start` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00';
ALTER TABLE <table-name> MODIFY `date_end` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00';
2 changes: 1 addition & 1 deletion Blueprints/schema-update-v3.sql
@@ -1 +1 @@
ALTER TABLE <table-name> ADD COLUMN last_hit TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00';
ALTER TABLE <table-name> ADD COLUMN `last_hit` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00';
10 changes: 5 additions & 5 deletions Blueprints/schema-update-v4.sql
@@ -1,8 +1,8 @@
CREATE TABLE <table-name>_nf (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
request_uri VARCHAR(255) NOT NULL,
referrer VARCHAR(255) DEFAULT '',
user_agent VARCHAR(255) DEFAULT '',
created_at TIMESTAMP,
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`request_uri` VARCHAR(255) NOT NULL,
`referrer` VARCHAR(255) DEFAULT '',
`user_agent` VARCHAR(255) DEFAULT '',
`created_at` TIMESTAMP,
PRIMARY KEY (id)
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
2 changes: 1 addition & 1 deletion ProcessJumplinks.info.json
@@ -1,6 +1,6 @@
{
"title": "Jumplinks",
"version": "1.5.44",
"version": "1.5.45",
"author": "Mike Rockett",
"summary": "Manage permanent and temporary redirects. Uses named wildcards and mapping collections.",
"requires": "ProcessWire>=2.6.1",
Expand Down
6 changes: 3 additions & 3 deletions ProcessJumplinks.module.php
Expand Up @@ -150,11 +150,11 @@ public function __construct()
// These are kept in one place for ease of reference.
$this->sql = (object) array(
'entity' => (object) array(
'selectAll' => "SELECT * FROM {$this->tableName} ORDER BY source",
'selectAll' => "SELECT * FROM {$this->tableName} ORDER BY `source`",
'selectOne' => "SELECT * FROM {$this->tableName} WHERE id = :id",
'dropOne' => "DELETE FROM {$this->tableName} WHERE id = :id",
'insert' => "INSERT INTO {$this->tableName} SET source = :source, destination = :destination, hits = :hits, date_start = :date_start, date_end = :date_end, user_created = :user_created, user_updated = :user_updated, created_at = CURRENT_TIMESTAMP, updated_at = CURRENT_TIMESTAMP ON DUPLICATE KEY UPDATE id = id",
'update' => "UPDATE {$this->tableName} SET source = :source, destination = :destination, date_start = :date_start, date_end = :date_end, user_updated = :user_updated, updated_at = CURRENT_TIMESTAMP WHERE id = :id",
'insert' => "INSERT INTO {$this->tableName} SET `source` = :source, destination = :destination, hits = :hits, date_start = :date_start, date_end = :date_end, user_created = :user_created, user_updated = :user_updated, created_at = CURRENT_TIMESTAMP, updated_at = CURRENT_TIMESTAMP ON DUPLICATE KEY UPDATE id = id",
'update' => "UPDATE {$this->tableName} SET `source` = :source, destination = :destination, date_start = :date_start, date_end = :date_end, user_updated = :user_updated, updated_at = CURRENT_TIMESTAMP WHERE id = :id",
'updateHits' => "UPDATE {$this->tableName} SET hits = :hits WHERE id = :id",
'updateLastHitDate' => "UPDATE {$this->tableName} SET last_hit = :last_hit WHERE id = :id",
),
Expand Down

0 comments on commit 3ad4f0b

Please sign in to comment.