diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2022-12-10 12:32:44 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2022-12-10 12:32:44 -0500 |
commit | 230ab3079fd4e16ebaa593f6cc5fdbcbad3c2321 (patch) | |
tree | b61b7d4c706de43361da73cce0d2a2a006a89b18 /db/migrate | |
parent | dc7253d0b71f25c2e9a4547d414fa18390b74fbf (diff) | |
download | thoughts-230ab3079fd4e16ebaa593f6cc5fdbcbad3c2321.tar.gz thoughts-230ab3079fd4e16ebaa593f6cc5fdbcbad3c2321.tar.bz2 thoughts-230ab3079fd4e16ebaa593f6cc5fdbcbad3c2321.zip |
Installed LINGO scoreboard
Diffstat (limited to 'db/migrate')
4 files changed, 70 insertions, 0 deletions
diff --git a/db/migrate/20221210170526_add_service_name_to_active_storage_blobs.active_storage.rb b/db/migrate/20221210170526_add_service_name_to_active_storage_blobs.active_storage.rb new file mode 100644 index 0000000..a15c6ce --- /dev/null +++ b/db/migrate/20221210170526_add_service_name_to_active_storage_blobs.active_storage.rb | |||
@@ -0,0 +1,22 @@ | |||
1 | # This migration comes from active_storage (originally 20190112182829) | ||
2 | class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] | ||
3 | def up | ||
4 | return unless table_exists?(:active_storage_blobs) | ||
5 | |||
6 | unless column_exists?(:active_storage_blobs, :service_name) | ||
7 | add_column :active_storage_blobs, :service_name, :string | ||
8 | |||
9 | if configured_service = ActiveStorage::Blob.service.name | ||
10 | ActiveStorage::Blob.unscoped.update_all(service_name: configured_service) | ||
11 | end | ||
12 | |||
13 | change_column :active_storage_blobs, :service_name, :string, null: false | ||
14 | end | ||
15 | end | ||
16 | |||
17 | def down | ||
18 | return unless table_exists?(:active_storage_blobs) | ||
19 | |||
20 | remove_column :active_storage_blobs, :service_name | ||
21 | end | ||
22 | end | ||
diff --git a/db/migrate/20221210170527_create_active_storage_variant_records.active_storage.rb b/db/migrate/20221210170527_create_active_storage_variant_records.active_storage.rb new file mode 100644 index 0000000..94ac83a --- /dev/null +++ b/db/migrate/20221210170527_create_active_storage_variant_records.active_storage.rb | |||
@@ -0,0 +1,27 @@ | |||
1 | # This migration comes from active_storage (originally 20191206030411) | ||
2 | class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] | ||
3 | def change | ||
4 | return unless table_exists?(:active_storage_blobs) | ||
5 | |||
6 | # Use Active Record's configured type for primary key | ||
7 | create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t| | ||
8 | t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type | ||
9 | t.string :variation_digest, null: false | ||
10 | |||
11 | t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true | ||
12 | t.foreign_key :active_storage_blobs, column: :blob_id | ||
13 | end | ||
14 | end | ||
15 | |||
16 | private | ||
17 | def primary_key_type | ||
18 | config = Rails.configuration.generators | ||
19 | config.options[config.orm][:primary_key_type] || :primary_key | ||
20 | end | ||
21 | |||
22 | def blobs_primary_key_type | ||
23 | pkey_name = connection.primary_key(:active_storage_blobs) | ||
24 | pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name } | ||
25 | pkey_column.bigint? ? :bigint : pkey_column.type | ||
26 | end | ||
27 | end | ||
diff --git a/db/migrate/20221210170528_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb b/db/migrate/20221210170528_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb new file mode 100644 index 0000000..93c8b85 --- /dev/null +++ b/db/migrate/20221210170528_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb | |||
@@ -0,0 +1,8 @@ | |||
1 | # This migration comes from active_storage (originally 20211119233751) | ||
2 | class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0] | ||
3 | def change | ||
4 | return unless table_exists?(:active_storage_blobs) | ||
5 | |||
6 | change_column_null(:active_storage_blobs, :checksum, true) | ||
7 | end | ||
8 | end | ||
diff --git a/db/migrate/20221210170549_create_lingo_scores.lingo.rb b/db/migrate/20221210170549_create_lingo_scores.lingo.rb new file mode 100644 index 0000000..f56790f --- /dev/null +++ b/db/migrate/20221210170549_create_lingo_scores.lingo.rb | |||
@@ -0,0 +1,13 @@ | |||
1 | # This migration comes from lingo (originally 20221210011146) | ||
2 | class CreateLingoScores < ActiveRecord::Migration[7.0] | ||
3 | def change | ||
4 | create_table :lingo_scores do |t| | ||
5 | t.integer :user_id | ||
6 | t.string :username | ||
7 | t.string :avatar_url | ||
8 | t.integer :score | ||
9 | |||
10 | t.timestamps | ||
11 | end | ||
12 | end | ||
13 | end | ||