parent
929be895de
commit
fd7c3b7bd7
@ -1,10 +0,0 @@ |
||||
Meteor.startup -> |
||||
Meteor.defer -> |
||||
if ChatRoom.find('57om6EQCcFami9wuT').count() is 0 |
||||
ChatRoom.insert |
||||
_id: '57om6EQCcFami9wuT' |
||||
usernames: [] |
||||
ts: new Date() |
||||
t: 'c' |
||||
name: 'general' |
||||
msgs: 0 |
||||
@ -1,18 +1,28 @@ |
||||
lineSep = '---------------------------' |
||||
|
||||
Meteor.startup -> |
||||
if not Meteor.users.findOne()? |
||||
console.log lineSep.red |
||||
console.log 'Inserting user admin'.red |
||||
console.log 'email: admin@admin.com | password: admin'.red |
||||
Meteor.defer -> |
||||
|
||||
|
||||
if not ChatRoom.findOne('name': 'general')? |
||||
ChatRoom.insert |
||||
_id: 'GENERAL' |
||||
usernames: [] |
||||
ts: new Date() |
||||
t: 'c' |
||||
name: 'general' |
||||
msgs: 0 |
||||
|
||||
|
||||
# if not Meteor.users.findOne()? |
||||
# console.log 'Inserting user admin'.red |
||||
# console.log 'email: admin@admin.com | password: admin'.red |
||||
|
||||
id = Meteor.users.insert |
||||
createdAt: new Date |
||||
emails: [ |
||||
address: 'admin@admin.com' |
||||
verified: true |
||||
], |
||||
name: 'Admin' |
||||
avatarOrigin: 'none' |
||||
# id = Meteor.users.insert |
||||
# createdAt: new Date |
||||
# emails: [ |
||||
# address: 'admin@admin.com' |
||||
# verified: true |
||||
# ], |
||||
# name: 'Admin' |
||||
# avatarOrigin: 'none' |
||||
|
||||
Accounts.setPassword id, 'admin' |
||||
# Accounts.setPassword id, 'admin' |
||||
|
||||
@ -0,0 +1,17 @@ |
||||
Meteor.startup -> |
||||
Migrations.add |
||||
version: 6 |
||||
up: -> |
||||
|
||||
console.log 'Changin _id of #general channel room from 57om6EQCcFami9wuT to GENERAL' |
||||
room = ChatRoom.findOne('57om6EQCcFami9wuT') |
||||
newId = 'GENERAL' |
||||
if room |
||||
ChatSubscription.update({'rid':room._id},{'$set':{'rid':newId}},{'multi':1}) |
||||
ChatMessage.update({'rid':room._id},{'$set':{'rid':newId}},{'multi':1}) |
||||
ChatRoom.remove({'_id':room._id}) |
||||
delete room._id |
||||
ChatRoom.upsert({'_id':newId}, { $set: room}) |
||||
|
||||
|
||||
console.log 'End' |
||||
@ -1,3 +1,8 @@ |
||||
Meteor.startup -> |
||||
Meteor.defer -> |
||||
Migrations.migrateTo 'latest' |
||||
if Migrations.getVersion() isnt 0 |
||||
Migrations.migrateTo 'latest' |
||||
else |
||||
control = Migrations._getControl() |
||||
control.version = _.last(Migrations._list).version |
||||
Migrations._setControl control |
||||
|
||||
Loading…
Reference in new issue