15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/jungle_path/app/ztools/zbootstrapdata.rb', line 15
def self.root_data db_config=nil, schema_initial_version=nil
db = JunglePath::DBAccess::IO::DB.new(db_config) if db_config
db = Server::DB.instance unless db
if schema_initial_version
schema_info = Schema::SchemaInfo.new({version: schema_initial_version})
db.insert._model(schema_info)
end
hash = 'sha1:1000:/CloeFSPBOT7Ac/Jf/qQLk59iQbflhxf:H4eHZ0w51f3UdQpM+tp2DdhofDPkTf2P\n' hash_zoo = 'sha1:1000:wNGOiLtzLt7U9t7g+AoQVYZBeZn4NDIl:WZ7ADLonzVbnMP+d0g4K94Rk06ai4Ezk\n' users = [
Schema::User.new({id: 0, name: 'root', user_name: 'root', role: 'root', hash: hash, email: nil, active: true, created_by_user_id: 0, updated_by_user_id: 0}),
Schema::User.new({id: 1, name: 'admin', user_name: 'admin', role: 'admin', hash: hash, email: nil, active: true, created_by_user_id: 0, updated_by_user_id: 0}),
Schema::User.new({id: 2, name: 'user', user_name: 'user', role: 'user', hash: hash_zoo, email: nil, active: true, created_by_user_id: 0, updated_by_user_id: 0})
]
users.each {|user| db.insert._model(user)}
contacts = [
Schema::Contact.new({id: 0, name: 'root', email: '[email protected]', user_id: 0, created_by_user_id: 0, updated_by_user_id: 0}),
Schema::Contact.new({id: 1, name: 'admin', email: '[email protected]', user_id: 1, created_by_user_id: 0, updated_by_user_id: 0}),
Schema::Contact.new({id: 2, name: 'user', email: '[email protected]', user_id: 2, created_by_user_id: 0, updated_by_user_id: 0})
]
contacts.each {|contact| db.insert._model(contact)}
fix_serial db
end
|