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

Add UI #70

Merged
merged 36 commits into from
Jul 9, 2024
Merged

Add UI #70

merged 36 commits into from
Jul 9, 2024

Conversation

VladislavSokov
Copy link
Collaborator

@VladislavSokov VladislavSokov commented Jun 24, 2024

  • add icons to the buttons
  • move logic from controller to a service
  • refactor with "each db connection"
  • intro new env var for "disabled"

@VladislavSokov VladislavSokov requested a review from ka8725 June 24, 2024 14:46
@VladislavSokov
Copy link
Collaborator Author

Screenshot from 2024-06-26 19-07-54
Screenshot from 2024-06-26 19-07-44

@VladislavSokov VladislavSokov marked this pull request as ready for review June 26, 2024 16:10
config/routes.rb Outdated Show resolved Hide resolved

initializer "actual_db_schema.append_routes", after: "add_routing_paths" do |app|
app.routes.append do
mount ActualDbSchema::Engine => "/actual_db_schema"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
mount ActualDbSchema::Engine => "/actual_db_schema"
mount ActualDbSchema::Engine => "/rails"

Can we do this? Won't it conflict with rails mailers previews?

lib/actual_db_schema.rb Outdated Show resolved Hide resolved
lib/actual_db_schema.rb Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@manual_mode = manual_mode || manual_mode_default?
super()
super(context: context)
Copy link
Member

@ka8725 ka8725 Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here that makes sense since the signature is different from base, unlike in others.

class << self
attr_accessor :config, :failed
end

self.failed = []
self.config = {
enabled: Rails.env.development?,
auto_rollback_disabled: ENV["ACTUAL_DB_SCHEMA_AUTO_ROLLBACK_DISABLED"].present?
enabled: Rails.env.development? || ENV["ACTUAL_DB_SCHEMA_ENABLED"].present?,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option is not related to this PR, please extract it to separate one.

@@ -1,3 +1,6 @@
## [0.7.6] - 2024-07-02
- Added UI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mention env vars/configs added

def index; end

def show
render :not_found, status: 404 unless migration
Copy link
Member

@ka8725 ka8725 Jul 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it render now if no migration is found? Please check. And also add tests.


def routes_setup
@routes = @app.routes
Rails.application.routes.draw do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still, why we should init routes here and why they are not initiated during engine loading? Maybe the problem is that the engine is not being loaded in tests? Then we should try to load it in tests?

These lines signify that the engine is not being loaded in tests and those lines are not covered by tests. And this is bad as the tests are fragile.

end

def branch_for(version)
metadata.fetch(version, {})[:branch] || "unknown"
end

def metadata
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please move these lines back so that we don't have the not relevant diff in git?

@ka8725
Copy link
Member

ka8725 commented Jul 8, 2024

Manual testing results:

  1. down migration cannot be rolled back, so hide the button?
image 2. If no phantom migrations the table looks clunky image Show some text saying no phantom migrations instead of the empty table? Or fix the table look so it's clear what's going on.
  1. WDYT if we don't show down phantom migrations in the table at all? Reason - there is no point in running it up and also since it's down the user cannot do with it anything. This kind of migration is useless for the current branch too. So if it's hidden the user won't notice. It's not a relevant thing that can be destroyed. I tend to think we can remove it entirely on down. Please tell what do you think, thanks!

@VladislavSokov
Copy link
Collaborator Author

3. WDYT if we don't show down phantom migrations in the table at all? Reason - there is no point in running it up and also since it's down the user cannot do with it anything. This kind of migration is useless for the current branch too. So if it's hidden the user won't notice. It's not a relevant thing that can be destroyed. I tend to think we can remove it entirely on down. Please tell what do you think, thanks!

I think this is a great idea

@ka8725 ka8725 merged commit 50356c2 into main Jul 9, 2024
8 checks passed
@ka8725 ka8725 deleted the add-ui branch July 9, 2024 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants