add message model and migration

This commit is contained in:
bijan
2022-05-12 19:44:54 +04:30
parent a6721fed75
commit 0185ac276c
7 changed files with 67 additions and 3 deletions

View File

@ -0,0 +1,11 @@
class CreateMessages < ActiveRecord::Migration[6.0]
def change
create_table :messages do |t|
t.string :title
t.text :description
t.string :email, null: false
t.string :phone
t.timestamps
end
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2022_05_12_124755) do
ActiveRecord::Schema.define(version: 2022_05_12_140948) do
create_table "active_admin_comments", force: :cascade do |t|
t.string "namespace"
@ -38,4 +38,13 @@ ActiveRecord::Schema.define(version: 2022_05_12_124755) do
t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
end
create_table "messages", force: :cascade do |t|
t.string "title"
t.text "description"
t.string "email", null: false
t.string "phone"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
end

View File

@ -5,5 +5,7 @@
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
AdminUser.create!(email: 'admin@example.com', password: 'password', password_confirmation: 'password') if Rails.env.development?
AdminUser.create!(email: 'bijan@example.com', password: '1234567890', password_confirmation: '1234567890') if Rails.env.development?
if Rails.env.development?
AdminUser.create!(email: 'admin@example.com', password: 'password', password_confirmation: 'password')
AdminUser.create!(email: 'bijan@example.com', password: '1234567890', password_confirmation: '1234567890')
end