-
Notifications
You must be signed in to change notification settings - Fork 10
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
+550
−77
Merged
Add UI #70
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
12218c5
Add UI
VladislavSokov 930ffa1
fixup! Add UI
VladislavSokov 4ba8147
fixup! fixup! Add UI
VladislavSokov 4a73bd1
Add tests draft
VladislavSokov ff630e8
Add tests
VladislavSokov 0ceffa9
fixup! Add tests
VladislavSokov a970630
fixup! fixup! Add tests
VladislavSokov 05576d8
Refactoring
VladislavSokov bc614fa
fixup! Refactoring
VladislavSokov 994aea7
fixup! fixup! Refactoring
VladislavSokov 6335366
fixup! fixup! fixup! Refactoring
VladislavSokov 9008e5d
fixup! fixup! fixup! fixup! Refactoring
VladislavSokov 8aa0418
fixup! fixup! fixup! fixup! fixup! Refactoring
VladislavSokov f749e4f
fixup! fixup! fixup! fixup! fixup! fixup! Refactoring
VladislavSokov 7d8e928
Add Migration class
VladislavSokov 80e81cf
fixup! Add Migration class
VladislavSokov a45030d
fixup! fixup! Add Migration class
VladislavSokov 7c22e05
Add DatabaseConnection class
VladislavSokov fd65605
Add unecode icons to buttons
VladislavSokov ed534ea
fixup! Add DatabaseConnection class
VladislavSokov 0a465fd
fixup! fixup! Add DatabaseConnection class
VladislavSokov b715574
fixup! fixup! fixup! fixup! fixup! fixup! fixup! Refactoring
VladislavSokov 8404a76
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Refactoring
VladislavSokov b7c52f8
fixup! fixup! fixup! Add tests
VladislavSokov f0b4432
Add new env var for "disabled"
VladislavSokov ae996f9
Remove railtie
VladislavSokov e796256
fixup! fixup! fixup! Add DatabaseConnection class
VladislavSokov c26ace6
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Refact…
VladislavSokov 95a53b7
Memoize helper methods
VladislavSokov 64559bb
Rename migrations to phantom migrations
VladislavSokov af67231
Fix render not_found and add test
VladislavSokov bf05208
Revert changes for metadata method
VladislavSokov 336a088
add migration not found text
VladislavSokov 11aece9
hide "down" migrations
VladislavSokov da3bad1
fix tests
VladislavSokov d7f3ee2
fixup! fix tests
VladislavSokov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
body { | ||
margin: 8px; | ||
background-color: #fff; | ||
color: #333; | ||
} | ||
|
||
body, p, td { | ||
font-family: helvetica, verdana, arial, sans-serif; | ||
font-size: 13px; | ||
line-height: 18px; | ||
} | ||
|
||
h2 { | ||
padding-left: 10px; | ||
} | ||
|
||
table { | ||
margin: 0; | ||
border-collapse: collapse; | ||
|
||
thead tr { | ||
border-bottom: 2px solid #ddd; | ||
} | ||
|
||
tbody { | ||
tr { | ||
border-bottom: 1px solid #ddd; | ||
} | ||
|
||
tr:nth-child(odd) { | ||
background: #f2f2f2; | ||
} | ||
} | ||
|
||
td { | ||
padding: 14px 30px; | ||
} | ||
} | ||
|
||
.button { | ||
font-weight: bold; | ||
color: #000; | ||
border: none; | ||
padding: 5px 10px; | ||
text-align: center; | ||
text-decoration: none; | ||
display: inline-block; | ||
margin: 0 2px; | ||
cursor: pointer; | ||
border-radius: 4px; | ||
transition: background-color 0.3s; | ||
background: none; | ||
} | ||
|
||
.button:hover { | ||
color: #fff; | ||
background-color: #000; | ||
} | ||
|
||
.button-container { | ||
display: flex; | ||
} | ||
|
||
pre { | ||
background-color: #f7f7f7; | ||
padding: 10px; | ||
border: 1px solid #ddd; | ||
} |
27 changes: 27 additions & 0 deletions
27
app/controllers/actual_db_schema/phantom_migrations_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
module ActualDbSchema | ||
# Controller to display the list of phantom migrations for each database connection. | ||
class PhantomMigrationsController < ActionController::Base | ||
def index; end | ||
|
||
def show | ||
render file: "#{Rails.root}/public/404.html", layout: false, status: :not_found unless phantom_migration | ||
end | ||
|
||
def rollback | ||
ActualDbSchema::Migration.rollback(params[:id], params[:database]) | ||
redirect_to phantom_migrations_path | ||
end | ||
|
||
private | ||
|
||
helper_method def phantom_migrations | ||
@phantom_migrations ||= ActualDbSchema::Migration.all | ||
end | ||
|
||
helper_method def phantom_migration | ||
@phantom_migration ||= ActualDbSchema::Migration.find(params[:id], params[:database]) | ||
end | ||
end | ||
end |
45 changes: 45 additions & 0 deletions
45
app/views/actual_db_schema/phantom_migrations/index.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Phantom Migrations</title> | ||
<%= stylesheet_link_tag 'actual_db_schema/styles', media: 'all' %> | ||
</head> | ||
<body> | ||
<div> | ||
<h2>Phantom Migrations</h2> | ||
<% if phantom_migrations.present? %> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Status</th> | ||
<th>Migration ID</th> | ||
<th>Name</th> | ||
<th>Branch</th> | ||
<th>Database</th> | ||
<th>Actions</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% phantom_migrations.each do |migration| %> | ||
<tr> | ||
<td><%= migration[:status] %></td> | ||
<td><%= migration[:version] %></td> | ||
<td><%= migration[:name] %></td> | ||
<td><%= migration[:branch] %></td> | ||
<td><%= migration[:database] %></td> | ||
<td> | ||
<div class='button-container'> | ||
<%= link_to '👁 Show', phantom_migration_path(id: migration[:version], database: migration[:database]), class: 'button' %> | ||
<%= button_to '⎌ Rollback', rollback_phantom_migration_path(id: migration[:version], database: migration[:database]), method: :post, class: 'button' %> | ||
</div> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
<% else %> | ||
<p>No phantom migrations found.</p> | ||
<% end %> | ||
</div> | ||
</body> | ||
</html> |
45 changes: 45 additions & 0 deletions
45
app/views/actual_db_schema/phantom_migrations/show.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Phantom Migration Details</title> | ||
<%= stylesheet_link_tag 'actual_db_schema/styles', media: 'all' %> | ||
</head> | ||
<body> | ||
<div> | ||
<h2>Phantom Migration <%= phantom_migration[:name] %> Details</h2> | ||
<table> | ||
<tbody> | ||
<tr> | ||
<th>Status</th> | ||
<td><%= phantom_migration[:status] %></td> | ||
</tr> | ||
<tr> | ||
<th>Migration ID</th> | ||
<td><%= phantom_migration[:version] %></td> | ||
</tr> | ||
<tr> | ||
<th>Branch</th> | ||
<td><%= phantom_migration[:branch] %></td> | ||
</tr> | ||
<tr> | ||
<th>Database</th> | ||
<td><%= phantom_migration[:database] %></td> | ||
</tr> | ||
<tr> | ||
<th>Path</th> | ||
<td><%= phantom_migration[:filename] %></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<h3>Migration Code</h3> | ||
<div> | ||
<pre><%= File.read(phantom_migration[:filename]) %></pre> | ||
</div> | ||
<div class='button-container'> | ||
<%= link_to '← Back', phantom_migrations_path, class: 'button' %> | ||
<%= button_to '⎌ Rollback', rollback_phantom_migration_path(id: params[:id], database: params[:database]), method: :post, class: 'button' %> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
ActualDbSchema::Engine.routes.draw do | ||
resources :phantom_migrations, only: %i[index show] do | ||
member do | ||
post :rollback | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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