diff --git a/README.md b/README.md index a5bb25e..e1fcca0 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,20 @@ # Requisitos + - Docker (Gerenciador de container) [Instalando Docker no Windows](https://docs.docker.com/desktop/install/windows-install/) # Setup + - Execute `./scripts/setup` para gerar a base do container, esse processo pode demorar um pouco pois será baixada todas as depêndencias do projeto, libs e banco de dados. # Levantar a aplicação + - Execute `docker-compose up` # Executar comandos no container + - Execute `./scripts/bash` para executar comandos você precisa entrar no console do container, agora você poderar por exemplo rodar as migrações de dados. -- Execute `rails db:migration` para rodar as migrações no banco de dados. +- Execute `rails db:migrate` para rodar as migrações no banco de dados. - Execute `bundle exec rake environment "user:create_admin[sem.email@example.com, Seu nome]"` para criar seu usuário -- Execute `rails db:seed` para popular o banco com os assuntos, exios e categorias \ No newline at end of file +- Execute `rails db:seed` para popular o banco com os assuntos, exios e categorias diff --git a/app/models/review_request.rb b/app/models/review_request.rb index c5154f5..05bdf72 100644 --- a/app/models/review_request.rb +++ b/app/models/review_request.rb @@ -3,7 +3,7 @@ # Table name: review_requests # # id :bigint not null, primary key -# answered :string +# answered :string not null # created_at :datetime not null # updated_at :datetime not null # question_id :bigint not null diff --git a/db/migrate/20230504002009_change_review_request_answered_to_not_nil.rb b/db/migrate/20230504002009_change_review_request_answered_to_not_nil.rb new file mode 100644 index 0000000..cb871fc --- /dev/null +++ b/db/migrate/20230504002009_change_review_request_answered_to_not_nil.rb @@ -0,0 +1,7 @@ +class ChangeReviewRequestAnsweredToNotNil < ActiveRecord::Migration[7.0] + def change + ReviewRequest.where(answered: nil).update_all(answered: false) + + change_column_null :review_requests, :answered, false + end +end diff --git a/db/schema.rb b/db/schema.rb index fd29e44..b36bf57 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2022_08_05_233401) do +ActiveRecord::Schema[7.0].define(version: 2023_05_04_002009) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -110,7 +110,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_08_05_233401) do end create_table "review_requests", force: :cascade do |t| - t.string "answered" + t.string "answered", null: false t.bigint "question_id", null: false t.bigint "user_id", null: false t.datetime "created_at", null: false diff --git a/spec/factories/review_requests.rb b/spec/factories/review_requests.rb index c79c077..a50e9d9 100644 --- a/spec/factories/review_requests.rb +++ b/spec/factories/review_requests.rb @@ -3,7 +3,7 @@ # Table name: review_requests # # id :bigint not null, primary key -# answered :string +# answered :string not null # created_at :datetime not null # updated_at :datetime not null # question_id :bigint not null diff --git a/spec/models/review_request_spec.rb b/spec/models/review_request_spec.rb index 7cd001b..0c75cd3 100644 --- a/spec/models/review_request_spec.rb +++ b/spec/models/review_request_spec.rb @@ -3,7 +3,7 @@ # Table name: review_requests # # id :bigint not null, primary key -# answered :string +# answered :string not null # created_at :datetime not null # updated_at :datetime not null # question_id :bigint not null