summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/card.rb3
-rw-r--r--db/migrate/20230325061452_create_cards.rb14
-rw-r--r--spec/models/card_spec.rb5
3 files changed, 22 insertions, 0 deletions
diff --git a/app/models/card.rb b/app/models/card.rb
new file mode 100644
index 0000000..ae2b1e5
--- /dev/null
+++ b/app/models/card.rb
@@ -0,0 +1,3 @@
+class Card < ApplicationRecord
+ belongs_to :user_account
+end
diff --git a/db/migrate/20230325061452_create_cards.rb b/db/migrate/20230325061452_create_cards.rb
new file mode 100644
index 0000000..6e06e36
--- /dev/null
+++ b/db/migrate/20230325061452_create_cards.rb
@@ -0,0 +1,14 @@
+class CreateCards < ActiveRecord::Migration[7.0]
+ def change
+ create_table :cards do |t|
+ t.string :number
+ t.integer :expiration_month
+ t.integer :expiration_year
+ t.integer :expiration_day
+ t.integer :security_code
+ t.references :user_account, null: false, foreign_key: true
+
+ t.timestamps
+ end
+ end
+end
diff --git a/spec/models/card_spec.rb b/spec/models/card_spec.rb
new file mode 100644
index 0000000..6f49b4a
--- /dev/null
+++ b/spec/models/card_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe Card, type: :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end