shorten tblKey to tK

This commit is contained in:
Azareal 2021-04-03 19:28:00 +10:00
parent a4ba5a2470
commit a9288d3e29
1 changed files with 15 additions and 15 deletions

View File

@ -172,7 +172,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
ccol("scratch8", 50, ""), ccol("scratch8", 50, ""),
{"createdAt", "createdAt", 0, false, false, ""}, {"createdAt", "createdAt", 0, false, false, ""},
}, },
[]tblKey{ []tK{
{"uid", "primary", "", false}, {"uid", "primary", "", false},
}, },
) )
@ -217,7 +217,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
{"revert_at", "datetime", 0, false, false, ""}, {"revert_at", "datetime", 0, false, false, ""},
{"temporary", "boolean", 0, false, false, ""}, // special case for permanent bans to do the necessary bookkeeping, might be removed in the future {"temporary", "boolean", 0, false, false, ""}, // special case for permanent bans to do the necessary bookkeeping, might be removed in the future
}, },
[]tblKey{ []tK{
{"uid", "primary", "", false}, {"uid", "primary", "", false},
}, },
) )
@ -227,7 +227,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
[]tC{ []tC{
{"uid", "int", 0, false, false, ""}, // TODO: Make this a foreign key {"uid", "int", 0, false, false, ""}, // TODO: Make this a foreign key
}, },
[]tblKey{ []tK{
{"uid", "primary", "", false}, {"uid", "primary", "", false},
}, },
) )
@ -282,7 +282,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
{"lastTopicID", "int", 0, false, false, "0"}, {"lastTopicID", "int", 0, false, false, "0"},
{"lastReplyerID", "int", 0, false, false, "0"}, {"lastReplyerID", "int", 0, false, false, "0"},
}, },
[]tblKey{ []tK{
{"fid", "primary", "", false}, {"fid", "primary", "", false},
}, },
) )
@ -294,7 +294,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
ccol("preset", 100, "''"), ccol("preset", 100, "''"),
text("permissions", "{}"), text("permissions", "{}"),
}, },
[]tblKey{ []tK{
// TODO: Test to see that the compound primary key works // TODO: Test to see that the compound primary key works
{"fid,gid", "primary", "", false}, {"fid,gid", "primary", "", false},
}, },
@ -376,7 +376,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
ccol("path", 200, ""), ccol("path", 200, ""),
ccol("extra", 200, ""), ccol("extra", 200, ""),
}, },
[]tblKey{ []tK{
{"attachID", "primary", "", false}, {"attachID", "primary", "", false},
}, },
) )
@ -390,7 +390,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
createdAt(), createdAt(),
// TODO: Add a createdBy column? // TODO: Add a createdBy column?
}, },
[]tblKey{ []tK{
{"reviseID", "primary", "", false}, {"reviseID", "primary", "", false},
}, },
) )
@ -404,7 +404,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
{"options", "json", 0, false, false, ""}, {"options", "json", 0, false, false, ""},
{"votes", "int", 0, false, false, "0"}, {"votes", "int", 0, false, false, "0"},
}, },
[]tblKey{ []tK{
{"pollID", "primary", "", false}, {"pollID", "primary", "", false},
}, },
) )
@ -439,7 +439,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
{"lastEditBy", "int", 0, false, false, "0"}, {"lastEditBy", "int", 0, false, false, "0"},
ccol("ip", 200, "''"), ccol("ip", 200, "''"),
}, },
[]tblKey{ []tK{
{"rid", "primary", "", false}, {"rid", "primary", "", false},
}, },
) )
@ -455,7 +455,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
}, nil, }, nil,
) )
//columns("participants, createdBy, createdAt, lastReplyBy, lastReplyAt").Where("cid = ?") //columns("participants,createdBy,createdAt,lastReplyBy,lastReplyAt").Where("cid=?")
createTable("conversations", "", "", createTable("conversations", "", "",
[]tC{ []tC{
{"cid", "int", 0, false, true, ""}, {"cid", "int", 0, false, true, ""},
@ -464,7 +464,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
{"lastReplyAt", "datetime", 0, false, false, ""}, {"lastReplyAt", "datetime", 0, false, false, ""},
{"lastReplyBy", "int", 0, false, false, ""}, {"lastReplyBy", "int", 0, false, false, ""},
}, },
[]tblKey{ []tK{
{"cid", "primary", "", false}, {"cid", "primary", "", false},
}, },
) )
@ -477,7 +477,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
ccol("body", 50, ""), ccol("body", 50, ""),
ccol("post", 50, "''"), ccol("post", 50, "''"),
}, },
[]tblKey{ []tK{
{"pid", "primary", "", false}, {"pid", "primary", "", false},
}, },
) )
@ -516,7 +516,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
{"watcher", "int", 0, false, false, ""}, // TODO: Make this a foreign key {"watcher", "int", 0, false, false, ""}, // TODO: Make this a foreign key
{"asid", "int", 0, false, false, ""}, // TODO: Make this a foreign key {"asid", "int", 0, false, false, ""}, // TODO: Make this a foreign key
}, },
[]tblKey{ []tK{
{"asid,asid", "foreign", "activity_stream", true}, {"asid,asid", "foreign", "activity_stream", true},
}, },
) )
@ -670,7 +670,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
ccol("ipaddress", 200, ""), ccol("ipaddress", 200, ""),
createdAt("doneAt"), createdAt("doneAt"),
}, },
[]tblKey{ []tK{
{"rlid", "primary", "", false}, {"rlid", "primary", "", false},
}, },
) )
@ -684,7 +684,7 @@ func createTables2(a qgen.Adapter, f func(table, charset, collation string, colu
ccol("ipaddress", 200, ""), ccol("ipaddress", 200, ""),
createdAt("doneAt"), createdAt("doneAt"),
}, },
[]tblKey{ []tK{
{"lid", "primary", "", false}, {"lid", "primary", "", false},
}, },
) )