-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
CREATE SEQUENCE wl_comment_seq; | ||
|
||
CREATE TABLE wl_comment ( | ||
id int check (id > 0) NOT NULL DEFAULT NEXTVAL ('wl_comment_seq'), | ||
comment text, | ||
insertedAt timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
ip varchar(100) DEFAULT '', | ||
link varchar(255) DEFAULT NULL, | ||
mail varchar(255) DEFAULT NULL, | ||
nick varchar(255) DEFAULT NULL, | ||
pid int DEFAULT NULL, | ||
rid int DEFAULT NULL, | ||
status varchar(50) NOT NULL DEFAULT '', | ||
ua text, | ||
url varchar(255) DEFAULT NULL, | ||
createdAt timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP, | ||
updatedAt timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP, | ||
PRIMARY KEY (id) | ||
) ; | ||
|
||
|
||
CREATE SEQUENCE wl_counter_seq; | ||
|
||
CREATE TABLE wl_counter ( | ||
id int check (id > 0) NOT NULL DEFAULT NEXTVAL ('wl_counter_seq'), | ||
time int DEFAULT NULL, | ||
url varchar(255) NOT NULL DEFAULT '', | ||
createdAt timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP, | ||
updatedAt timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP, | ||
PRIMARY KEY (id) | ||
) ; | ||
|
||
|
||
CREATE SEQUENCE wl_users_seq; | ||
|
||
CREATE TABLE wl_users ( | ||
id int check (id > 0) NOT NULL DEFAULT NEXTVAL ('wl_users_seq'), | ||
display_name varchar(255) NOT NULL DEFAULT '', | ||
email varchar(255) NOT NULL DEFAULT '', | ||
password varchar(255) NOT NULL DEFAULT '', | ||
type varchar(50) NOT NULL DEFAULT '', | ||
url varchar(255) DEFAULT NULL, | ||
createdAt timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP, | ||
updatedAt timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP, | ||
PRIMARY KEY (id) | ||
) ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const MySQL = require('./mysql'); | ||
|
||
module.exports = class extends MySQL { | ||
model(tableName) { | ||
return super.model(tableName.toLowerCase()); | ||
} | ||
|
||
async count(...args) { | ||
let result = await super.count(...args); | ||
if(!Array.isArray(result)) { | ||
return result; | ||
} | ||
|
||
return result[0].think_count; | ||
} | ||
} |