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
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
|
# File 'lib/nearline/schema.rb', line 22
def generate_schema
ActiveRecord::Schema.define do
create_table :blocks do |t|
t.column :fingerprint, :string, :length => 40, :null => false
t.column :bulk_content, :binary
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
add_index :sequences, [:sequence, :file_content_id], :unique => true,
:name => "sequence_jn_index"
add_index :sequences, [:block_id]
create_table :archived_files do |t|
t.column :system_name, :string, :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 :is_directory, :boolean
end
add_index :archived_files, [:path_hash], :unique => true
create_table :manifests do |t|
t.column :system_name, :string
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
add_index :archived_files_manifests,
[:archived_file_id, :manifest_id], {
:unique => true,
:name => "manifest_jn_index"
}
create_table :logs do |t|
t.column :manifest_id, :integer, :null => false
t.column :message, :text
t.column :created_at, :datetime
end
end
end
|