Add basic column models and script to migrate

This commit is contained in:
Jorge Manrubia
2025-09-24 13:15:03 +02:00
parent c96334ca3d
commit cd025447f2
12 changed files with 141 additions and 16 deletions
@@ -0,0 +1,12 @@
class CreateColumnsAndAddColumnIdToCards < ActiveRecord::Migration[8.1]
def change
create_table :columns do |t|
t.string :name, null: false
t.string :color, null: false
t.references :collection, null: false, foreign_key: true
t.timestamps
end
add_reference :cards, :column, foreign_key: true, index: true
end
end
Generated
+14 -1
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.1].define(version: 2025_09_17_064006) do
ActiveRecord::Schema[8.1].define(version: 2025_09_24_100149) do
create_table "accesses", force: :cascade do |t|
t.datetime "accessed_at"
t.integer "collection_id", null: false
@@ -133,6 +133,7 @@ ActiveRecord::Schema[8.1].define(version: 2025_09_17_064006) do
create_table "cards", force: :cascade do |t|
t.integer "collection_id", null: false
t.integer "column_id"
t.datetime "created_at", null: false
t.integer "creator_id", null: false
t.date "due_on"
@@ -142,6 +143,7 @@ ActiveRecord::Schema[8.1].define(version: 2025_09_17_064006) do
t.string "title"
t.datetime "updated_at", null: false
t.index ["collection_id"], name: "index_cards_on_collection_id"
t.index ["column_id"], name: "index_cards_on_column_id"
t.index ["last_active_at", "status"], name: "index_cards_on_last_active_at_and_status"
t.index ["stage_id"], name: "index_cards_on_stage_id"
end
@@ -197,6 +199,15 @@ ActiveRecord::Schema[8.1].define(version: 2025_09_17_064006) do
t.index ["filter_id"], name: "index_collections_filters_on_filter_id"
end
create_table "columns", force: :cascade do |t|
t.integer "collection_id", null: false
t.string "color", null: false
t.datetime "created_at", null: false
t.string "name", null: false
t.datetime "updated_at", null: false
t.index ["collection_id"], name: "index_columns_on_collection_id"
end
create_table "comments", force: :cascade do |t|
t.integer "card_id", null: false
t.datetime "created_at", null: false
@@ -508,11 +519,13 @@ ActiveRecord::Schema[8.1].define(version: 2025_09_17_064006) do
add_foreign_key "ai_quotas", "users"
add_foreign_key "card_activity_spikes", "cards"
add_foreign_key "card_goldnesses", "cards"
add_foreign_key "cards", "columns"
add_foreign_key "cards", "workflow_stages", column: "stage_id"
add_foreign_key "closures", "cards"
add_foreign_key "closures", "users"
add_foreign_key "collection_publications", "collections"
add_foreign_key "collections", "workflows"
add_foreign_key "columns", "collections"
add_foreign_key "comments", "cards"
add_foreign_key "conversation_messages", "conversations"
add_foreign_key "conversations", "users"
+62 -1
View File
@@ -435,6 +435,16 @@ columns:
- *9
cards:
- *24
- !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
auto_increment:
name: column_id
cast_type: *3
sql_type_metadata: *4
'null': true
default:
default_function:
collation:
comment:
- *5
- &25 !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
auto_increment:
@@ -610,6 +620,22 @@ columns:
collections_filters:
- *24
- *20
columns:
- *24
- !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
auto_increment:
name: color
cast_type: *7
sql_type_metadata: *8
'null': false
default:
default_function:
collation:
comment:
- *5
- *6
- *10
- *9
comments:
- *23
- *5
@@ -1495,6 +1521,7 @@ primary_keys:
collection_publications: id
collections: id
collections_filters:
columns: id
comments: id
conversation_messages: id
conversations: id
@@ -1549,6 +1576,7 @@ data_sources:
collection_publications: true
collections: true
collections_filters: true
columns: true
comments: true
conversation_messages: true
conversations: true
@@ -1989,6 +2017,22 @@ indexes:
nulls_not_distinct:
comment:
valid: true
- !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition
table: cards
name: index_cards_on_column_id
unique: false
columns:
- column_id
lengths: {}
orders: {}
opclasses: {}
where:
type:
using:
include:
nulls_not_distinct:
comment:
valid: true
- !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition
table: cards
name: index_cards_on_last_active_at_and_status
@@ -2205,6 +2249,23 @@ indexes:
nulls_not_distinct:
comment:
valid: true
columns:
- !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition
table: columns
name: index_columns_on_collection_id
unique: false
columns:
- collection_id
lengths: {}
orders: {}
opclasses: {}
where:
type:
using:
include:
nulls_not_distinct:
comment:
valid: true
comments:
- !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition
table: comments
@@ -3191,4 +3252,4 @@ indexes:
comment:
valid: true
workflows: []
version: 20250917064006
version: 20250924100149