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
| ALTER DATABASE jiffyshirts_development WITH ALLOW_CONNECTIONS FALSE; | |
| SELECT pg_terminate_backend(pg_stat_activity.pid) | |
| FROM pg_stat_activity | |
| WHERE | |
| pg_stat_activity.datname = 'jiffyshirts_development' | |
| AND pid <> pg_backend_pid(); | |
| CREATE DATABASE jiffyshirts_development_before_sync TEMPLATE jiffyshirts_development; |
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
| ALTER DATABASE jiffyshirts_development WITH ALLOW_CONNECTIONS FALSE; | |
| SELECT pg_terminate_backend(pg_stat_activity.pid) | |
| FROM pg_stat_activity | |
| WHERE | |
| pg_stat_activity.datname = 'jiffyshirts_development' | |
| AND pid <> pg_backend_pid(); | |
| CREATE DATABASE jiffyshirts_development_before_sync TEMPLATE jiffyshirts_development; |
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
| DELETE | |
| FROM spree_roles_users a USING spree_roles_users b | |
| WHERE | |
| a.id < b.id | |
| AND a.role_id = b.role_id | |
| AND a.user_id = b.user_id; |
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
| SELECT table_name, column_name | |
| FROM information_schema.columns | |
| WHERE | |
| column_name LIKE '%variant_id' |
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
| Service.group(:name).having{count.function.* >= 1}.select_map(:name).each do |name| | |
| service_ids = Service.order(:state).where(name: name).select_map(:id) | |
| service_ids.shift if name.present? | |
| ServiceMutation.where(service_id: service_ids).delete | |
| Service.where(id: service_ids).delete | |
| 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
| #!/bin/bash | |
| bundle exec rspec $(git status | grep spec | grep "изменено:" | cut -b 24-) |
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
| CREATE DATABASE db_name CHARACTER SET utf8 COLLATE utf8_general_ci; |
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 branch --merged | grep -v -E "*(develop|master)" | xargs -n 1 git branch -d |
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
| ActiveRecord::Base.connection.tables.each do |t| | |
| ActiveRecord::Base.connection.reset_pk_sequence!(t) | |
| 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
| translates = File.readlines(File.join(Rails.root, 'ru-zn.txt')) | |
| ru_zn = translates.map(&:chop).in_groups_of(2).sort_by{|a| -a.first.size}.select{|a| a.first.present?} | |
| files_path = Dir[File.join(Rails.root, 'config/locales/**/zh-CN.yml')] | |
| files_path.each do |file_path| | |
| text = File.open(file_path, 'r').read |
NewerOlder