rt4914 / KlinicCon-Backend

2 stars 3 forks source link

Fixes #36: Add Specialization table. #43

Closed aniketpatidar closed 1 month ago

aniketpatidar commented 2 months ago

Resolves #36


Description

This pull request introduces creating the specializations table in the database. Table includes the following attributes: Specializations table:


Type of Change


How to test this PR?

Steps to test the migrations:

  1. Run rails db:migrate to apply the migration.
  2. Verify the specializations table is created in the database with the name columns, timestamps.
  3. Attempt to insert records with duplicate names in table to ensure the unique constraint is functioning as expected.
aniketpatidar commented 2 months ago

Update title toFixes #36 : Add ...

Also, once your previous PR gets merged, you can update this branch and assign it back to me.

I will make the changes you suggested!

rt4914 commented 1 month ago

@aniketpatidar You can update this now.

rt4914 commented 1 month ago

@aniketpatidar Can you inform me the process you followed for writing this code?

aniketpatidar commented 1 month ago

Firstly generated migration rails generate model Specialization name:string:uniq

Then added null false

class CreateSpecializations < ActiveRecord::Migration[6.1]
  def change
    create_table :specializations do |t|
      t.string :name, null: false

      t.timestamps
    end

    add_index :specializations, :name, unique: true
  end
end

Then run rails db:migrate