Skip to content

Commit 486351e

Browse files
committed
Create new migrate for products
1 parent 9c2b515 commit 486351e

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class AddImageToProducts < ActiveRecord::Migration[5.2]
2+
def change
3+
add_column :products, :image, :string
4+
add_column :products, :price, :float
5+
end
6+
end

pdv/db/schema.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 2019_02_21_164522) do
13+
ActiveRecord::Schema.define(version: 2019_02_22_135428) do
1414

1515
# These are extensions that must be enabled in order to support this database
1616
enable_extension "plpgsql"
@@ -24,6 +24,8 @@
2424
t.integer "stock"
2525
t.datetime "created_at", null: false
2626
t.datetime "updated_at", null: false
27+
t.string "image"
28+
t.float "price"
2729
end
2830

2931
create_table "users", force: :cascade do |t|

pdv/db/seeds.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
color: Faker::Color.hex_color,
3131
size: 'M',
3232
cod: Faker::Number.between(1, 50),
33-
stock: Faker::Number.between(1, 20)
33+
stock: Faker::Number.between(1, 20),
34+
price: Faker::Number.decimal(2),
35+
image: 'https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/intermediary/f/38b64177-e45a-4594-b08f-6e3867bec3db/dc4jxz3-28497fff-312c-48f8-9b3b-4fa8a65a34a9.png/v1/fill/w_888,h_899,strp/katsuki_bakugou_chibi_by_staticblu_dc4jxz3-pre.png'
3436
})
3537
end

0 commit comments

Comments
 (0)