-
Notifications
You must be signed in to change notification settings - Fork 3
/
post_install.rb
35 lines (29 loc) · 1.21 KB
/
post_install.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# -*- encoding : utf-8 -*-
# This file is executed in the Rails evironment by the `rails-post-deploy`
# script
def table_exists?(table)
ActiveRecord::Base.connection.table_exists?(table)
end
def column_exists?(table, column)
if table_exists?(table)
ActiveRecord::Base.connection.column_exists?(table, column)
end
end
# Add the identity_card_number field to the User model
unless column_exists?(:users, :identity_card_number)
migration_file_path = '../db/migrate/derechoapreguntar_theme_add_identity_card_number_to_user'
require File.expand_path migration_file_path, __FILE__
DerechoaPreguntarThemeAddIdentityCardNumberToUser.up
end
unless table_exists?(:general_laws)
migration_file_path = '../db/migrate/derechoapreguntar_theme_create_general_laws'
require File.expand_path migration_file_path, __FILE__
DerechoaPreguntarThemeCreateGeneralLaws.up
end
unless column_exists?(:general_laws, :user_id)
migration_file_path = '../db/migrate/derechoapreguntar_theme_add_user_id_to_general_laws'
require File.expand_path migration_file_path, __FILE__
DerechoaPreguntarThemeAddUserIdToGeneralLaws.up
end
# Create any necessary global Censor rules
require File.expand_path(File.dirname(__FILE__) + '/lib/censor_rules')