Enforce MySQL string/text limits in SQLite

To ensure consistent column lengths, we'll add limits to string and text
columns which match MySQL defaults.
This commit is contained in:
Donal McBreen
2025-11-25 14:49:34 +00:00
parent c2eb840e2b
commit 67f648f356
4 changed files with 145 additions and 96 deletions
+43 -43
View File
@@ -4,7 +4,7 @@ class InitialSchema < ActiveRecord::Migration[8.2]
t.datetime "accessed_at"
t.uuid "board_id", null: false
t.datetime "created_at", null: false
t.string "involvement", default: "access_only", null: false
t.string "involvement", limit: 255, default: "access_only", null: false
t.datetime "updated_at", null: false
t.uuid "user_id", null: false
t.index ["accessed_at"], name: "index_accesses_on_accessed_at", order: :desc
@@ -15,7 +15,7 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "account_join_codes", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.uuid "account_id"
t.string "code", null: false
t.string "code", limit: 255, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "usage_count", default: 0, null: false
@@ -26,7 +26,7 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "accounts", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.datetime "created_at", null: false
t.integer "external_account_id"
t.string "name", null: false
t.string "name", limit: 255, null: false
t.datetime "updated_at", null: false
t.index ["external_account_id"], name: "index_accounts_on_external_account_id", unique: true
end
@@ -34,9 +34,9 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "action_text_rich_texts", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.text "body", size: :long
t.datetime "created_at", null: false
t.string "name", null: false
t.string "name", limit: 255, null: false
t.uuid "record_id", null: false
t.string "record_type", null: false
t.string "record_type", limit: 255, null: false
t.datetime "updated_at", null: false
t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true
end
@@ -44,28 +44,28 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "active_storage_attachments", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.uuid "blob_id", null: false
t.datetime "created_at", null: false
t.string "name", null: false
t.string "name", limit: 255, null: false
t.uuid "record_id", null: false
t.string "record_type", null: false
t.string "record_type", limit: 255, null: false
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
end
create_table "active_storage_blobs", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.bigint "byte_size", null: false
t.string "checksum"
t.string "content_type"
t.string "checksum", limit: 255
t.string "content_type", limit: 255
t.datetime "created_at", null: false
t.string "filename", null: false
t.string "key", null: false
t.string "filename", limit: 255, null: false
t.string "key", limit: 255, null: false
t.text "metadata"
t.string "service_name", null: false
t.string "service_name", limit: 255, null: false
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
end
create_table "active_storage_variant_records", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.uuid "blob_id", null: false
t.string "variation_digest", null: false
t.string "variation_digest", limit: 255, null: false
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
end
@@ -96,7 +96,7 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "board_publications", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.uuid "board_id", null: false
t.datetime "created_at", null: false
t.string "key"
t.string "key", limit: 255
t.datetime "updated_at", null: false
t.index ["board_id"], name: "index_board_publications_on_board_id"
t.index ["key"], name: "index_board_publications_on_key", unique: true
@@ -107,7 +107,7 @@ class InitialSchema < ActiveRecord::Migration[8.2]
t.boolean "all_access", default: false, null: false
t.datetime "created_at", null: false
t.uuid "creator_id", null: false
t.string "name", null: false
t.string "name", limit: 255, null: false
t.datetime "updated_at", null: false
t.index ["creator_id"], name: "index_boards_on_creator_id"
end
@@ -129,7 +129,7 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "card_engagements", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.uuid "card_id"
t.datetime "created_at", null: false
t.string "status", default: "doing", null: false
t.string "status", limit: 255, default: "doing", null: false
t.datetime "updated_at", null: false
t.index ["card_id"], name: "index_card_engagements_on_card_id"
t.index ["status"], name: "index_card_engagements_on_status"
@@ -159,8 +159,8 @@ class InitialSchema < ActiveRecord::Migration[8.2]
t.uuid "creator_id", null: false
t.date "due_on"
t.datetime "last_active_at", null: false
t.string "status", default: "drafted", null: false
t.string "title"
t.string "status", limit: 255, default: "drafted", null: false
t.string "title", limit: 255
t.datetime "updated_at", null: false
t.index ["board_id"], name: "index_cards_on_board_id"
t.index ["column_id"], name: "index_cards_on_column_id"
@@ -187,9 +187,9 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "columns", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.uuid "account_id"
t.uuid "board_id", null: false
t.string "color", null: false
t.string "color", limit: 255, null: false
t.datetime "created_at", null: false
t.string "name", null: false
t.string "name", limit: 255, null: false
t.integer "position", default: 0, null: false
t.datetime "updated_at", null: false
t.index ["board_id", "position"], name: "index_columns_on_board_id_and_position"
@@ -215,7 +215,7 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "entropies", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.bigint "auto_postpone_period", default: 2592000, null: false
t.uuid "container_id", null: false
t.string "container_type", null: false
t.string "container_type", limit: 255, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["container_type", "container_id", "auto_postpone_period"], name: "idx_on_container_type_container_id_auto_postpone_pe_3d79b50517"
@@ -224,12 +224,12 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "events", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.uuid "account_id"
t.string "action", null: false
t.string "action", limit: 255, null: false
t.uuid "board_id", null: false
t.datetime "created_at", null: false
t.uuid "creator_id", null: false
t.uuid "eventable_id", null: false
t.string "eventable_type", null: false
t.string "eventable_type", limit: 255, null: false
t.json "particulars", default: -> { "(json_object())" }
t.datetime "updated_at", null: false
t.index ["action"], name: "index_events_on_summary_id_and_action"
@@ -244,7 +244,7 @@ class InitialSchema < ActiveRecord::Migration[8.2]
t.datetime "created_at", null: false
t.uuid "creator_id", null: false
t.json "fields", default: -> { "(json_object())" }, null: false
t.string "params_digest", null: false
t.string "params_digest", limit: 255, null: false
t.datetime "updated_at", null: false
t.index ["creator_id", "params_digest"], name: "index_filters_on_creator_id_and_params_digest", unique: true
end
@@ -258,13 +258,13 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "identities", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.datetime "created_at", null: false
t.string "email_address", null: false
t.string "email_address", limit: 255, null: false
t.datetime "updated_at", null: false
t.index ["email_address"], name: "index_identities_on_email_address", unique: true
end
create_table "magic_links", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.string "code", null: false
t.string "code", limit: 255, null: false
t.datetime "created_at", null: false
t.datetime "expires_at", null: false
t.uuid "identity_id"
@@ -277,8 +277,8 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "memberships", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.datetime "created_at", null: false
t.uuid "identity_id", null: false
t.string "join_code"
t.string "tenant", null: false
t.string "join_code", limit: 255
t.string "tenant", limit: 255, null: false
t.datetime "updated_at", null: false
t.index ["identity_id"], name: "index_memberships_on_identity_id"
t.index ["tenant", "identity_id"], name: "index_memberships_on_tenant_and_identity_id", unique: true
@@ -290,7 +290,7 @@ class InitialSchema < ActiveRecord::Migration[8.2]
t.uuid "mentionee_id", null: false
t.uuid "mentioner_id", null: false
t.uuid "source_id", null: false
t.string "source_type", null: false
t.string "source_type", limit: 255, null: false
t.datetime "updated_at", null: false
t.index ["mentionee_id"], name: "index_mentions_on_mentionee_id"
t.index ["mentioner_id"], name: "index_mentions_on_mentioner_id"
@@ -316,7 +316,7 @@ class InitialSchema < ActiveRecord::Migration[8.2]
t.uuid "creator_id"
t.datetime "read_at"
t.uuid "source_id", null: false
t.string "source_type", null: false
t.string "source_type", limit: 255, null: false
t.datetime "updated_at", null: false
t.uuid "user_id", null: false
t.index ["creator_id"], name: "index_notifications_on_creator_id"
@@ -337,12 +337,12 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "push_subscriptions", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.uuid "account_id"
t.string "auth_key"
t.string "auth_key", limit: 255
t.datetime "created_at", null: false
t.string "endpoint"
t.string "p256dh_key"
t.text "endpoint"
t.string "p256dh_key", limit: 255
t.datetime "updated_at", null: false
t.string "user_agent"
t.string "user_agent", limit: 255
t.uuid "user_id", null: false
t.index ["endpoint", "p256dh_key", "auth_key"], name: "idx_on_endpoint_p256dh_key_auth_key_7553014576"
t.index ["endpoint"], name: "index_push_subscriptions_on_endpoint"
@@ -379,9 +379,9 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "sessions", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.datetime "created_at", null: false
t.uuid "identity_id", null: false
t.string "ip_address"
t.string "ip_address", limit: 255
t.datetime "updated_at", null: false
t.string "user_agent"
t.string "user_agent", limit: 255
t.index ["identity_id"], name: "index_sessions_on_identity_id"
end
@@ -408,7 +408,7 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "tags", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.uuid "account_id"
t.datetime "created_at", null: false
t.string "title"
t.string "title", limit: 255
t.datetime "updated_at", null: false
t.index ["title"], name: "index_tags_on_title", unique: true
end
@@ -416,7 +416,7 @@ class InitialSchema < ActiveRecord::Migration[8.2]
create_table "user_settings", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t|
t.integer "bundle_email_frequency", default: 0, null: false
t.datetime "created_at", null: false
t.string "timezone_name"
t.string "timezone_name", limit: 255
t.datetime "updated_at", null: false
t.uuid "user_id", null: false
t.index ["user_id", "bundle_email_frequency"], name: "index_user_settings_on_user_id_and_bundle_email_frequency"
@@ -428,8 +428,8 @@ class InitialSchema < ActiveRecord::Migration[8.2]
t.boolean "active", default: true, null: false
t.datetime "created_at", null: false
t.uuid "membership_id"
t.string "name", null: false
t.string "role", default: "member", null: false
t.string "name", limit: 255, null: false
t.string "role", limit: 255, default: "member", null: false
t.datetime "updated_at", null: false
t.index ["membership_id"], name: "index_users_on_membership_id"
t.index ["role"], name: "index_users_on_role"
@@ -460,7 +460,7 @@ class InitialSchema < ActiveRecord::Migration[8.2]
t.uuid "event_id", null: false
t.text "request"
t.text "response"
t.string "state", null: false
t.string "state", limit: 255, null: false
t.datetime "updated_at", null: false
t.uuid "webhook_id", null: false
t.index ["event_id"], name: "index_webhook_deliveries_on_event_id"
@@ -472,8 +472,8 @@ class InitialSchema < ActiveRecord::Migration[8.2]
t.boolean "active", default: true, null: false
t.uuid "board_id", null: false
t.datetime "created_at", null: false
t.string "name"
t.string "signing_secret", null: false
t.string "name", limit: 255
t.string "signing_secret", limit: 255, null: false
t.text "subscribed_actions"
t.datetime "updated_at", null: false
t.text "url", null: false
@@ -5,11 +5,11 @@ class AddSearchRecords < ActiveRecord::Migration[8.2]
# Create regular table with integer primary key for FTS5 rowid compatibility
create_table :search_records do |t|
t.uuid :account_id, null: false
t.string :searchable_type, null: false
t.string :searchable_type, limit: 255, null: false
t.uuid :searchable_id, null: false
t.uuid :card_id, null: false
t.uuid :board_id, null: false
t.string :title
t.string :title, limit: 255
t.text :content
t.datetime :created_at, null: false