feat: Create users

Users migration, model, controller. user_id to links. signup view
This commit is contained in:
Juan Rodriguez
2021-06-14 08:24:34 -05:00
parent 3e8bdee17a
commit f63be42b4c
21 changed files with 159 additions and 21 deletions
+12
View File
@@ -0,0 +1,12 @@
# frozen_string_literal: true
class CreateUsers < ActiveRecord::Migration[5.2]
def change
create_table :users do |t|
t.string :username
t.string :password_digest
t.timestamps
end
end
end
@@ -0,0 +1,7 @@
# frozen_string_literal: true
class AddUserIdToLinks < ActiveRecord::Migration[5.2]
def change
add_reference :links, :user, foreign_key: true
end
end
+12 -1
View File
@@ -12,7 +12,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20_210_613_145_459) do
ActiveRecord::Schema.define(version: 20_210_614_114_837) do
# These are extensions that must be enabled in order to support this database
enable_extension 'plpgsql'
@@ -22,6 +22,17 @@ ActiveRecord::Schema.define(version: 20_210_613_145_459) do
t.integer 'click_counter', default: 0
t.datetime 'created_at', null: false
t.datetime 'updated_at', null: false
t.bigint 'user_id'
t.index ['slug'], name: 'index_links_on_slug'
t.index ['user_id'], name: 'index_links_on_user_id'
end
create_table 'users', force: :cascade do |t|
t.string 'username'
t.string 'password_digest'
t.datetime 'created_at', null: false
t.datetime 'updated_at', null: false
end
add_foreign_key 'links', 'users'
end