From 6b0663af6c0d047956d499c45be089190e55ccd4 Mon Sep 17 00:00:00 2001 From: Patrick Mounir Date: Fri, 3 Mar 2017 20:37:14 +0200 Subject: [PATCH] The intial model of the user --- app/models/user.rb | 2 ++ db/migrate/20170303183523_create_users.rb | 13 ++++++++++++ db/schema.rb | 24 +++++++++++++++++++++++ test/fixtures/users.yml | 15 ++++++++++++++ test/models/user_test.rb | 7 +++++++ 5 files changed, 61 insertions(+) create mode 100644 app/models/user.rb create mode 100644 db/migrate/20170303183523_create_users.rb create mode 100644 db/schema.rb create mode 100644 test/fixtures/users.yml create mode 100644 test/models/user_test.rb diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..379658a --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,2 @@ +class User < ApplicationRecord +end diff --git a/db/migrate/20170303183523_create_users.rb b/db/migrate/20170303183523_create_users.rb new file mode 100644 index 0000000..3d9cc69 --- /dev/null +++ b/db/migrate/20170303183523_create_users.rb @@ -0,0 +1,13 @@ +class CreateUsers < ActiveRecord::Migration[5.0] + def change + create_table :users do |t| + t.string :first_name + t.string :last_name + t.string :email + t.string :email + t.boolean :verified + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..17c97ec --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,24 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20170303183523) do + + create_table "users", force: :cascade do |t| + t.string "first_name" + t.string "last_name" + t.string "email" + t.boolean "verified" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 0000000..0b74ddc --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,15 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + first_name: MyString + last_name: MyString + email: MyString + email: MyString + verified: false + +two: + first_name: MyString + last_name: MyString + email: MyString + email: MyString + verified: false diff --git a/test/models/user_test.rb b/test/models/user_test.rb new file mode 100644 index 0000000..82f61e0 --- /dev/null +++ b/test/models/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end