Create model for candidates with name and description
This commit is contained in:
parent
f7f1807839
commit
d6500e013d
6 changed files with 64 additions and 5 deletions
|
|
@ -5,7 +5,7 @@ class CreateVotes < ActiveRecord::Migration[7.2]
|
|||
t.string :title
|
||||
t.text :description
|
||||
t.datetime :expire_on
|
||||
t.timestamps null: false
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
10
db/migrate/20250321224552_create_candidates.rb
Normal file
10
db/migrate/20250321224552_create_candidates.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
class CreateCandidates < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :candidates do |t|
|
||||
t.belongs_to :vote
|
||||
t.string :name
|
||||
t.text :description
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
11
db/schema.rb
11
db/schema.rb
|
|
@ -10,7 +10,16 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2025_03_21_213011) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2025_03_21_224552) do
|
||||
create_table "candidates", force: :cascade do |t|
|
||||
t.integer "vote_id"
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["vote_id"], name: "index_candidates_on_vote_id"
|
||||
end
|
||||
|
||||
create_table "votes", force: :cascade do |t|
|
||||
t.string "secure_id"
|
||||
t.string "title"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue