Subversion Repositories computer_asset_manager_v2

Rev

Rev 64 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 64 Rev 66
Line 59... Line 59...
59
            _users._user_id 
59
            _users._user_id 
60
         from 
60
         from 
61
            camp2._users_permissions 
61
            camp2._users_permissions 
62
            join camp2._users using (_user_id)
62
            join camp2._users using (_user_id)
63
         );
63
         );
-
 
64
         
-
 
65
update _users set restrictions = '[owner]
-
 
66
Vanduzen' where login = 'jbellah';
-
 
67
 
-
 
68
update _users set restrictions = '[owner]
-
 
69
Walder IP Law' where login = 'swalder';
-
 
70
 
64
 
71
 
65
/* *************************************
72
/* *************************************
66
   Owners
73
   Owners
67
*/
74
*/
68
 
75
 
Line 199... Line 206...
199
 
206
 
200
/* ***************************************
207
/* ***************************************
201
  Devices
208
  Devices
202
*/
209
*/
203
truncate table camp2.device_type;
210
truncate table camp2.device_type;
204
insert into camp2.device_type (name,created,removed)
211
insert into camp2.device_type (name,created)
205
   select
212
   select
206
      name,
213
      name,
207
      date(added_date),
214
      date(added_date)
208
      date(removed_date)
-
 
209
   from
215
   from
210
      camp.device_type
216
      camp.device_type
211
   where
217
   where
212
      camp.device_type.show_as_system = 'Y';
218
      camp.device_type.show_as_system = 'Y';
213
 
219
 
Line 226... Line 232...
226
   Linkage Tables
232
   Linkage Tables
227
*/
233
*/
228
 
234
 
229
/* device_device */
235
/* device_device */
230
truncate table camp2.device_device;
236
truncate table camp2.device_device;
231
insert into camp2.device_device (device_id,parent_id,created,removed)
237
insert into camp2.device_device (device_id,parent_id,created)
232
   select
238
   select
233
      camp2.mapping.new_id,
239
      camp2.mapping.new_id,
234
      parent.new_id,
240
      parent.new_id,
235
      date(now()),
241
      date(now())
236
      null
-
 
237
   from
242
   from
238
      camp.device
243
      camp.device
239
      join camp2.mapping on (camp.device.device_id = mapping.old_id and mapping.tablename = 'device' )
244
      join camp2.mapping on (camp.device.device_id = mapping.old_id and mapping.tablename = 'device' )
240
      join (
245
      join (
241
         select
246
         select
Line 279... Line 284...
279
      join camp2.mapping map_type on (camp.device_type.device_type_id = map_type.old_id and map_type.tablename = 'device_type' )
284
      join camp2.mapping map_type on (camp.device_type.device_type_id = map_type.old_id and map_type.tablename = 'device_type' )
280
;      
285
;      
281
 
286
 
282
/* verify with the following query 
287
/* verify with the following query 
283
 
288
 
284
select device.name,device_types from device join view_device_device_types using (device_id);
289
select device.name,device_types from device join view_device_types using (device_id);
285
 
290
 
286
*/
291
*/
287
 
292
 
288
/* location_device */
293
/* location_device */
289
truncate table location_device;
294
truncate table location_device;
290
insert into location_device ( location_id,device_id,created,removed )
295
insert into location_device ( location_id,device_id,created )
291
   select
296
   select
292
      map_type.new_id,
297
      map_type.new_id,
293
      mapping.new_id,
298
      mapping.new_id,
294
      date(camp.site.added_date),
299
      date(camp.site.added_date)
295
      date(camp.site.removed_date)
-
 
296
   from
300
   from
297
      camp.device
301
      camp.device
298
      join camp.site using (site_id)
302
      join camp.site using (site_id)
299
      join camp2.mapping on (camp.device.device_id = mapping.old_id and mapping.tablename = 'device')
303
      join camp2.mapping on (camp.device.device_id = mapping.old_id and mapping.tablename = 'device')
300
      join camp2.mapping map_type on (camp.site.site_id = map_type.old_id and map_type.tablename = 'location' )
304
      join camp2.mapping map_type on (camp.site.site_id = map_type.old_id and map_type.tablename = 'location' )
Line 312... Line 316...
312
   
316
   
313
*/
317
*/
314
 
318
 
315
/* owner_device */
319
/* owner_device */
316
truncate table owner_device;
320
truncate table owner_device;
317
insert into owner_device ( owner_id,device_id,created,removed )
321
insert into owner_device ( owner_id,device_id,created )
318
   select
322
   select
319
      map_type.new_id,
323
      map_type.new_id,
320
      mapping.new_id,
324
      mapping.new_id,
321
      date(camp.device.added_date),
325
      date(camp.device.added_date)
322
      date(camp.device.removed_date)
-
 
323
   from
326
   from
324
      camp.device
327
      camp.device
325
      join camp.site using (site_id)
328
      join camp.site using (site_id)
326
      join camp.client using (client_id)
329
      join camp.client using (client_id)
327
      join camp2.mapping on (camp.device.device_id = mapping.old_id and mapping.tablename = 'device')
330
      join camp2.mapping on (camp.device.device_id = mapping.old_id and mapping.tablename = 'device')
Line 335... Line 338...
335
*/
338
*/
336
 
339
 
337
 
340
 
338
/* owner_location */
341
/* owner_location */
339
truncate table owner_location;
342
truncate table owner_location;
340
insert into owner_location ( owner_id,location_id,created,removed )
343
insert into owner_location ( owner_id,location_id,created )
341
   select
344
   select
342
      map_type.new_id,
345
      map_type.new_id,
343
      mapping.new_id,
346
      mapping.new_id,
344
      date(camp.site.added_date),
347
      date(camp.site.added_date)
345
      date(camp.site.removed_date)
-
 
346
   from
348
   from
347
      camp.site
349
      camp.site
348
      join camp.client using (client_id)
350
      join camp.client using (client_id)
349
      join camp2.mapping on (camp.site.site_id = mapping.old_id and mapping.tablename = 'location')
351
      join camp2.mapping on (camp.site.site_id = mapping.old_id and mapping.tablename = 'location')
350
      join camp2.mapping map_type on (camp.client.client_id = map_type.old_id and map_type.tablename = 'owner' )
352
      join camp2.mapping map_type on (camp.client.client_id = map_type.old_id and map_type.tablename = 'owner' )