-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Merge migrations * Remove model reference from migration * Bump bundler version * Dump schema * Drop unused delayed jobs table
- Loading branch information
1 parent
a44a266
commit 046136f
Showing
38 changed files
with
452 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class CreateFeeds < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table :feeds do |t| | ||
t.string :name, null: false | ||
t.integer :posts_count, null: false, default: 0 | ||
t.datetime :refreshed_at | ||
|
||
t.timestamps | ||
end | ||
|
||
add_index :feeds, :name, unique: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class CreatePosts < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table :posts do |t| | ||
t.integer :feed_id, null: false | ||
t.string :link, null: false | ||
t.datetime :published_at, null: false | ||
t.string :text, null: false, default: "" | ||
t.string :attachments, null: false, array: true, default: [] | ||
t.string :comments, null: false, array: true, default: [] | ||
t.string :freefeed_post_id | ||
t.timestamps | ||
end | ||
|
||
add_index :posts, :feed_id | ||
add_index :posts, :link | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class CreateDelayedJobs < ActiveRecord::Migration[4.2] | ||
def self.up | ||
create_table :delayed_jobs, force: true do |table| | ||
table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue | ||
table.integer :attempts, default: 0, null: false # Provides for retries, but still fail eventually. | ||
table.text :handler, null: false # YAML-encoded string of the object that will do work | ||
table.text :last_error # reason for last failure (See Note below) | ||
table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future. | ||
table.datetime :locked_at # Set when a client is working on this object | ||
table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead) | ||
table.string :locked_by # Who is working on this object (if locked) | ||
table.string :queue # The name of the queue this job is in | ||
table.timestamps null: true | ||
end | ||
|
||
add_index :delayed_jobs, [:priority, :run_at], name: "delayed_jobs_priority" | ||
end | ||
|
||
def self.down | ||
drop_table :delayed_jobs | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class CreateDataPoints < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table :data_points do |t| | ||
t.integer :series_id | ||
t.json :details, null: false, default: {} | ||
t.datetime :created_at, null: false | ||
end | ||
|
||
add_index :data_points, :series_id | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class CreateDataPointSeries < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table :data_point_series do |t| | ||
t.string :name, null: false | ||
t.datetime :created_at, null: false | ||
end | ||
|
||
add_index :data_point_series, :name, unique: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class AddPostStatus < ActiveRecord::Migration[5.0] | ||
def change | ||
add_column :posts, :status, :integer, null: false, default: 0 | ||
add_index :posts, :status | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class UpdatePostStatuses < ActiveRecord::Migration[5.0] | ||
def up | ||
# Replace "idle" status with "published" | ||
execute <<-SQL | ||
UPDATE posts | ||
SET status = 2 | ||
WHERE status = 0 AND freefeed_post_id IS NOT NULL | ||
SQL | ||
end | ||
|
||
def down | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class AddFeedDetails < ActiveRecord::Migration[5.0] | ||
def change | ||
add_column :feeds, :url, :string | ||
add_column :feeds, :processor, :string | ||
add_column :feeds, :normalizer, :string | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class CreateErrors < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table "errors" do |t| | ||
t.integer "status", default: 0, null: false, index: true | ||
t.string "error_class_name", default: "", null: false, index: true | ||
t.string "file_name", index: true | ||
t.integer "line_number" | ||
t.string "label", default: "", null: false | ||
t.string "message", default: "", null: false | ||
t.string "backtrace", default: [], null: false, array: true | ||
t.string "filtered_backtrace", default: [], null: false, array: true | ||
t.json "context", default: {}, null: false | ||
t.datetime "occured_at", null: false, index: true | ||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddAfterToFeeds < ActiveRecord::Migration[5.1] | ||
def change | ||
add_column :feeds, :after, :datetime | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddRefreshTimeToFeeds < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :feeds, :refresh_interval, :integer, null: false, default: 0 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddOptionsToFeeds < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :feeds, :options, :json, null: false, default: {} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddLoaderToFeeds < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :feeds, :loader, :string | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddImportLimitToFeeds < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :feeds, :import_limit, :integer | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class AddUidToPosts < ActiveRecord::Migration[5.2] | ||
class Post < ActiveRecord::Base | ||
end | ||
|
||
def change | ||
add_column :posts, :uid, :string | ||
Post.update_all("uid = link") | ||
change_column :posts, :uid, :string, null: false | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
db/migrate/20190609193619_add_last_post_created_at_to_feeds.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddLastPostCreatedAtToFeeds < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :feeds, :last_post_created_at, :datetime | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddFeedSubscriptionsCount < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :feeds, :subscriptions_count, :integer, null: false, default: 0 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class CreateBlockedIps < ActiveRecord::Migration[5.2] | ||
def change | ||
create_table :blocked_ips do |t| | ||
t.inet :ip, null: false | ||
t.datetime :created_at, default: -> { "CURRENT_TIMESTAMP" } | ||
t.datetime :updated_at, default: -> { "CURRENT_TIMESTAMP" } | ||
end | ||
|
||
add_index :blocked_ips, :ip, unique: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class AddFeedStatus < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :feeds, :status, :integer, null: false, default: 0 | ||
add_index :feeds, :status | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class AddTargetToErrors < ActiveRecord::Migration[5.2] | ||
def change | ||
add_reference :errors, :target, polymorphic: true | ||
remove_column :errors, :filtered_backtrace, :string, default: [], null: false, array: true | ||
rename_column :errors, :error_class_name, :exception | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class DefaultOccuredAt < ActiveRecord::Migration[6.0] | ||
def change | ||
change_column :errors, :occured_at, :datetime, default: -> { "CURRENT_TIMESTAMP" } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddValidationErrorsToPosts < ActiveRecord::Migration[6.0] | ||
def change | ||
add_column :posts, :validation_errors, :string, array: true, default: [], null: false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class CreateNitterInstances < ActiveRecord::Migration[6.1] | ||
def change | ||
create_table :nitter_instances do |t| | ||
t.string :status, null: false, index: true | ||
t.string :url, null: false, index: true | ||
t.datetime :errored_at, index: true | ||
t.integer :errors_count, null: false, default: 0 | ||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddStateToFeeds < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column :feeds, :state, :string, null: false, default: "enabled" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class AddFeedErrorCounters < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column :feeds, :errors_count, :integer, null: false, default: 0 | ||
add_column :feeds, :total_errors_count, :integer, null: false, default: 0 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class ChangeFeedStateDefault < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column :feeds, :state_updated_at, :datetime | ||
change_column_default :feeds, :state, from: "enabled", to: "pristine" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class AddDisablingReasonToFeeds < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column :feeds, :source, :string, null: false, default: "" | ||
add_column :feeds, :description, :string, null: false, default: "" | ||
add_column :feeds, :disabling_reason, :string, null: false, default: "" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class CreateSparklines < ActiveRecord::Migration[6.1] | ||
def change | ||
create_table :sparklines do |t| | ||
t.belongs_to :feed, index: true | ||
t.jsonb :data, null: false, default: {} | ||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class DropBlockedIps < ActiveRecord::Migration[6.1] | ||
def self.up | ||
drop_table :blocked_ips | ||
end | ||
|
||
def self.down | ||
create_table :blocked_ips do |t| | ||
t.inet :ip, null: false | ||
t.datetime :created_at, default: -> { "CURRENT_TIMESTAMP" } | ||
t.datetime :updated_at, default: -> { "CURRENT_TIMESTAMP" } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class DropDataPoints < ActiveRecord::Migration[6.1] | ||
def self.up | ||
drop_table :data_points | ||
drop_table :data_point_series | ||
end | ||
|
||
def self.down | ||
create_table :data_points do |t| | ||
t.integer :series_id, index: true | ||
t.json :details, null: false, default: {} | ||
t.datetime :created_at, null: false | ||
end | ||
|
||
create_table :data_point_series do |t| | ||
t.string :name, null: false, index: true | ||
t.datetime :created_at, null: false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# State backfill: | ||
# | ||
# Status values: | ||
# - idle: 0 | ||
# - ready: 1 | ||
# - published: 2 | ||
# - ignored: 3 | ||
# - not_valid: 4 | ||
# - error: 5 | ||
# | ||
# scope = Post.where("created_at <= ?", DateTime.parse("Sat, 01 Jul 2023 14:15:16.356921000 UTC +00:00")); nil | ||
# scope.where(status: 0).update_all(state: "rejected") | ||
# scope.where(status: 2).update_all(state: "published") | ||
# scope.where(status: 3).update_all(state: "rejected") | ||
# scope.where(status: 4).update_all(state: "rejected") | ||
# scope.where(status: 5).update_all(state: "failed") | ||
# | ||
class AddStateToPosts < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column :posts, :state, :string, null: false, default: "draft" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class CreateServiceInstances < ActiveRecord::Migration[6.1] | ||
def change | ||
create_table :service_instances do |t| | ||
t.string :service_type, null: false | ||
t.string :state, null: false, index: true | ||
t.string :url, null: false | ||
t.integer :errors_count, null: false, default: 0 | ||
t.integer :total_errors_count, null: false, default: 0 | ||
t.datetime :used_at | ||
t.datetime :failed_at | ||
t.timestamps | ||
end | ||
|
||
add_index :service_instances, [:service_type, :url], unique: true | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
db/migrate/20230804133646_add_usages_count_to_service_instances.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddUsagesCountToServiceInstances < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :service_instances, :usages_count, :integer, null: false, default: 0 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class ChangePostsLinkDefault < ActiveRecord::Migration[7.0] | ||
def change | ||
change_column_default :posts, :link, from: nil, to: "" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddPostsSourceContent < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :posts, :source_content, :jsonb, null: false, default: {} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class DropDelayedJobs < ActiveRecord::Migration[7.1] | ||
def up | ||
drop_table :delayed_jobs, if_exists: true | ||
end | ||
|
||
def down | ||
create_table :delayed_jobs, if_not_exists: true, force: true do |table| | ||
table.integer :priority, default: 0, null: false | ||
table.integer :attempts, default: 0, null: false | ||
table.text :handler, null: false | ||
table.text :last_error | ||
table.datetime :run_at | ||
table.datetime :locked_at | ||
table.datetime :failed_at | ||
table.string :locked_by | ||
table.string :queue | ||
table.timestamps null: true | ||
end | ||
|
||
add_index :delayed_jobs, [:priority, :run_at], name: "delayed_jobs_priority" | ||
end | ||
end |
Oops, something went wrong.