easy_ml 0.2.0.pre.rc40 → 0.2.0.pre.rc43

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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +11 -9
  3. data/app/controllers/easy_ml/settings_controller.rb +1 -4
  4. data/app/frontend/pages/SettingsPage.tsx +1 -80
  5. data/app/jobs/easy_ml/batch_job.rb +45 -1
  6. data/app/jobs/easy_ml/compute_feature_job.rb +68 -4
  7. data/app/models/concerns/easy_ml/dataframe_serialization.rb +30 -0
  8. data/app/models/easy_ml/dataset.rb +23 -22
  9. data/app/models/easy_ml/dataset_history.rb +1 -6
  10. data/app/models/easy_ml/datasources/polars_datasource.rb +4 -18
  11. data/app/models/easy_ml/event.rb +2 -1
  12. data/app/models/easy_ml/event_context.rb +58 -0
  13. data/app/models/easy_ml/feature.rb +43 -14
  14. data/app/models/easy_ml/model.rb +4 -7
  15. data/app/models/easy_ml/model_file.rb +17 -48
  16. data/app/models/easy_ml/splitter_history.rb +16 -0
  17. data/app/serializers/easy_ml/prediction_serializer.rb +6 -1
  18. data/config/initializers/zhong.rb +4 -0
  19. data/lib/easy_ml/data/date_converter.rb +1 -0
  20. data/lib/easy_ml/data/polars_reader.rb +17 -4
  21. data/lib/easy_ml/data/statistics_learner.rb +1 -1
  22. data/lib/easy_ml/engine.rb +22 -0
  23. data/lib/easy_ml/pending_migrations.rb +19 -0
  24. data/lib/easy_ml/predict.rb +25 -12
  25. data/lib/easy_ml/railtie/generators/migration/migration_generator.rb +39 -157
  26. data/lib/easy_ml/railtie/templates/migration/add_workflow_status_to_easy_ml_features.rb.tt +13 -0
  27. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_column_histories.rb.tt +4 -2
  28. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_columns.rb.tt +22 -20
  29. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_dataset_histories.rb.tt +5 -3
  30. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_datasets.rb.tt +26 -24
  31. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_datasource_histories.rb.tt +5 -3
  32. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_datasources.rb.tt +12 -10
  33. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_deploys.rb.tt +21 -19
  34. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_event_contexts.rb.tt +14 -0
  35. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_events.rb.tt +16 -14
  36. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_feature_histories.rb.tt +10 -8
  37. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_features.rb.tt +27 -25
  38. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_model_file_histories.rb.tt +5 -3
  39. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_model_files.rb.tt +13 -11
  40. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_model_histories.rb.tt +5 -3
  41. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_models.rb.tt +28 -26
  42. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_predictions.rb.tt +13 -11
  43. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_retraining_jobs.rb.tt +70 -66
  44. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_settings.rb.tt +6 -4
  45. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_splitter_histories.rb.tt +6 -4
  46. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_splitters.rb.tt +11 -9
  47. data/lib/easy_ml/railtie/templates/migration/create_easy_ml_tuner_jobs.rb.tt +34 -30
  48. data/lib/easy_ml/railtie/templates/migration/drop_path_from_easy_ml_model_files.rb.tt +11 -0
  49. data/lib/easy_ml/version.rb +1 -1
  50. data/lib/easy_ml.rb +1 -0
  51. data/public/easy_ml/assets/.vite/manifest.json +2 -2
  52. data/public/easy_ml/assets/assets/Application-zpGA_Q9c.css +1 -0
  53. data/public/easy_ml/assets/assets/entrypoints/{Application.tsx-DF5SSkYi.js → Application.tsx-jPsqOyb0.js} +87 -97
  54. data/public/easy_ml/assets/assets/entrypoints/Application.tsx-jPsqOyb0.js.map +1 -0
  55. metadata +11 -19
  56. data/public/easy_ml/assets/assets/Application-Cu7lNJmG.css +0 -1
  57. data/public/easy_ml/assets/assets/entrypoints/Application.tsx-DF5SSkYi.js.map +0 -1
