2021-09-13 20:41:05 +00:00
|
|
|
import { addColumns, createTable, schemaMigrations } from '@nozbe/watermelondb/Schema/migrations';
|
2019-09-18 17:32:12 +00:00
|
|
|
|
|
|
|
export default schemaMigrations({
|
|
|
|
migrations: [
|
|
|
|
{
|
|
|
|
toVersion: 2,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'jitsi_timeout', type: 'number', isOptional: true }]
|
2019-09-18 17:32:12 +00:00
|
|
|
})
|
|
|
|
]
|
2019-10-28 20:04:44 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 3,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'hide_unread_status', type: 'boolean', isOptional: true }]
|
2019-10-28 20:04:44 +00:00
|
|
|
})
|
|
|
|
]
|
2020-02-11 14:01:35 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 4,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'messages',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'blocks', type: 'string', isOptional: true }]
|
2020-02-11 14:01:35 +00:00
|
|
|
}),
|
|
|
|
addColumns({
|
|
|
|
table: 'slash_commands',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'app_id', type: 'string', isOptional: true }]
|
2020-02-11 14:01:35 +00:00
|
|
|
})
|
|
|
|
]
|
2020-02-20 20:43:56 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 5,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'settings',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'value_as_array', type: 'string', isOptional: true }]
|
2020-02-20 20:43:56 +00:00
|
|
|
})
|
|
|
|
]
|
2020-03-06 14:19:03 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 6,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'sys_mes', type: 'string', isOptional: true }]
|
2020-03-06 14:19:03 +00:00
|
|
|
})
|
|
|
|
]
|
2020-04-01 12:28:54 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 7,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
|
|
|
columns: [
|
|
|
|
{ name: 'uids', type: 'string', isOptional: true },
|
|
|
|
{ name: 'usernames', type: 'string', isOptional: true }
|
|
|
|
]
|
|
|
|
})
|
|
|
|
]
|
2020-05-08 12:57:04 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 8,
|
|
|
|
steps: [
|
2020-05-08 17:16:22 +00:00
|
|
|
addColumns({
|
|
|
|
table: 'messages',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'emoji', type: 'string', isOptional: true }]
|
2020-05-08 17:16:22 +00:00
|
|
|
}),
|
|
|
|
addColumns({
|
|
|
|
table: 'thread_messages',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'emoji', type: 'string', isOptional: true }]
|
2020-05-08 17:16:22 +00:00
|
|
|
}),
|
|
|
|
addColumns({
|
|
|
|
table: 'threads',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'emoji', type: 'string', isOptional: true }]
|
2020-05-08 17:16:22 +00:00
|
|
|
}),
|
2020-05-08 12:57:04 +00:00
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
|
|
|
columns: [
|
2020-05-08 17:36:10 +00:00
|
|
|
{ name: 'banner_closed', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'visitor', type: 'string', isOptional: true },
|
|
|
|
{ name: 'department_id', type: 'string', isOptional: true },
|
|
|
|
{ name: 'served_by', type: 'string', isOptional: true },
|
|
|
|
{ name: 'livechat_data', type: 'string', isOptional: true },
|
|
|
|
{ name: 'tags', type: 'string', isOptional: true }
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
addColumns({
|
|
|
|
table: 'rooms',
|
|
|
|
columns: [
|
|
|
|
{ name: 'v', type: 'string', isOptional: true },
|
|
|
|
{ name: 'department_id', type: 'string', isOptional: true },
|
|
|
|
{ name: 'served_by', type: 'string', isOptional: true },
|
|
|
|
{ name: 'livechat_data', type: 'string', isOptional: true },
|
|
|
|
{ name: 'tags', type: 'string', isOptional: true }
|
2020-05-08 12:57:04 +00:00
|
|
|
]
|
|
|
|
})
|
|
|
|
]
|
2020-07-29 20:49:08 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 9,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'group_mentions', type: 'number', isOptional: true }]
|
2020-07-29 20:49:08 +00:00
|
|
|
})
|
|
|
|
]
|
2020-09-11 14:31:38 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 10,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
|
|
|
columns: [
|
|
|
|
{ name: 'e2e_key', type: 'string', isOptional: true },
|
|
|
|
{ name: 'encrypted', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'e2e_key_id', type: 'string', isOptional: true }
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
addColumns({
|
|
|
|
table: 'messages',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'e2e', type: 'string', isOptional: true }]
|
2020-09-11 14:31:38 +00:00
|
|
|
}),
|
|
|
|
addColumns({
|
|
|
|
table: 'thread_messages',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'e2e', type: 'string', isOptional: true }]
|
2020-09-11 14:31:38 +00:00
|
|
|
}),
|
|
|
|
addColumns({
|
|
|
|
table: 'threads',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'e2e', type: 'string', isOptional: true }]
|
2020-09-11 14:31:38 +00:00
|
|
|
}),
|
|
|
|
addColumns({
|
|
|
|
table: 'rooms',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'e2e_key_id', type: 'string', isOptional: true }]
|
2020-09-11 14:31:38 +00:00
|
|
|
})
|
|
|
|
]
|
2020-10-30 13:12:02 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 11,
|
|
|
|
steps: [
|
2020-10-30 17:35:07 +00:00
|
|
|
addColumns({
|
|
|
|
table: 'messages',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'tshow', type: 'boolean', isOptional: true }]
|
2020-10-30 17:35:07 +00:00
|
|
|
}),
|
2020-10-30 13:12:02 +00:00
|
|
|
createTable({
|
|
|
|
name: 'users',
|
|
|
|
columns: [
|
|
|
|
{ name: '_id', type: 'string', isIndexed: true },
|
|
|
|
{ name: 'name', type: 'string', isOptional: true },
|
|
|
|
{ name: 'username', type: 'string', isIndexed: true },
|
|
|
|
{ name: 'avatar_etag', type: 'string', isOptional: true }
|
|
|
|
]
|
2020-10-30 13:51:04 +00:00
|
|
|
}),
|
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
|
|
|
columns: [
|
2020-10-30 17:35:07 +00:00
|
|
|
{ name: 'tunread', type: 'string', isOptional: true },
|
|
|
|
{ name: 'tunread_user', type: 'string', isOptional: true },
|
|
|
|
{ name: 'tunread_group', type: 'string', isOptional: true },
|
2020-10-30 13:51:04 +00:00
|
|
|
{ name: 'avatar_etag', type: 'string', isOptional: true }
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
addColumns({
|
|
|
|
table: 'rooms',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'avatar_etag', type: 'string', isOptional: true }]
|
2020-10-30 13:12:02 +00:00
|
|
|
})
|
|
|
|
]
|
2020-11-30 20:00:31 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 12,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'ignored', type: 'string', isOptional: true }]
|
2020-11-30 20:00:31 +00:00
|
|
|
})
|
|
|
|
]
|
2021-04-07 18:31:25 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 13,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
|
|
|
columns: [
|
|
|
|
{ name: 'team_id', type: 'string', isIndexed: true },
|
|
|
|
{ name: 'team_main', type: 'boolean', isOptional: true }
|
|
|
|
]
|
|
|
|
})
|
|
|
|
]
|
2021-10-20 16:32:58 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 14,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'messages',
|
|
|
|
columns: [{ name: 'md', type: 'string', isOptional: true }]
|
|
|
|
})
|
|
|
|
]
|
2022-03-02 14:18:01 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 15,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'threads',
|
|
|
|
columns: [{ name: 'draft_message', type: 'string', isOptional: true }]
|
|
|
|
})
|
|
|
|
]
|
2022-04-15 02:27:36 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 16,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
|
|
|
columns: [{ name: 'source', type: 'string', isOptional: true }]
|
|
|
|
})
|
|
|
|
]
|
2022-04-20 20:53:11 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 17,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
|
|
|
columns: [{ name: 'on_hold', type: 'boolean', isOptional: true }]
|
|
|
|
}),
|
|
|
|
addColumns({
|
|
|
|
table: 'messages',
|
|
|
|
columns: [{ name: 'comment', type: 'string', isOptional: true }]
|
|
|
|
})
|
|
|
|
]
|
2022-06-13 13:24:54 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 18,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
|
|
|
columns: [{ name: 'hide_mention_status', type: 'boolean', isOptional: true }]
|
|
|
|
})
|
|
|
|
]
|
2022-12-21 17:34:48 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 19,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'uploads',
|
|
|
|
columns: [{ name: 'tmid', type: 'string', isOptional: true }]
|
|
|
|
})
|
|
|
|
]
|
2023-01-12 13:32:33 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 20,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
|
|
|
columns: [{ name: 'e2e_suggested_key', type: 'string', isOptional: true }]
|
|
|
|
})
|
|
|
|
]
|
2023-04-28 15:16:14 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
toVersion: 21,
|
|
|
|
steps: [
|
|
|
|
addColumns({
|
|
|
|
table: 'subscriptions',
|
|
|
|
columns: [{ name: 'users_count', type: 'string', isOptional: true }]
|
|
|
|
})
|
|
|
|
]
|
2019-09-18 17:32:12 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
});
|