legion-apollo 0.3.7 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ Sequel.migration do # rubocop:disable Metrics/BlockLength
4
+ up do # rubocop:disable Metrics/BlockLength
5
+ alter_table(:local_knowledge) do
6
+ add_column :is_inference, :boolean, default: false, null: false
7
+ add_column :parent_knowledge_id, Integer, null: true
8
+ add_column :is_latest, :boolean, default: true, null: false
9
+ add_column :supersession_type, String, size: 32, null: true
10
+ add_column :forget_reason, String, size: 128, null: true
11
+ add_column :summary_l0, String, size: 500, null: true
12
+ add_column :summary_l1, :text, null: true
13
+ add_column :knowledge_tier, String, size: 4, null: false, default: 'L2'
14
+ add_column :l0_generated_at, String, null: true
15
+ add_column :l1_generated_at, String, null: true
16
+
17
+ add_index :is_latest, name: :idx_local_knowledge_is_latest
18
+ add_index :is_inference, name: :idx_local_knowledge_is_inference
19
+ add_index :knowledge_tier, name: :idx_local_knowledge_tier
20
+ add_index :parent_knowledge_id, name: :idx_local_knowledge_parent
21
+ end
22
+
23
+ create_table(:local_source_links) do
24
+ primary_key :id
25
+ Integer :entry_id, null: false
26
+ String :source_uri, text: true
27
+ String :source_hash, size: 64
28
+ Float :relevance_score, default: 1.0
29
+ String :extraction_method, size: 64
30
+ String :created_at, null: false
31
+
32
+ index :entry_id, name: :idx_source_links_entry
33
+ index :source_hash, name: :idx_source_links_hash
34
+ end
35
+ end
36
+
37
+ down do
38
+ drop_table(:local_source_links) if table_exists?(:local_source_links)
39
+
40
+ alter_table(:local_knowledge) do
41
+ drop_column :is_inference
42
+ drop_column :parent_knowledge_id
43
+ drop_column :is_latest
44
+ drop_column :supersession_type
45
+ drop_column :forget_reason
46
+ drop_column :summary_l0
47
+ drop_column :summary_l1
48
+ drop_column :knowledge_tier
49
+ drop_column :l0_generated_at
50
+ drop_column :l1_generated_at
51
+ end
52
+ end
53
+ end