@@ -15,6 +15,33 @@ module EasyML
15
15
  # Define the migration name
16
16
  desc "Generates migrations for EasyMLModel"
17
17
 
18
+ # Define the order of migrations
19
+ MIGRATION_ORDER = %w[
20
+ create_easy_ml_datasources
21
+ create_easy_ml_datasets
22
+ create_easy_ml_columns
23
+ create_easy_ml_models
24
+ create_easy_ml_model_files
25
+ create_easy_ml_tuner_jobs
26
+ create_easy_ml_retraining_jobs
27
+ create_easy_ml_settings
28
+ create_easy_ml_events
29
+ create_easy_ml_features
30
+ create_easy_ml_splitters
31
+ create_easy_ml_splitter_histories
32
+ create_easy_ml_deploys
33
+ create_easy_ml_datasource_histories
34
+ create_easy_ml_dataset_histories
35
+ create_easy_ml_column_histories
36
+ create_easy_ml_model_histories
37
+ create_easy_ml_model_file_histories
38
+ create_easy_ml_feature_histories
39
+ create_easy_ml_predictions
40
+ create_easy_ml_event_contexts
41
+ add_workflow_status_to_easy_ml_features
42
+ drop_path_from_easy_ml_model_files
43
+ ].freeze
44
+
18
45
  # Specify the next migration number
19
46
  def self.next_migration_number(dirname)
20
47
  sleep(1)
@@ -29,169 +56,24 @@ module EasyML
29
56
 
30
57
  # Generate the migration files using the templates
31
58
  def create_migration_files
32
- create_easy_ml_datasource_migration
33
- create_easy_ml_datasets_migration
34
- create_easy_ml_columns_migration
35
- create_easy_ml_models_migration
36
- create_easy_ml_model_files_migration
37
- create_easy_ml_tuner_jobs_migration
38
- create_easy_ml_retraining_jobs_migration
39
- create_easy_ml_settings_migration
40
- create_easy_ml_events_migration
41
- create_easy_ml_features_migration
42
- create_easy_ml_splitters_migration
43
- create_easy_ml_splitter_histories_migration
44
- create_easy_ml_deploys
59
+ # Check for existing migrations first
60
+ existing_migrations = Dir.glob(Rails.root.join("db/migrate/*_*.rb")).map do |f|
61
+ File.basename(f).sub(/^\d+_/, "").sub(/\.rb$/, "")
62
+ end
45
63
 
46
- create_easy_ml_datasource_histories_migration
47
- create_easy_ml_dataset_histories_migration
48
- create_easy_ml_column_histories_migration
49
- create_easy_ml_model_histories_migration
50
- create_easy_ml_model_file_histories_migration
51
- create_easy_ml_feature_histories_migration
52
- create_easy_ml_predictions_migration
64
+ # Create migrations in order if they don't exist
65
+ MIGRATION_ORDER.each do |migration_name|
66
+ next if existing_migrations.include?(migration_name)
67
+ install_migration(migration_name)
68
+ end
53
69
  end
54
70
 
55
71
  private
56
72
 
