This file contains hidden or 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
git restore db/schema.rb | |
pg_dump -U username -d database_name -a -F t -f data.dump | |
rails db:drop | |
rails db:create | |
rails db:schema:load | |
rails db:migrate | |
pg_restore -U username -d database_name data.dump |
This file contains hidden or 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
WITH tbl AS | |
(SELECT table_schema, | |
TABLE_NAME | |
FROM information_schema.tables | |
WHERE TABLE_NAME not like 'pg_%' | |
AND table_schema in ('public')) | |
SELECT table_schema, | |
TABLE_NAME, | |
(xpath('/row/c/text()', query_to_xml(format('select count(*) as c from %I.%I', table_schema, TABLE_NAME), FALSE, TRUE, '')))[1]::text::int AS rows_n | |
FROM tbl |
This file contains hidden or 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
Rails.application.routes.recognize_path '/meeting_packs/1/view' |
This file contains hidden or 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
FactoryBot.factories.instance_variable_get(:@items).keys.sort |
This file contains hidden or 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
# The logic here is dishonestly stolen from Gutentag gem: | |
# https://github.com/pat/gutentag/blob/0dbcd1dbcd4de8930e589cf964498abe46127a98/lib/gutentag/tagged_with/query.rb#L11 | |
# Models definitions | |
class Book < ApplicationRecord | |
has_many :category_mappings, as: :categorizable, dependent: :destroy | |
has_many :categories, through: :category_mappings | |
end |
This file contains hidden or 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
# username | |
# appname | |
# gemset | |
[Unit] | |
Description=Puma HTTP Server | |
After=network.target | |
[Service] | |
Type=forking |