summaryrefslogtreecommitdiff
path: root/migrations/20150905232742_make_blob_fields_text.js
diff options
context:
space:
mode:
Diffstat (limited to 'migrations/20150905232742_make_blob_fields_text.js')
-rw-r--r--migrations/20150905232742_make_blob_fields_text.js64
1 files changed, 64 insertions, 0 deletions
diff --git a/migrations/20150905232742_make_blob_fields_text.js b/migrations/20150905232742_make_blob_fields_text.js
new file mode 100644
index 0000000..6e24278
--- /dev/null
+++ b/migrations/20150905232742_make_blob_fields_text.js
@@ -0,0 +1,64 @@
+// mysqlcheck -u root --auto-repair --optimize --all-databases
+
+exports.up = function(knex, Promise) {
+ var promise
+ knex.raw("ALTER DATABASE bucky CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci").then(function(){ console.log("OK") })
+ var sql = [
+ "comments comment text",
+ "invites grass tinytext",
+ "keywords threads text",
+ "keywords ops text",
+ "keywords display tinytext",
+ "messages body text",
+ "tags ops text",
+ "tags display tinytext",
+ "threads allowed tinytext",
+ "threads display tinytext",
+ "users grass text",
+ "users keywords text",
+ "users stickies text",
+ "users sink text",
+ "users display text",
+ "users boxes text",
+ ].map(function(s){
+ var ss = s.split(" ")
+ var sz = [
+ "ALTER TABLE",
+ ss[0],
+ "MODIFY COLUMN",
+ ss[1],
+ ss[2],
+ ].join(" ")
+ console.log(sz + ";")
+ promise = knex.raw([
+ "ALTER TABLE",
+ ss[0],
+ "MODIFY COLUMN",
+ ss[1],
+ ss[2],
+ "CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci",
+ ].join(" ")).then(function(){ Promise.resolve(); console.log("OK") })
+ })
+ return promise
+};
+
+exports.down = function(knex, Promise) {
+/*
+ "comments comment blob",
+ "invites grass tinyblob",
+ "keywords threads blob",
+ "keywords ops blob",
+ "keywords display tinyblob",
+ "messages body blob",
+ "tags ops blob",
+ "tags display tinyblob",
+ "threads allowed tinyblob",
+ "threads display tinyblob",
+ "users grass blob",
+ "users keywords blob",
+ "users stickies blob",
+ "users sink blob",
+ "users display blob",
+ "users boxes blob",
+*/
+};