57
- # Generate the migration file for EasyMLModel using the template
58
- def create_easy_ml_models_migration
59
- migration_template(
60
- "create_easy_ml_models.rb.tt",
61
- "db/migrate/create_easy_ml_models.rb"
62
- )
63
- end
64
-
65
- def create_easy_ml_model_files_migration
66
- migration_template(
67
- "create_easy_ml_model_files.rb.tt",
68
- "db/migrate/create_easy_ml_model_files.rb"
69
- )
70
- end
71
-
72
- def create_easy_ml_datasource_migration
73
- migration_template(
74
- "create_easy_ml_datasources.rb.tt",
75
- "db/migrate/create_easy_ml_datasources.rb"
76
- )
77
- end
78
-
79
- def create_easy_ml_datasets_migration
80
- migration_template(
81
- "create_easy_ml_datasets.rb.tt",
82
- "db/migrate/create_easy_ml_datasets.rb"
83
- )
84
- end
85
-
86
- def create_easy_ml_tuner_jobs_migration
87
- migration_template(
88
- "create_easy_ml_tuner_jobs.rb.tt",
89
- "db/migrate/create_easy_ml_tuner_jobs.rb"
90
- )
91
- end
92
-
93
- def create_easy_ml_retraining_jobs_migration
94
- migration_template(
95
- "create_easy_ml_retraining_jobs.rb.tt",
96
- "db/migrate/create_easy_ml_retraining_jobs.rb"
97
- )
98
- end
99
-
100
- def create_easy_ml_settings_migration
101
- migration_template(
102
- "create_easy_ml_settings.rb.tt",
103
- "db/migrate/create_easy_ml_settings.rb"
104
- )
105
- end
106
-
107
- def create_easy_ml_events_migration
108
- migration_template(
109
- "create_easy_ml_events.rb.tt",
110
- "db/migrate/create_easy_ml_events.rb"
111
- )
112
- end
113
-
114
- def create_easy_ml_columns_migration
115
- migration_template(
116
- "create_easy_ml_columns.rb.tt",
117
- "db/migrate/create_easy_ml_columns.rb"
118
- )
119
- end
120
-
121
- def create_easy_ml_features_migration
122
- migration_template(
123
- "create_easy_ml_features.rb.tt",
124
- "db/migrate/create_easy_ml_features.rb"
125
- )
126
- end
127
-
128
- def create_easy_ml_splitters_migration
129
- migration_template(
130
- "create_easy_ml_splitters.rb.tt",
131
- "db/migrate/create_easy_ml_splitters.rb"
132
- )
133
- end
134
-
135
- def create_easy_ml_splitter_histories_migration
136
- migration_template(
137
- "create_easy_ml_splitter_histories.rb.tt",
138
- "db/migrate/create_easy_ml_splitter_histories.rb"
139
- )
140
- end
141
-
142
- def create_easy_ml_datasource_histories_migration
143
- migration_template(
144
- "create_easy_ml_datasource_histories.rb.tt",
145
- "db/migrate/create_easy_ml_datasource_histories.rb"
146
- )
147
- end
148
-
149
- def create_easy_ml_dataset_histories_migration
150
- migration_template(
151
- "create_easy_ml_dataset_histories.rb.tt",
152
- "db/migrate/create_easy_ml_dataset_histories.rb"
153
- )
154
- end
155
-
156
- def create_easy_ml_column_histories_migration
157
- migration_template(
158
- "create_easy_ml_column_histories.rb.tt",
159
- "db/migrate/create_easy_ml_column_histories.rb"
160
- )
161
- end
162
-
163
- def create_easy_ml_model_histories_migration
164
- migration_template(
165
- "create_easy_ml_model_histories.rb.tt",
166
- "db/migrate/create_easy_ml_model_histories.rb"
167
- )
168
- end
169
-
170
- def create_easy_ml_feature_histories_migration
171
- migration_template(
172
- "create_easy_ml_feature_histories.rb.tt",
173
- "db/migrate/create_easy_ml_feature_histories.rb"
174
- )
175
- end
176
-
177
- def create_easy_ml_model_file_histories_migration
178
- migration_template(
179
- "create_easy_ml_model_file_histories.rb.tt",
180
- "db/migrate/create_easy_ml_model_file_histories.rb"
181
- )
182
- end
183
-
184
- def create_easy_ml_deploys
185
- migration_template(
186
- "create_easy_ml_deploys.rb.tt",
187
- "db/migrate/create_easy_ml_deploys.rb"
188
- )
189
- end
190
-
191
- def create_easy_ml_predictions_migration
73
+ def install_migration(migration_name)
192
74
  migration_template(
193
- "create_easy_ml_predictions.rb.tt",
194
- "db/migrate/create_easy_ml_predictions.rb"
75
+ "#{migration_name}.rb.tt",
76
+ "db/migrate/#{migration_name}.rb"
195
77
  )
