2
* Copyright 2009 Google Inc.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS-IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
import("sqlbase.sqlobj");
18
import("etherpad.utils.isPrivateNetworkEdition");
21
if (isPrivateNetworkEdition()) {
26
sqlobj.addColumns('eepnet_signups', {
27
firstName: 'VARCHAR(128) NOT NULL DEFAULT \'\'',
28
lastName: 'VARCHAR(128) NOT NULL DEFAULT \'\'',
29
phone: 'VARCHAR(128) NOT NULL DEFAULT \'\''
32
// split name into first/last
33
var rows = sqlobj.selectMulti('eepnet_signups', {}, {});
34
rows.forEach(function(r) {
35
var name = r.fullName;
36
r.firstName = (r.fullName.split(' ')[0]) || "?";
37
r.lastName = (r.fullName.split(' ').slice(1).join(' ')) || "?";
39
sqlobj.updateSingle('eepnet_signups', {id: r.id}, r);
42
// drop column fullName
43
sqlobj.dropColumn('eepnet_signups', 'fullName');