Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc(DB) - add annotate --frozen to the GH workflow #2535

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/workflows/migrations-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Run rails migrations
on:
push:
branches:
- "main"
- 'main'
pull_request:
types: [opened, synchronize, reopened]
jobs:
Expand All @@ -13,14 +13,14 @@ jobs:
postgres:
image: postgres:14-alpine
ports:
- "5432:5432"
- '5432:5432'
env:
POSTGRES_DB: lago
POSTGRES_USER: lago
POSTGRES_PASSWORD: lago
env:
RAILS_ENV: test
DATABASE_URL: "postgres://lago:lago@localhost:5432/lago"
DATABASE_URL: 'postgres://lago:lago@localhost:5432/lago'
RAILS_MASTER_KEY: ${{ secrets.RAILS_TEST_KEY }}
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
ENCRYPTION_PRIMARY_KEY: 5I9mjfzry2P787x4S5ZuDdJwXNgYEwqo
Expand All @@ -34,16 +34,17 @@ jobs:
LAGO_CLICKHOUSE_MIGRATIONS_ENABLED: true
LAGO_CLICKHOUSE_HOST: localhost
LAGO_CLICKHOUSE_DATABASE: default
LAGO_CLICKHOUSE_USERNAME: ""
LAGO_CLICKHOUSE_PASSWORD: ""
LAGO_CLICKHOUSE_USERNAME: ''
LAGO_CLICKHOUSE_PASSWORD: ''
LAGO_DISABLE_SCHEMA_DUMP: true
ANNOTATE_SKIP_ON_DB_MIGRATE: 1
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3.4"
ruby-version: '3.3.4'
bundler-cache: true
- name: Start Clickhouse database
run: |
Expand All @@ -59,5 +60,7 @@ jobs:
run: LAGO_DISABLE_SCHEMA_DUMP="" bin/rails db:schema:dump:primary
- name: Ensure no changes to schema.rb
run: diff db/schema.rb db/schema-before-dump.rb
- name: Ensure annotations are up to date
run: bundle exec annotate --frozen
- name: Perform Clickhouse database migrations
run: bin/rails db:migrate:clickhouse
2 changes: 1 addition & 1 deletion app/models/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def ensure_slug
# deleted_at :datetime
# document_locale :string
# email :string
# finalize_zero_amount_invoice :integer default(0), not null
# finalize_zero_amount_invoice :integer default("inherit"), not null
# invoice_grace_period :integer
# legal_name :string
# legal_number :string
Expand Down
2 changes: 1 addition & 1 deletion app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def validate_email_settings
# email :string
# email_settings :string default([]), not null, is an Array
# eu_tax_management :boolean default(FALSE)
# finalize_zero_amount_invoice :boolean default(FALSE), not null
# finalize_zero_amount_invoice :boolean default(TRUE), not null
# invoice_footer :text
# invoice_grace_period :integer default(0), not null
# legal_name :string
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/auto_annotate_models.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# NOTE: only doing this in development as some production environments (Heroku)
# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
# NOTE: to have a dev-mode tool do its thing in production.
if Rails.env.development?
if Rails.env.development? || Rails.env.test?
require 'annotate'
task set_annotation_options: :environment do
# You can override any of these by setting an environment variable of the
Expand Down