196
78
  end
197
79
 
@@ -0,0 +1,13 @@
1
+ class AddWorkflowStatusToEasyMLFeatures < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
2
+ def change
3
+ unless column_exists?(:easy_ml_features, :workflow_status)
4
+ add_column :easy_ml_features, :workflow_status, :string
5
+ add_index :easy_ml_features, :workflow_status
6
+ end
7
+
8
+ unless column_exists?(:easy_ml_feature_histories, :workflow_status)
9
+ add_column :easy_ml_feature_histories, :workflow_status, :string
10
+ add_index :easy_ml_feature_histories, :workflow_status
11
+ end
12
+ end
13
+ end
@@ -2,8 +2,10 @@ require "historiographer/postgres_migration"
2
2
 
3
3
  class CreateEasyMLColumnHistories < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
4
4
  def change
5
- create_table :easy_ml_column_histories do |t|
6
- t.histories(foreign_key: :column_id)
5
+ unless table_exists?(:easy_ml_column_histories)
6
+ create_table :easy_ml_column_histories do |t|
7
+ t.histories(foreign_key: :column_id)
8
+ end
7
9
  end
8
10
  end
9
11
  end
@@ -1,25 +1,27 @@
1
1
  class CreateEasyMLColumns < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
2
2
  def change
3
- create_table :easy_ml_columns do |t|
4
- t.bigint :dataset_id, null: false
5
- t.string :name, null: false
6
- t.string :description
7
- t.string :datatype # The symbol representation (e.g., 'float', 'integer')
8
- t.string :polars_datatype # The full Polars class name (e.g., 'Polars::Float64')
9
- t.boolean :is_target
10
- t.boolean :hidden, default: false
11
- t.boolean :drop_if_null, default: false
12
- t.json :preprocessing_steps
13
- t.json :sample_values # Store up to 3 sample values
14
- t.json :statistics
3
+ unless table_exists?(:easy_ml_columns)
4
+ create_table :easy_ml_columns do |t|
5
+ t.bigint :dataset_id, null: false
6
+ t.string :name, null: false
7
+ t.string :description
8
+ t.string :datatype # The symbol representation (e.g., 'float', 'integer')
9
+ t.string :polars_datatype # The full Polars class name (e.g., 'Polars::Float64')
10
+ t.boolean :is_target
11
+ t.boolean :hidden, default: false
12
+ t.boolean :drop_if_null, default: false
13
+ t.json :preprocessing_steps
14
+ t.json :sample_values # Store up to 3 sample values
15
+ t.json :statistics
15
16
 
16
- t.timestamps
17
+ t.timestamps
17
18
 
18
- t.index [:dataset_id, :name], unique: true
19
- t.index :datatype
20
- t.index :hidden
21
- t.index :drop_if_null
22
- t.index :is_target
19
+ t.index [:dataset_id, :name], unique: true
20
+ t.index :datatype
21
+ t.index :hidden
22
+ t.index :drop_if_null
23
+ t.index :is_target
24
+ end
23
25
  end
24
- end
25
- end
26
+ end
27
+ end
@@ -2,8 +2,10 @@ require "historiographer/postgres_migration"
2
2
 
3
3
  class CreateEasyMLDatasetHistories < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
4
4
  def change
5
- create_table :easy_ml_dataset_histories do |t|
6
- t.histories(foreign_key: :dataset_id)
5
+ unless table_exists?(:easy_ml_dataset_histories)
6
+ create_table :easy_ml_dataset_histories do |t|
7
+ t.histories(foreign_key: :dataset_id)
8
+ end
7
9
  end
8
10
  end
9
- end
11
+ end
@@ -1,31 +1,33 @@
1
1
  class CreateEasyMLDatasets < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
