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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/nearline/schema.rb', line 24
def generate_schema
ActiveRecord::Schema.define do
create_table :blocks do |t|
t.column :fingerprint, :string, :length => 40, :null => false
t.column :bulk_content, :text
t.column :is_compressed, :boolean, :default => false
end
add_index :blocks, [:fingerprint], :unique => true
create_table :file_contents do |t|
t.column :fingerprint, :string, :length => 40
t.column :file_size, :string, :default => 0
t.column :verified_at, :datetime
end
create_table :sequences do |t|
t.column :sequence, :integer, :null => false
t.column :block_id, :integer, :null => false
t.column :file_content_id, :integer, :null => false
end
create_table :systems do |t|
t.column :name, :string, :null => false
end
add_index :systems, [:name], :unique => true
create_table :archived_files do |t|
t.column :system_id, :integer, :null => false
t.column :path, :text, :null => false
t.column :path_hash, :string, :null => false, :length => 40
t.column :file_content_id, :integer
t.column :uid, :integer, :default => -1
t.column :gid, :integer, :default => -1
t.column :mtime, :integer, :default => 0
t.column :mode, :integer, :default => 33206 t.column :ftype, :string, :null => false
t.column :ftype_data, :text
end
add_index :archived_files, [:path_hash], :unique => true
create_table :manifests do |t|
t.column :system_id, :integer
t.column :created_at, :datetime
t.column :completed_at, :datetime
end
create_table :archived_files_manifests, :id => false do |t|
t.column :archived_file_id, :integer
t.column :manifest_id, :integer
end
create_table :logs do |t|
t.column :manifest_id, :integer, :null => false
t.column :message, :text
t.column :created_at, :datetime
end
create_table :nearline_version, :id => false do |t|
t.column :version, :string
end
execute "insert into nearline_version (version) values ('#{Nearline::DB_VERSION}')"
end
end
|