Skip to content

Instantly share code, notes, and snippets.

@buncis
Created August 21, 2025 15:05
Show Gist options
  • Select an option

  • Save buncis/7c424ecb3d84ebf078e5652a5d49e4a6 to your computer and use it in GitHub Desktop.

Select an option

Save buncis/7c424ecb3d84ebf078e5652a5d49e4a6 to your computer and use it in GitHub Desktop.

Revisions

  1. buncis created this gist Aug 21, 2025.
    13 changes: 13 additions & 0 deletions only 1 record active .md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    create boolean value that could be nilled

    ```
    class AddActiveToQuestionnaire < ActiveRecord::Migration[7.2]
    def change
    add_column :questionnaires, :active, :boolean
    add_check_constraint :questionnaires, "active", name: "only_accept_true_or_null"
    add_index :questionnaires, :active, unique: true
    end
    end
    ```

    https://github.com/buncis/norma/commit/2ee90bb3e57fde446a24e59b1087714f2239f845