2
2
  def change
3
- create_table :easy_ml_datasets do |t|
4
- t.string :name, null: false
5
- t.string :description
6
- t.string :dataset_type
7
- t.string :status
8
- t.string :version
9
- t.bigint :datasource_id
10
- t.string :root_dir
11
- t.json :configuration
12
- t.bigint :num_rows
13
- t.string :workflow_status
14
- t.json :statistics
15
- t.json :preprocessor_statistics
16
- t.json :schema
17
- t.datetime :refreshed_at
3
+ unless table_exists?(:easy_ml_datasets)
4
+ create_table :easy_ml_datasets do |t|
5
+ t.string :name, null: false
6
+ t.string :description
7
+ t.string :dataset_type
8
+ t.string :status
9
+ t.string :version
10
+ t.bigint :datasource_id
11
+ t.string :root_dir
12
+ t.json :configuration
13
+ t.bigint :num_rows
14
+ t.string :workflow_status
15
+ t.json :statistics
16
+ t.json :preprocessor_statistics
17
+ t.json :schema
18
+ t.datetime :refreshed_at
18
19
 
19
- t.timestamps
20
+ t.timestamps
20
21
 
21
- t.index :created_at
22
- t.index :refreshed_at
23
- t.index :name
24
- t.index :status
25
- t.index [:name, :status]
26
- t.index :datasource_id
27
- t.index :dataset_type
28
- t.index :workflow_status
22
+ t.index :created_at
23
+ t.index :refreshed_at
24
+ t.index :name
25
+ t.index :status
26
+ t.index [:name, :status]
27
+ t.index :datasource_id
28
+ t.index :dataset_type
29
+ t.index :workflow_status
30
+ end
29
31
  end
30
32
  end
31
33
  end
@@ -2,8 +2,10 @@ require "historiographer/postgres_migration"
2
2
 
3
3
  class CreateEasyMLDatasourceHistories < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
4
4
  def change
5
- create_table :easy_ml_datasource_histories do |t|
6
- t.histories(foreign_key: :datasource_id)
5
+ unless table_exists?(:easy_ml_datasource_histories)
6
+ create_table :easy_ml_datasource_histories do |t|
7
+ t.histories(foreign_key: :datasource_id)
8
+ end
7
9
  end
8
10
  end
9
- end
11
+ end
@@ -1,16 +1,18 @@
1
1
  class CreateEasyMLDatasources < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
2
2
  def change
3
- create_table :easy_ml_datasources do |t|
4
- t.string :name, null: false
5
- t.string :datasource_type
6
- t.string :root_dir
7
- t.json :configuration
8
- t.datetime :refreshed_at
3
+ unless table_exists?(:easy_ml_datasources)
4
+ create_table :easy_ml_datasources do |t|
5
+ t.string :name, null: false
6
+ t.string :datasource_type
7
+ t.string :root_dir
8
+ t.json :configuration
9
+ t.datetime :refreshed_at
9
10
 
10
- t.timestamps
11
- t.index :created_at
12
- t.index :datasource_type
13
- t.index :refreshed_at
11
+ t.timestamps
12
+ t.index :created_at
13
+ t.index :datasource_type
14
+ t.index :refreshed_at
15
+ end
14
16
  end
15
17
  end
16
18
  end
@@ -1,24 +1,26 @@
1
1
  class CreateEasyMLDeploys < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
2
2
  def change
3
- create_table :easy_ml_deploys do |t|
4
- t.bigint :model_id
5
- t.bigint :model_history_id
6
- t.bigint :retraining_run_id
7
- t.bigint :model_file_id
8
- t.string :status, null: false
9
- t.string :trigger, default: 'manual'
10
- t.text :stacktrace
11
- t.string :snapshot_id
12
- t.timestamps
3
+ unless table_exists?(:easy_ml_deploys)
4
+ create_table :easy_ml_deploys do |t|
5
+ t.bigint :model_id
6
+ t.bigint :model_history_id
7
+ t.bigint :retraining_run_id
8
+ t.bigint :model_file_id
9
+ t.string :status, null: false
10
+ t.string :trigger, default: 'manual'
11
+ t.text :stacktrace
12
+ t.string :snapshot_id
13
+ t.timestamps
13
14
 
