aboutsummaryrefslogtreecommitdiffstats
path: root/db/migrations/20210612203333_schema_diff_merges.js
diff options
context:
space:
mode:
authorRan Guin <[email protected]>2021-07-19 12:19:18 -0700
committerRan Guin <[email protected]>2021-07-19 12:19:18 -0700
commite238eab45f1f5b6f3dbf40ddff59b9db804ffb4f (patch)
tree9bcfd0547a97a49aad19f8db240364bc8b53f235 /db/migrations/20210612203333_schema_diff_merges.js
parent1b00cc812f7a9fdbefd9e05553d694fbca918ed0 (diff)
downloadcoinos-server-e238eab45f1f5b6f3dbf40ddff59b9db804ffb4f.tar.gz
coinos-server-e238eab45f1f5b6f3dbf40ddff59b9db804ffb4f.zip
update migrations
Diffstat (limited to 'db/migrations/20210612203333_schema_diff_merges.js')
-rw-r--r--db/migrations/20210612203333_schema_diff_merges.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/db/migrations/20210612203333_schema_diff_merges.js b/db/migrations/20210612203333_schema_diff_merges.js
new file mode 100644
index 00000000..a853f449
--- /dev/null
+++ b/db/migrations/20210612203333_schema_diff_merges.js
@@ -0,0 +1,39 @@
+exports.up = function(knex) {
+ return Promise.all([
+ knex.schema.dropTableIfExists('reset'),
+ knex.schema.dropTableIfExists('naughty'),
+ knex.schema.dropTableIfExists('cheaters'),
+
+ knex.raw("UPDATE accounts set createdAt = '2020-01-01' where createdAt < '2020-01-01'"),
+ knex.raw("UPDATE accounts set updatedAt = '2020-01-01' where updatedAt < '2020-01-01'"),
+ knex.raw("ALTER TABLE accounts modify `contract` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL"),
+
+ knex.schema.alterTable('orders', function(t) {
+ t.dropColumn('a1');
+ t.dropColumn('a2');
+ }),
+
+ knex.schema.alterTable("users", function(t) {
+ t.string('authyId').nullable();
+ t.dropColumn('symbol');
+ }),
+
+ knex.raw("ALTER TABLE users MODIFY `subscriptions` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL"),
+
+ ])
+}
+
+exports.down = async function(knex) {
+ return Promise.all([
+ knex.schema.table("orders", function(t) {
+ t.integer("a1");
+ t.integer("a2")
+ }),
+
+ knex.schema.table("users", function(t) {
+ t.string("symbol");
+ t.dropColumn("unit");
+ t.dropColumn("authyId");
+ }),
+ ])
+} \ No newline at end of file