MySQL being stupid x.x - #3
This commit is contained in:
parent
b6220d03d3
commit
ad61b5d8b2
@ -141,9 +141,10 @@ func (adapter *MysqlAdapter) parseColumn(column DBTableColumn) (col DBTableColum
|
||||
// Make it easier to support Cassandra in the future
|
||||
if column.Type == "createdAt" {
|
||||
column.Type = "datetime"
|
||||
if column.Default == "" {
|
||||
// MySQL doesn't support this x.x
|
||||
/*if column.Default == "" {
|
||||
column.Default = "UTC_TIMESTAMP()"
|
||||
}
|
||||
}*/
|
||||
} else if column.Type == "json" {
|
||||
column.Type = "text"
|
||||
}
|
||||
@ -154,9 +155,9 @@ func (adapter *MysqlAdapter) parseColumn(column DBTableColumn) (col DBTableColum
|
||||
// TODO: Exclude the other variants of text like mediumtext and longtext too
|
||||
if column.Default != "" && column.Type != "text" {
|
||||
end = " DEFAULT "
|
||||
if column.Type == "datetime" && column.Default[len(column.Default)-1] == ')' {
|
||||
/*if column.Type == "datetime" && column.Default[len(column.Default)-1] == ')' {
|
||||
end += column.Default
|
||||
} else if adapter.stringyType(column.Type) && column.Default != "''" {
|
||||
} else */if adapter.stringyType(column.Type) && column.Default != "''" {
|
||||
end += "'" + column.Default + "'"
|
||||
} else {
|
||||
end += column.Default
|
||||
|
@ -3,6 +3,6 @@ CREATE TABLE `likes` (
|
||||
`targetItem` int not null,
|
||||
`targetType` varchar(50) DEFAULT 'replies' not null,
|
||||
`sentBy` int not null,
|
||||
`createdAt` datetime DEFAULT UTC_TIMESTAMP() not null,
|
||||
`createdAt` datetime not null,
|
||||
`recalc` tinyint DEFAULT 0 not null
|
||||
);
|
@ -2,6 +2,6 @@ CREATE TABLE `polls_votes` (
|
||||
`pollID` int not null,
|
||||
`uid` int not null,
|
||||
`option` int DEFAULT 0 not null,
|
||||
`castAt` datetime DEFAULT UTC_TIMESTAMP() not null,
|
||||
`castAt` datetime not null,
|
||||
`ipaddress` varchar(200) DEFAULT '0.0.0.0.0' not null
|
||||
) CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
|
@ -5,6 +5,6 @@ CREATE TABLE `registration_logs` (
|
||||
`failureReason` varchar(100) not null,
|
||||
`success` bool DEFAULT 0 not null,
|
||||
`ipaddress` varchar(200) not null,
|
||||
`doneAt` datetime DEFAULT UTC_TIMESTAMP() not null,
|
||||
`doneAt` datetime not null,
|
||||
primary key(`rlid`)
|
||||
);
|
@ -3,7 +3,7 @@ CREATE TABLE `replies` (
|
||||
`tid` int not null,
|
||||
`content` text not null,
|
||||
`parsed_content` text not null,
|
||||
`createdAt` datetime DEFAULT UTC_TIMESTAMP() not null,
|
||||
`createdAt` datetime not null,
|
||||
`createdBy` int not null,
|
||||
`lastEdit` int DEFAULT 0 not null,
|
||||
`lastEditBy` int DEFAULT 0 not null,
|
||||
|
@ -3,6 +3,6 @@ CREATE TABLE `revisions` (
|
||||
`content` text not null,
|
||||
`contentID` int not null,
|
||||
`contentType` varchar(100) DEFAULT 'replies' not null,
|
||||
`createdAt` datetime DEFAULT UTC_TIMESTAMP() not null,
|
||||
`createdAt` datetime not null,
|
||||
primary key(`reviseID`)
|
||||
) CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
|
@ -3,7 +3,7 @@ CREATE TABLE `topics` (
|
||||
`title` varchar(100) not null,
|
||||
`content` text not null,
|
||||
`parsed_content` text not null,
|
||||
`createdAt` datetime DEFAULT UTC_TIMESTAMP() not null,
|
||||
`createdAt` datetime not null,
|
||||
`lastReplyAt` datetime not null,
|
||||
`lastReplyBy` int not null,
|
||||
`createdBy` int not null,
|
||||
|
@ -6,7 +6,7 @@ CREATE TABLE `users` (
|
||||
`group` int not null,
|
||||
`active` boolean DEFAULT 0 not null,
|
||||
`is_super_admin` boolean DEFAULT 0 not null,
|
||||
`createdAt` datetime DEFAULT UTC_TIMESTAMP() not null,
|
||||
`createdAt` datetime not null,
|
||||
`lastActiveAt` datetime not null,
|
||||
`session` varchar(200) DEFAULT '' not null,
|
||||
`last_ip` varchar(200) DEFAULT '0.0.0.0.0' not null,
|
||||
|
@ -9,6 +9,6 @@ CREATE TABLE `users_2fa_keys` (
|
||||
`scratch6` varchar(50) not null,
|
||||
`scratch7` varchar(50) not null,
|
||||
`scratch8` varchar(50) not null,
|
||||
`createdAt` datetime DEFAULT UTC_TIMESTAMP() not null,
|
||||
`createdAt` datetime not null,
|
||||
primary key(`uid`)
|
||||
) CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
|
@ -2,7 +2,7 @@ CREATE TABLE `users_groups_scheduler` (
|
||||
`uid` int not null,
|
||||
`set_group` int not null,
|
||||
`issued_by` int not null,
|
||||
`issued_at` datetime DEFAULT UTC_TIMESTAMP() not null,
|
||||
`issued_at` datetime not null,
|
||||
`revert_at` datetime not null,
|
||||
`temporary` boolean not null,
|
||||
primary key(`uid`)
|
||||
|
@ -3,7 +3,7 @@ CREATE TABLE `users_replies` (
|
||||
`uid` int not null,
|
||||
`content` text not null,
|
||||
`parsed_content` text not null,
|
||||
`createdAt` datetime DEFAULT UTC_TIMESTAMP() not null,
|
||||
`createdAt` datetime not null,
|
||||
`createdBy` int not null,
|
||||
`lastEdit` int DEFAULT 0 not null,
|
||||
`lastEditBy` int DEFAULT 0 not null,
|
||||
|
Loading…
Reference in New Issue
Block a user