14
- t.index :created_at
15
- t.index :model_id
16
- t.index :model_history_id
17
- t.index :snapshot_id
18
- t.index :model_file_id
19
- t.index :retraining_run_id
20
- t.index :status
21
- t.index :trigger
15
+ t.index :created_at
16
+ t.index :model_id
17
+ t.index :model_history_id
18
+ t.index :snapshot_id
19
+ t.index :model_file_id
20
+ t.index :retraining_run_id
21
+ t.index :status
22
+ t.index :trigger
23
+ end
22
24
  end
23
25
  end
24
- end
26
+ end
@@ -0,0 +1,14 @@
1
+ class CreateEasyMLEventContexts < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
2
+ def change
3
+ unless table_exists?(:easy_ml_event_contexts)
4
+ create_table :easy_ml_event_contexts do |t|
5
+ t.references :event, null: false, foreign_key: { to_table: :easy_ml_events }
6
+ t.jsonb :context, null: false, default: {}
7
+ t.string :format
8
+ t.timestamps
9
+ end
10
+
11
+ add_index :easy_ml_event_contexts, :context, using: :gin
12
+ end
13
+ end
14
+ end
@@ -1,20 +1,22 @@
1
1
  class CreateEasyMLEvents < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
2
2
  def change
3
- create_table :easy_ml_events do |t|
4
- t.string :name, null: false
5
- t.string :status, null: false
6
- t.string :eventable_type
7
- t.bigint :eventable_id
8
- t.text :stacktrace
3
+ unless table_exists?(:easy_ml_events)
4
+ create_table :easy_ml_events do |t|
5
+ t.string :name, null: false
6
+ t.string :status, null: false
7
+ t.string :eventable_type
8
+ t.bigint :eventable_id
9
+ t.text :stacktrace
9
10
 
10
- t.timestamps
11
+ t.timestamps
11
12
 
12
- t.index :name
13
- t.index :status
14
- t.index :eventable_type
15
- t.index :eventable_id
16
- t.index :created_at
17
- t.index [:eventable_type, :eventable_id]
13
+ t.index :name
14
+ t.index :status
15
+ t.index :eventable_type
16
+ t.index :eventable_id
17
+ t.index :created_at
18
+ t.index [:eventable_type, :eventable_id]
19
+ end
18
20
  end
19
21
  end
20
- end
22
+ end
@@ -2,13 +2,15 @@ require "historiographer/postgres_migration"
2
2
 
3
3
  class CreateEasyMLFeatureHistories < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
4
4
  def change
5
- create_table :easy_ml_feature_histories do |t|
6
- t.histories(
7
- foreign_key: :feature_id,
8
- index_names: {
9
- [:dataset_id, :feature_position] => "idx_feature_histories_on_dataset_and_position"
10
- }
11
- )
5
+ unless table_exists?(:easy_ml_feature_histories)
6
+ create_table :easy_ml_feature_histories do |t|
7
+ t.histories(
8
+ foreign_key: :feature_id,
9
+ index_names: {
10
+ [:dataset_id, :feature_position] => "idx_feature_histories_on_dataset_and_position"
11
+ }
12
+ )
13
+ end
12
14
  end
13
15
  end
14
- end
16
+ end
@@ -1,32 +1,34 @@
1
1
  class CreateEasyMLFeatures < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
2
2
  def change
3
- create_table :easy_ml_features do |t|
4
- t.bigint :dataset_id, null: false
5
- t.string :name
6
- t.bigint :version
7
- t.string :feature_class, null: false
8
- t.integer :feature_position
9
- t.integer :batch_size
10
- t.boolean :needs_fit
11
- t.string :sha
12
- t.string :primary_key, array: true
13
- t.datetime :applied_at
14
- t.datetime :fit_at
15
- t.bigint :refresh_every
3
+ unless table_exists?(:easy_ml_features)
4
+ create_table :easy_ml_features do |t|
5
+ t.bigint :dataset_id, null: false
6
+ t.string :name
7
+ t.bigint :version
8
+ t.string :feature_class, null: false
9
+ t.integer :feature_position
10
+ t.integer :batch_size
11
+ t.boolean :needs_fit
12
+ t.string :sha
13
+ t.string :primary_key, array: true
14
+ t.datetime :applied_at
15
+ t.datetime :fit_at
16
+ t.bigint :refresh_every
16
17
 
17
- t.timestamps
18
+ t.timestamps
18
19
 
19
- t.index %i[dataset_id feature_position], name: "idx_features_on_dataset_and_position"
20
- t.index %i[dataset_id name], unique: true, name: "idx_features_on_dataset_and_name"
21
- t.index :feature_class
22
- t.index :applied_at
23
- t.index :name
24
- t.index :version
25
- t.index :sha
26
- t.index :batch_size
27
- t.index :needs_fit
28
- t.index :fit_at
29
- t.index :refresh_every
20
+ t.index %i[dataset_id feature_position], name: "idx_features_on_dataset_and_position"
21
+ t.index %i[dataset_id name], unique: true, name: "idx_features_on_dataset_and_name"
22
+ t.index :feature_class
23
+ t.index :applied_at
24
+ t.index :name
25
+ t.index :version
26
+ t.index :sha
27
+ t.index :batch_size
28
+ t.index :needs_fit
29
+ t.index :fit_at
30
+ t.index :refresh_every
31
+ end
30
32
  end
31
33
  end
32
34
  end
@@ -2,8 +2,10 @@ require "historiographer/postgres_migration"
2
2
 
3
3
  class CreateEasyMLModelFileHistories < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
4
4
  def change
5
- create_table :easy_ml_model_file_histories do |t|
6
- t.histories(foreign_key: :model_file_id)
5
+ unless table_exists?(:easy_ml_model_file_histories)
6
+ create_table :easy_ml_model_file_histories do |t|
7
+ t.histories(foreign_key: :model_file_id)
8
+ end
7
9
  end
8
10
  end
9
- end
11
+ end
@@ -1,17 +1,19 @@
1
1
  class CreateEasyMLModelFiles < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
2
2
  def change
3
- create_table :easy_ml_model_files do |t|
4
- t.string :filename, null: false
5
- t.string :path, null: false
6
- t.json :configuration
7
- t.string :model_type
8
- t.bigint :model_id
9
- t.timestamps
3
+ unless table_exists?(:easy_ml_model_files)
4
+ create_table :easy_ml_model_files do |t|
5
+ t.string :filename, null: false
6
+ t.string :path, null: false
7
+ t.json :configuration
8
+ t.string :model_type
9
+ t.bigint :model_id
10
+ t.timestamps
10
11
 
11
- t.index :created_at
12
- t.index :filename
13
- t.index [:model_type]
14
- t.index :model_id
12
+ t.index :created_at
13
+ t.index :filename
14
+ t.index [:model_type]
15
+ t.index :model_id
16
+ end
15
17
  end
16
18
  end
17
19
  end
@@ -2,8 +2,10 @@ require "historiographer/postgres_migration"
2
2
 
3
3
  class CreateEasyMLModelHistories < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
4
4
  def change
5
- create_table :easy_ml_model_histories do |t|
6
- t.histories(foreign_key: :model_id)
5
+ unless table_exists?(:easy_ml_model_histories)
6
+ create_table :easy_ml_model_histories do |t|
7
+ t.histories(foreign_key: :model_id)
8
+ end
7
9
  end
8
10
  end
9
- end
11
+ end